forked from TrueCloudLab/frostfs-node
[#13] services/object: Implement GetRangeHash handlers
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
parent
7765671502
commit
0c83e84613
2 changed files with 31 additions and 10 deletions
|
@ -205,6 +205,15 @@ func (s *executorSvc) GetRange(ctx context.Context, req *object.GetRangeRequest)
|
|||
}, nil
|
||||
}
|
||||
|
||||
func (*executorSvc) GetRangeHash(context.Context, *object.GetRangeHashRequest) (*object.GetRangeHashResponse, error) {
|
||||
panic("implement me")
|
||||
func (s *executorSvc) GetRangeHash(ctx context.Context, req *object.GetRangeHashRequest) (*object.GetRangeHashResponse, error) {
|
||||
respBody, err := s.exec.GetRangeHash(ctx, req.GetBody())
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "could not execute GetRangeHash request")
|
||||
}
|
||||
|
||||
resp := new(object.GetRangeHashResponse)
|
||||
resp.SetBody(respBody)
|
||||
resp.SetMetaHeader(s.metaHeader)
|
||||
|
||||
return resp, nil
|
||||
}
|
||||
|
|
|
@ -19,6 +19,7 @@ type signService struct {
|
|||
rangeSigService *util.UnarySignService
|
||||
headSigService *util.UnarySignService
|
||||
delSigService *util.UnarySignService
|
||||
rangeHashSigService *util.UnarySignService
|
||||
}
|
||||
|
||||
type searchStreamSigner struct {
|
||||
|
@ -79,6 +80,12 @@ func NewSignService(key *ecdsa.PrivateKey, svc object.Service) object.Service {
|
|||
return svc.Delete(ctx, req.(*object.DeleteRequest))
|
||||
},
|
||||
),
|
||||
rangeHashSigService: util.NewUnarySignService(
|
||||
key,
|
||||
func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return svc.GetRangeHash(ctx, req.(*object.GetRangeHashRequest))
|
||||
},
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -208,6 +215,11 @@ func (s *signService) GetRange(ctx context.Context, req *object.GetRangeRequest)
|
|||
}, nil
|
||||
}
|
||||
|
||||
func (s *signService) GetRangeHash(context.Context, *object.GetRangeHashRequest) (*object.GetRangeHashResponse, error) {
|
||||
panic("implement me")
|
||||
func (s *signService) GetRangeHash(ctx context.Context, req *object.GetRangeHashRequest) (*object.GetRangeHashResponse, error) {
|
||||
resp, err := s.rangeHashSigService.HandleUnaryRequest(ctx, req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return resp.(*object.GetRangeHashResponse), nil
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue