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 (
|
||||
"context"
|
||||
"fmt"
|
||||
"io"
|
||||
|
||||
"github.com/nspcc-dev/neofs-api-go/v2/object"
|
||||
|
@ -20,9 +21,9 @@ type simpleGetBodyStreamer struct {
|
|||
count int
|
||||
}
|
||||
|
||||
type objectExecutor struct {
|
||||
count int
|
||||
}
|
||||
type simplePutBodyStreamer struct{}
|
||||
|
||||
type objectExecutor struct{}
|
||||
|
||||
func (s *simpleGetBodyStreamer) Recv() (*object.GetResponseBody, error) {
|
||||
body := new(object.GetResponseBody)
|
||||
|
@ -53,8 +54,24 @@ func (*objectExecutor) Get(context.Context, *object.GetRequestBody) (objectServi
|
|||
return new(simpleGetBodyStreamer), nil
|
||||
}
|
||||
|
||||
func (*objectExecutor) Put(context.Context) (object.PutObjectStreamer, error) {
|
||||
panic("implement me")
|
||||
func (s *simplePutBodyStreamer) Send(body *object.PutRequestBody) error {
|
||||
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) {
|
||||
|
|
Loading…
Reference in a new issue