[#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:
parent
b270c49b5c
commit
bd5c70131b
4 changed files with 35 additions and 3 deletions
|
@ -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,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
|
@ -17,6 +17,8 @@ type ServiceExecutor interface {
|
||||||
}
|
}
|
||||||
|
|
||||||
type executorSvc struct {
|
type executorSvc struct {
|
||||||
|
container.Service
|
||||||
|
|
||||||
exec ServiceExecutor
|
exec ServiceExecutor
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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
|
||||||
|
}
|
||||||
|
|
|
@ -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
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue