Move to a single Event type
Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com>
This commit is contained in:
parent
8fbdf1c0d7
commit
31f26fed18
2 changed files with 17 additions and 13 deletions
|
@ -50,8 +50,8 @@ var runCommand = cli.Command{
|
|||
}
|
||||
defer nec.Close()
|
||||
|
||||
evCh := make(chan *execEvents.ContainerExitEvent, 64)
|
||||
sub, err := nec.Subscribe(execEvents.ContainersEventsSubjectSubscriber, func(e *execEvents.ContainerExitEvent) {
|
||||
evCh := make(chan *execEvents.ContainerEvent, 64)
|
||||
sub, err := nec.Subscribe(execEvents.ContainersEventsSubjectSubscriber, func(e *execEvents.ContainerEvent) {
|
||||
evCh <- e
|
||||
})
|
||||
if err != nil {
|
||||
|
@ -118,8 +118,8 @@ var runCommand = cli.Command{
|
|||
break eventLoop
|
||||
}
|
||||
|
||||
if e.ID == cr.Container.ID && e.PID == cr.InitProcess.Pid {
|
||||
ec = e.StatusCode
|
||||
if e.ID == cr.Container.ID && e.Pid == cr.InitProcess.Pid {
|
||||
ec = e.ExitStatus
|
||||
break eventLoop
|
||||
}
|
||||
case <-time.After(1 * time.Second):
|
||||
|
|
|
@ -2,16 +2,20 @@ package execution
|
|||
|
||||
import "time"
|
||||
|
||||
type ContainerEvent struct {
|
||||
Timestamp time.Time
|
||||
ID string
|
||||
Action string
|
||||
}
|
||||
const (
|
||||
ExitEvent = "exit"
|
||||
OOMEvent = "oom"
|
||||
CreateEvent = "create"
|
||||
StartEvent = "start"
|
||||
ExecEvent = "exec-added9"
|
||||
)
|
||||
|
||||
type ContainerExitEvent struct {
|
||||
ContainerEvent
|
||||
PID uint32
|
||||
StatusCode uint32
|
||||
type ContainerEvent struct {
|
||||
Timestamp time.Time
|
||||
ID string
|
||||
Type string
|
||||
Pid uint32
|
||||
ExitStatus uint32
|
||||
}
|
||||
|
||||
const (
|
||||
|
|
Loading…
Reference in a new issue