forked from TrueCloudLab/frostfs-node
[#13] neofs-node: Implement Object.Put executor
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
parent
62d0c50b15
commit
d90f53d311
1 changed files with 22 additions and 5 deletions
|
@ -2,6 +2,7 @@ package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
|
|
||||||
"github.com/nspcc-dev/neofs-api-go/v2/object"
|
"github.com/nspcc-dev/neofs-api-go/v2/object"
|
||||||
|
@ -20,9 +21,9 @@ type simpleGetBodyStreamer struct {
|
||||||
count int
|
count int
|
||||||
}
|
}
|
||||||
|
|
||||||
type objectExecutor struct {
|
type simplePutBodyStreamer struct{}
|
||||||
count int
|
|
||||||
}
|
type objectExecutor struct{}
|
||||||
|
|
||||||
func (s *simpleGetBodyStreamer) Recv() (*object.GetResponseBody, error) {
|
func (s *simpleGetBodyStreamer) Recv() (*object.GetResponseBody, error) {
|
||||||
body := new(object.GetResponseBody)
|
body := new(object.GetResponseBody)
|
||||||
|
@ -53,8 +54,24 @@ func (*objectExecutor) Get(context.Context, *object.GetRequestBody) (objectServi
|
||||||
return new(simpleGetBodyStreamer), nil
|
return new(simpleGetBodyStreamer), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (*objectExecutor) Put(context.Context) (object.PutObjectStreamer, error) {
|
func (s *simplePutBodyStreamer) Send(body *object.PutRequestBody) error {
|
||||||
panic("implement me")
|
fmt.Printf("object part received %T\n", body.GetObjectPart())
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *simplePutBodyStreamer) CloseAndRecv() (*object.PutResponseBody, error) {
|
||||||
|
body := new(object.PutResponseBody)
|
||||||
|
oid := new(refs.ObjectID)
|
||||||
|
|
||||||
|
body.SetObjectID(oid)
|
||||||
|
|
||||||
|
oid.SetValue([]byte{6, 7, 8})
|
||||||
|
|
||||||
|
return body, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (*objectExecutor) Put(context.Context) (objectService.PutObjectBodyStreamer, error) {
|
||||||
|
return new(simplePutBodyStreamer), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (*objectExecutor) Head(context.Context, *object.HeadRequestBody) (*object.HeadResponseBody, error) {
|
func (*objectExecutor) Head(context.Context, *object.HeadRequestBody) (*object.HeadResponseBody, error) {
|
||||||
|
|
Loading…
Reference in a new issue