diff --git a/event.go b/event.go index ee25d28..2680955 100644 --- a/event.go +++ b/event.go @@ -32,19 +32,19 @@ func NewEvent(t EventType) *Event { } type Event struct { - Type EventType `json:"type"` - Timestamp time.Time `json:"timestamp"` - ID string `json:"id,omitempty"` - BundlePath string `json:"bundlePath,omitempty"` - Stdio *runtime.Stdio `json:"stdio,omitempty"` - Pid int `json:"pid,omitempty"` - Status int `json:"status,omitempty"` - Signal os.Signal `json:"signal,omitempty"` - Process *specs.Process `json:"process,omitempty"` - State *runtime.State `json:"state,omitempty"` - Containers []runtime.Container `json:"-"` - Checkpoint *runtime.Checkpoint `json:"checkpoint,omitempty"` - Err chan error `json:"-"` + Type EventType + Timestamp time.Time + ID string + BundlePath string + Stdio *runtime.Stdio + Pid int + Status int + Signal os.Signal + Process *specs.Process + State *runtime.State + Containers []runtime.Container + Checkpoint *runtime.Checkpoint + Err chan error } type Handler interface { diff --git a/runtime/container.go b/runtime/container.go index 43c6dd0..ef2a2a7 100644 --- a/runtime/container.go +++ b/runtime/container.go @@ -21,27 +21,27 @@ const ( ) type State struct { - Status Status `json:"status,omitempty"` + Status Status } type Stdio struct { - Stderr string `json:"stderr,omitempty"` - Stdout string `json:"stdout,omitempty"` + Stderr string + Stdout string } type Checkpoint struct { // Timestamp is the time that checkpoint happened - Timestamp time.Time `json:"timestamp,omitempty"` + Timestamp time.Time // Name is the name of the checkpoint - Name string `json:"name,omitempty"` + Name string // Tcp checkpoints open tcp connections - Tcp bool `json:"tcp"` + Tcp bool // UnixSockets persists unix sockets in the checkpoint - UnixSockets bool `json:"unixSockets"` + UnixSockets bool // Shell persists tty sessions in the checkpoint - Shell bool `json:"shell"` + Shell bool // Exit exits the container after the checkpoint is finished - Exit bool `json:"exit,omitempty"` + Exit bool } type Container interface { @@ -67,12 +67,12 @@ type Container interface { Resume() error // Pause pauses a running container Pause() error - + // Checkpoints returns all the checkpoints for a container Checkpoints() ([]Checkpoint, error) - + // Checkpoint creates a new checkpoint Checkpoint(Checkpoint) error - + // DeleteCheckpoint deletes the checkpoint for the provided name DeleteCheckpoint(name string) error - + // Restore restores the container to that of the checkpoint provided by name Restore(name string) error }