forked from TrueCloudLab/frostfs-node
[#13] services/object: Implement Delete handlers
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
parent
7e91fffd39
commit
7a6b62c552
2 changed files with 25 additions and 4 deletions
|
@ -167,8 +167,17 @@ func (s *executorSvc) Search(ctx context.Context, req *object.SearchRequest) (ob
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (*executorSvc) Delete(context.Context, *object.DeleteRequest) (*object.DeleteResponse, error) {
|
func (s *executorSvc) Delete(ctx context.Context, req *object.DeleteRequest) (*object.DeleteResponse, error) {
|
||||||
panic("implement me")
|
respBody, err := s.exec.Delete(ctx, req.GetBody())
|
||||||
|
if err != nil {
|
||||||
|
return nil, errors.Wrap(err, "could not execute Delete request")
|
||||||
|
}
|
||||||
|
|
||||||
|
resp := new(object.DeleteResponse)
|
||||||
|
resp.SetBody(respBody)
|
||||||
|
resp.SetMetaHeader(s.metaHeader)
|
||||||
|
|
||||||
|
return resp, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *rangeStreamer) Recv() (*object.GetRangeResponse, error) {
|
func (s *rangeStreamer) Recv() (*object.GetRangeResponse, error) {
|
||||||
|
|
|
@ -18,6 +18,7 @@ type signService struct {
|
||||||
putService object.Service
|
putService object.Service
|
||||||
rangeSigService *util.UnarySignService
|
rangeSigService *util.UnarySignService
|
||||||
headSigService *util.UnarySignService
|
headSigService *util.UnarySignService
|
||||||
|
delSigService *util.UnarySignService
|
||||||
}
|
}
|
||||||
|
|
||||||
type searchStreamSigner struct {
|
type searchStreamSigner struct {
|
||||||
|
@ -72,6 +73,12 @@ func NewSignService(key *ecdsa.PrivateKey, svc object.Service) object.Service {
|
||||||
return svc.Head(ctx, req.(*object.HeadRequest))
|
return svc.Head(ctx, req.(*object.HeadRequest))
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
delSigService: util.NewUnarySignService(
|
||||||
|
key,
|
||||||
|
func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||||
|
return svc.Delete(ctx, req.(*object.DeleteRequest))
|
||||||
|
},
|
||||||
|
),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -167,8 +174,13 @@ func (s *signService) Search(ctx context.Context, req *object.SearchRequest) (ob
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *signService) Delete(context.Context, *object.DeleteRequest) (*object.DeleteResponse, error) {
|
func (s *signService) Delete(ctx context.Context, req *object.DeleteRequest) (*object.DeleteResponse, error) {
|
||||||
panic("implement me")
|
resp, err := s.delSigService.HandleUnaryRequest(ctx, req)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return resp.(*object.DeleteResponse), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *getRangeStreamSigner) Recv() (*object.GetRangeResponse, error) {
|
func (s *getRangeStreamSigner) Recv() (*object.GetRangeResponse, error) {
|
||||||
|
|
Loading…
Reference in a new issue