[#328] cmd/node: Serve Container.AnnounceUsedSpace RPC

Register recently implemented handler of AnnounceUsedSpace RPC in node app.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
Leonard Lyubich 2021-02-01 15:43:09 +03:00 committed by Leonard Lyubich
parent b270c49b5c
commit bd5c70131b
4 changed files with 35 additions and 3 deletions

View file

@ -124,9 +124,13 @@ func initContainerService(c *cfg) {
containerService.NewSignService( containerService.NewSignService(
c.key, c.key,
containerService.NewResponseService( containerService.NewResponseService(
containerService.NewExecutionService( &usedSpaceService{
containerMorph.NewExecutor(cnrClient), Service: containerService.NewExecutionService(containerMorph.NewExecutor(cnrClient)),
), loadWriterProvider: loadRouter,
loadPlacementBuilder: loadPlacementBuilder,
routeBuilder: routeBuilder,
cfg: c,
},
c.respSvc, c.respSvc,
), ),
), ),

View file

@ -17,6 +17,8 @@ type ServiceExecutor interface {
} }
type executorSvc struct { type executorSvc struct {
container.Service
exec ServiceExecutor exec ServiceExecutor
} }

View file

@ -100,3 +100,16 @@ func (s *responseService) GetExtendedACL(ctx context.Context, req *container.Get
return resp.(*container.GetExtendedACLResponse), nil return resp.(*container.GetExtendedACLResponse), nil
} }
func (s *responseService) AnnounceUsedSpace(ctx context.Context, req *container.AnnounceUsedSpaceRequest) (*container.AnnounceUsedSpaceResponse, error) {
resp, err := s.respSvc.HandleUnaryRequest(ctx, req,
func(ctx context.Context, req interface{}) (util.ResponseMessage, error) {
return s.svc.AnnounceUsedSpace(ctx, req.(*container.AnnounceUsedSpaceRequest))
},
)
if err != nil {
return nil, err
}
return resp.(*container.AnnounceUsedSpaceResponse), nil
}

View file

@ -98,3 +98,16 @@ func (s *signService) GetExtendedACL(ctx context.Context, req *container.GetExte
return resp.(*container.GetExtendedACLResponse), nil return resp.(*container.GetExtendedACLResponse), nil
} }
func (s *signService) AnnounceUsedSpace(ctx context.Context, req *container.AnnounceUsedSpaceRequest) (*container.AnnounceUsedSpaceResponse, error) {
resp, err := s.sigSvc.HandleUnaryRequest(ctx, req,
func(ctx context.Context, req interface{}) (util.ResponseMessage, error) {
return s.svc.AnnounceUsedSpace(ctx, req.(*container.AnnounceUsedSpaceRequest))
},
)
if err != nil {
return nil, err
}
return resp.(*container.AnnounceUsedSpaceResponse), nil
}