Add labels and fileters to content

Update list content command to support filters
Add label subcommand to content in dist tool to update labels
Add uncompressed label on unpack

Signed-off-by: Derek McGowan <derek@mcgstyle.net>
This commit is contained in:
Derek McGowan
2017-07-05 17:00:11 -07:00
parent 1a49f5ea79
commit fba7463ed3
14 changed files with 973 additions and 160 deletions

View File

@@ -79,14 +79,22 @@ func (s *Service) Info(ctx context.Context, req *api.InfoRequest) (*api.InfoResp
}
return &api.InfoResponse{
Info: api.Info{
Digest: bi.Digest,
Size_: bi.Size,
CommittedAt: bi.CommittedAt,
},
Info: infoToGRPC(bi),
}, nil
}
func (s *Service) Update(ctx context.Context, req *api.UpdateRequest) (*empty.Empty, error) {
if err := req.Info.Digest.Validate(); err != nil {
return nil, grpc.Errorf(codes.InvalidArgument, "%q failed validation", req.Info.Digest)
}
if err := s.store.Update(ctx, infoFromGRPC(req.Info), req.UpdateMask.GetPaths()...); err != nil {
return nil, errdefs.ToGRPC(err)
}
return &empty.Empty{}, nil
}
func (s *Service) List(req *api.ListContentRequest, session api.Content_ListServer) error {
var (
buffer []api.Info
@@ -103,6 +111,7 @@ func (s *Service) List(req *api.ListContentRequest, session api.Content_ListServ
Digest: info.Digest,
Size_: info.Size,
CommittedAt: info.CommittedAt,
Labels: info.Labels,
})
if len(buffer) >= 100 {
@@ -114,7 +123,7 @@ func (s *Service) List(req *api.ListContentRequest, session api.Content_ListServ
}
return nil
}); err != nil {
}, req.Filters...); err != nil {
return err
}