Update services to call garbage collection
Call garbage collection on container and image deletion. Signed-off-by: Derek McGowan <derek@mcgstyle.net>
This commit is contained in:
parent
17471d5592
commit
de7b281856
@ -10,6 +10,7 @@ import (
|
||||
"github.com/containerd/containerd/metadata"
|
||||
"github.com/containerd/containerd/plugin"
|
||||
"github.com/golang/protobuf/ptypes/empty"
|
||||
"github.com/pkg/errors"
|
||||
"golang.org/x/net/context"
|
||||
"google.golang.org/grpc"
|
||||
"google.golang.org/grpc/codes"
|
||||
@ -160,6 +161,10 @@ func (s *Service) Delete(ctx context.Context, req *api.DeleteContainerRequest) (
|
||||
return &empty.Empty{}, err
|
||||
}
|
||||
|
||||
if err := s.db.GarbageCollect(ctx); err != nil {
|
||||
return &empty.Empty{}, errdefs.ToGRPC(errors.Wrap(err, "garbage collection failed"))
|
||||
}
|
||||
|
||||
return &empty.Empty{}, nil
|
||||
}
|
||||
|
||||
|
@ -10,6 +10,7 @@ import (
|
||||
"github.com/containerd/containerd/metadata"
|
||||
"github.com/containerd/containerd/plugin"
|
||||
"github.com/golang/protobuf/ptypes/empty"
|
||||
"github.com/pkg/errors"
|
||||
"golang.org/x/net/context"
|
||||
"google.golang.org/grpc"
|
||||
"google.golang.org/grpc/codes"
|
||||
@ -161,6 +162,10 @@ func (s *Service) Delete(ctx context.Context, req *imagesapi.DeleteImageRequest)
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if err := s.db.GarbageCollect(ctx); err != nil {
|
||||
return nil, errdefs.ToGRPC(errors.Wrap(err, "garbage collection failed"))
|
||||
}
|
||||
|
||||
return &empty.Empty{}, nil
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user