2020-08-25 13:37:10 +00:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
2020-08-25 14:44:41 +00:00
|
|
|
"context"
|
2020-09-23 13:28:42 +00:00
|
|
|
"errors"
|
2020-08-25 14:44:41 +00:00
|
|
|
|
|
|
|
"github.com/nspcc-dev/neofs-api-go/v2/object"
|
2020-08-25 13:37:10 +00:00
|
|
|
objectGRPC "github.com/nspcc-dev/neofs-api-go/v2/object/grpc"
|
2020-08-25 14:44:41 +00:00
|
|
|
"github.com/nspcc-dev/neofs-api-go/v2/session"
|
2020-08-25 13:37:10 +00:00
|
|
|
objectTransportGRPC "github.com/nspcc-dev/neofs-node/pkg/network/transport/object/grpc"
|
|
|
|
objectService "github.com/nspcc-dev/neofs-node/pkg/services/object"
|
|
|
|
)
|
|
|
|
|
2020-08-25 15:45:36 +00:00
|
|
|
type objectExecutor struct{}
|
2020-08-25 14:44:41 +00:00
|
|
|
|
|
|
|
func (*objectExecutor) Get(context.Context, *object.GetRequestBody) (objectService.GetObjectBodyStreamer, error) {
|
2020-09-23 13:28:42 +00:00
|
|
|
return nil, errors.New("unimplemented service call")
|
2020-08-25 15:45:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (*objectExecutor) Put(context.Context) (objectService.PutObjectBodyStreamer, error) {
|
2020-09-23 13:28:42 +00:00
|
|
|
return nil, errors.New("unimplemented service call")
|
2020-08-25 14:44:41 +00:00
|
|
|
}
|
|
|
|
|
2020-09-23 13:28:42 +00:00
|
|
|
func (*objectExecutor) Head(context.Context, *object.HeadRequestBody) (*object.HeadResponseBody, error) {
|
|
|
|
return nil, errors.New("unimplemented service call")
|
2020-08-25 14:44:41 +00:00
|
|
|
}
|
|
|
|
|
2020-09-23 13:28:42 +00:00
|
|
|
func (s *objectExecutor) Search(context.Context, *object.SearchRequestBody) (objectService.SearchObjectBodyStreamer, error) {
|
|
|
|
return nil, errors.New("unimplemented service call")
|
2020-08-25 14:44:41 +00:00
|
|
|
}
|
|
|
|
|
2020-08-25 16:12:54 +00:00
|
|
|
func (*objectExecutor) Delete(_ context.Context, body *object.DeleteRequestBody) (*object.DeleteResponseBody, error) {
|
2020-09-23 13:28:42 +00:00
|
|
|
return nil, errors.New("unimplemented service call")
|
2020-08-25 15:58:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (*objectExecutor) GetRange(_ context.Context, body *object.GetRangeRequestBody) (objectService.GetRangeObjectBodyStreamer, error) {
|
2020-09-23 13:28:42 +00:00
|
|
|
return nil, errors.New("unimplemented service call")
|
2020-08-25 14:44:41 +00:00
|
|
|
}
|
|
|
|
|
2020-09-23 13:28:42 +00:00
|
|
|
func (*objectExecutor) GetRangeHash(context.Context, *object.GetRangeHashRequestBody) (*object.GetRangeHashResponseBody, error) {
|
|
|
|
return nil, errors.New("unimplemented service call")
|
2020-08-25 14:44:41 +00:00
|
|
|
}
|
|
|
|
|
2020-08-25 13:37:10 +00:00
|
|
|
func initObjectService(c *cfg) {
|
2020-08-25 14:44:41 +00:00
|
|
|
metaHdr := new(session.ResponseMetaHeader)
|
|
|
|
xHdr := new(session.XHeader)
|
|
|
|
xHdr.SetKey("test X-Header key for Object service")
|
|
|
|
xHdr.SetValue("test X-Header value for Object service")
|
|
|
|
metaHdr.SetXHeaders([]*session.XHeader{xHdr})
|
|
|
|
|
2020-08-25 13:37:10 +00:00
|
|
|
objectGRPC.RegisterObjectServiceServer(c.cfgGRPC.server,
|
|
|
|
objectTransportGRPC.New(
|
|
|
|
objectService.NewSignService(
|
|
|
|
c.key,
|
2020-08-25 14:44:41 +00:00
|
|
|
objectService.NewExecutionService(
|
|
|
|
new(objectExecutor),
|
|
|
|
metaHdr,
|
|
|
|
),
|
2020-08-25 13:37:10 +00:00
|
|
|
),
|
|
|
|
),
|
|
|
|
)
|
|
|
|
}
|