forked from TrueCloudLab/frostfs-node
[#11] services/container: Implement Neo:Morph executor and service
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
parent
9e30a87022
commit
8539f5c2cd
6 changed files with 458 additions and 3 deletions
41
cmd/neofs-node/container.go
Normal file
41
cmd/neofs-node/container.go
Normal file
|
@ -0,0 +1,41 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"github.com/nspcc-dev/neo-go/pkg/util"
|
||||
containerGRPC "github.com/nspcc-dev/neofs-api-go/v2/container/grpc"
|
||||
"github.com/nspcc-dev/neofs-api-go/v2/session"
|
||||
"github.com/nspcc-dev/neofs-node/pkg/morph/client"
|
||||
"github.com/nspcc-dev/neofs-node/pkg/morph/client/container"
|
||||
containerTransportGRPC "github.com/nspcc-dev/neofs-node/pkg/network/transport/container/grpc"
|
||||
containerService "github.com/nspcc-dev/neofs-node/pkg/services/container"
|
||||
containerMorph "github.com/nspcc-dev/neofs-node/pkg/services/container/morph"
|
||||
)
|
||||
|
||||
func initContainerService(c *cfg) {
|
||||
u160, err := util.Uint160DecodeStringLE(c.cfgContainer.scriptHash)
|
||||
fatalOnErr(err)
|
||||
|
||||
staticClient, err := client.NewStatic(c.cfgMorph.client, u160, c.cfgContainer.fee)
|
||||
fatalOnErr(err)
|
||||
|
||||
cnrClient, err := container.New(staticClient)
|
||||
fatalOnErr(err)
|
||||
|
||||
metaHdr := new(session.ResponseMetaHeader)
|
||||
xHdr := new(session.XHeader)
|
||||
xHdr.SetKey("test X-Header key")
|
||||
xHdr.SetValue("test X-Header value")
|
||||
metaHdr.SetXHeaders([]*session.XHeader{xHdr})
|
||||
|
||||
containerGRPC.RegisterContainerServiceServer(c.cfgGRPC.server,
|
||||
containerTransportGRPC.New(
|
||||
containerService.NewSignService(
|
||||
c.key,
|
||||
containerService.NewExecutionService(
|
||||
containerMorph.NewExecutor(cnrClient),
|
||||
metaHdr,
|
||||
),
|
||||
),
|
||||
),
|
||||
)
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue