Add events support in client
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
This commit is contained in:
parent
288b9a0cc3
commit
71ef776082
7 changed files with 70 additions and 20 deletions
|
@ -217,12 +217,14 @@ func (s *apiServer) UpdateContainer(ctx context.Context, r *types.UpdateContaine
|
|||
|
||||
func (s *apiServer) Events(r *types.EventsRequest, stream types.API_EventsServer) error {
|
||||
events := s.sv.Events()
|
||||
defer s.sv.Unsubscribe(events)
|
||||
for evt := range events {
|
||||
switch evt.Type {
|
||||
case containerd.ExitEventType:
|
||||
ev := &types.Event{
|
||||
Type: "exit",
|
||||
Id: evt.ID,
|
||||
Pid: uint32(evt.Pid),
|
||||
Status: uint32(evt.Status),
|
||||
}
|
||||
if err := stream.Send(ev); err != nil {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue