forked from TrueCloudLab/frostfs-node
[#13] neofs-node: Implement Object.GetRange executor
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
parent
652f64ae85
commit
3c773cfa67
1 changed files with 22 additions and 2 deletions
|
@ -23,6 +23,10 @@ type simpleGetBodyStreamer struct {
|
||||||
|
|
||||||
type simplePutBodyStreamer struct{}
|
type simplePutBodyStreamer struct{}
|
||||||
|
|
||||||
|
type simpleRangeBodyStreamer struct {
|
||||||
|
count int
|
||||||
|
}
|
||||||
|
|
||||||
type objectExecutor struct{}
|
type objectExecutor struct{}
|
||||||
|
|
||||||
func (s *simpleGetBodyStreamer) Recv() (*object.GetResponseBody, error) {
|
func (s *simpleGetBodyStreamer) Recv() (*object.GetResponseBody, error) {
|
||||||
|
@ -86,8 +90,24 @@ func (*objectExecutor) Delete(context.Context, *object.DeleteRequestBody) (*obje
|
||||||
panic("implement me")
|
panic("implement me")
|
||||||
}
|
}
|
||||||
|
|
||||||
func (*objectExecutor) GetRange(context.Context, *object.GetRangeRequestBody) (objectService.GetRangeObjectBodyStreamer, error) {
|
func (s *simpleRangeBodyStreamer) Recv() (*object.GetRangeResponseBody, error) {
|
||||||
panic("implement me")
|
body := new(object.GetRangeResponseBody)
|
||||||
|
|
||||||
|
if s.count == 0 {
|
||||||
|
body.SetChunk([]byte{1, 2, 2, 1})
|
||||||
|
} else if s.count == 1 {
|
||||||
|
body.SetChunk([]byte{4, 2, 4, 2})
|
||||||
|
} else {
|
||||||
|
return nil, io.EOF
|
||||||
|
}
|
||||||
|
|
||||||
|
s.count++
|
||||||
|
|
||||||
|
return body, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (*objectExecutor) GetRange(_ context.Context, body *object.GetRangeRequestBody) (objectService.GetRangeObjectBodyStreamer, error) {
|
||||||
|
return new(simpleRangeBodyStreamer), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (*objectExecutor) GetRangeHash(context.Context, *object.GetRangeHashRequestBody) (*object.GetRangeHashResponseBody, error) {
|
func (*objectExecutor) GetRangeHash(context.Context, *object.GetRangeHashRequestBody) (*object.GetRangeHashResponseBody, error) {
|
||||||
|
|
Loading…
Reference in a new issue