Add json storage for container storage

This is just a temporary storage solution to get
containers running on the new code.

Signed-off-by: Derek McGowan <derek@mcgstyle.net>
This commit is contained in:
Derek McGowan
2017-05-23 13:00:30 -07:00
parent 539742881d
commit e1ed4a2ea4
6 changed files with 118 additions and 11 deletions

View File

@@ -144,7 +144,7 @@ func (s *Service) Create(ctx context.Context, r *api.CreateRequest) (*api.Create
s.mu.Lock()
if _, ok := s.tasks[r.ContainerID]; ok {
s.mu.Unlock()
return nil, plugin.ErrContainerExists
return nil, grpc.Errorf(codes.AlreadyExists, "task %v already exists", r.ContainerID)
}
c, err := runtime.Create(ctx, r.ContainerID, opts)
if err != nil {
@@ -457,7 +457,7 @@ func (s *Service) getTask(id string) (plugin.Task, error) {
c, ok := s.tasks[id]
s.mu.Unlock()
if !ok {
return nil, plugin.ErrContainerNotExist
return nil, grpc.Errorf(codes.NotFound, "task %v not found", id)
}
return c, nil
}