[#328] container/grpc: Implement AnnounceUsedSpace method

Add AnnounceUsedSpace method that converts gRPC request to v2 request and
passes it to v2 client.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
Leonard Lyubich 2021-02-01 15:31:40 +03:00 committed by Leonard Lyubich
parent 8419294f22
commit 7e586aef90

View file

@ -85,3 +85,14 @@ func (s *Server) GetExtendedACL(ctx context.Context, req *containerGRPC.GetExten
return container.GetExtendedACLResponseToGRPCMessage(resp), nil
}
// AnnounceUsedSpace converts gRPC AnnounceUsedSpaceRequest message and passes it to internal Container service.
func (s *Server) AnnounceUsedSpace(ctx context.Context, req *containerGRPC.AnnounceUsedSpaceRequest) (*containerGRPC.AnnounceUsedSpaceResponse, error) {
resp, err := s.srv.AnnounceUsedSpace(ctx, container.AnnounceUsedSpaceRequestFromGRPCMessage(req))
if err != nil {
// TODO: think about how we transport errors through gRPC
return nil, err
}
return container.AnnounceUsedSpaceResponseToGRPCMessage(resp), nil
}