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
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (*executorSvc) GetRangeHash(context.Context, *object.GetRangeHashRequest) (*object.GetRangeHashResponse, error) {
|
func (s *executorSvc) GetRangeHash(ctx context.Context, req *object.GetRangeHashRequest) (*object.GetRangeHashResponse, error) {
|
||||||
panic("implement me")
|
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
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,12 +13,13 @@ import (
|
||||||
type signService struct {
|
type signService struct {
|
||||||
key *ecdsa.PrivateKey
|
key *ecdsa.PrivateKey
|
||||||
|
|
||||||
searchSigService *util.UnarySignService
|
searchSigService *util.UnarySignService
|
||||||
getSigService *util.UnarySignService
|
getSigService *util.UnarySignService
|
||||||
putService object.Service
|
putService object.Service
|
||||||
rangeSigService *util.UnarySignService
|
rangeSigService *util.UnarySignService
|
||||||
headSigService *util.UnarySignService
|
headSigService *util.UnarySignService
|
||||||
delSigService *util.UnarySignService
|
delSigService *util.UnarySignService
|
||||||
|
rangeHashSigService *util.UnarySignService
|
||||||
}
|
}
|
||||||
|
|
||||||
type searchStreamSigner struct {
|
type searchStreamSigner struct {
|
||||||
|
@ -79,6 +80,12 @@ func NewSignService(key *ecdsa.PrivateKey, svc object.Service) object.Service {
|
||||||
return svc.Delete(ctx, req.(*object.DeleteRequest))
|
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
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *signService) GetRangeHash(context.Context, *object.GetRangeHashRequest) (*object.GetRangeHashResponse, error) {
|
func (s *signService) GetRangeHash(ctx context.Context, req *object.GetRangeHashRequest) (*object.GetRangeHashResponse, error) {
|
||||||
panic("implement me")
|
resp, err := s.rangeHashSigService.HandleUnaryRequest(ctx, req)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return resp.(*object.GetRangeHashResponse), nil
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue