Track container IDs in index

Signed-off-by: Mrunal Patel <mrunalp@gmail.com>
This commit is contained in:
Mrunal Patel 2016-10-05 11:31:41 -07:00
parent e9ab839955
commit edba913f67

View file

@ -99,6 +99,10 @@ func (s *Server) CreateContainer(ctx context.Context, req *pb.CreateContainerReq
s.addContainer(container)
if err := s.ctrIDIndex.Add(containerID); err != nil {
return nil, err
}
return &pb.CreateContainerResponse{
ContainerId: &containerID,
}, nil
@ -397,6 +401,10 @@ func (s *Server) RemoveContainer(ctx context.Context, req *pb.RemoveContainerReq
s.releaseContainerName(c.Name())
s.removeContainer(c)
if err := s.ctrIDIndex.Delete(c.ID()); err != nil {
return nil, err
}
return &pb.RemoveContainerResponse{}, nil
}