2020-08-24 14:07:08 +00:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
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"
|
2020-09-24 07:46:47 +00:00
|
|
|
"github.com/nspcc-dev/neofs-node/pkg/morph/client/container/wrapper"
|
2020-08-24 14:07:08 +00:00
|
|
|
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) {
|
2020-09-16 07:45:08 +00:00
|
|
|
staticClient, err := client.NewStatic(
|
|
|
|
c.cfgMorph.client,
|
|
|
|
c.cfgContainer.scriptHash,
|
|
|
|
c.cfgContainer.fee,
|
|
|
|
)
|
2020-08-24 14:07:08 +00:00
|
|
|
fatalOnErr(err)
|
|
|
|
|
|
|
|
cnrClient, err := container.New(staticClient)
|
|
|
|
fatalOnErr(err)
|
|
|
|
|
2020-09-24 07:46:47 +00:00
|
|
|
wrap, err := wrapper.New(cnrClient)
|
|
|
|
fatalOnErr(err)
|
|
|
|
|
|
|
|
c.cfgObject.cnrStorage = wrap // use RPC node as source of containers
|
2020-10-03 07:46:57 +00:00
|
|
|
c.cfgObject.cnrClient = wrap
|
2020-09-24 07:46:47 +00:00
|
|
|
|
2020-08-24 14:07:08 +00:00
|
|
|
containerGRPC.RegisterContainerServiceServer(c.cfgGRPC.server,
|
|
|
|
containerTransportGRPC.New(
|
|
|
|
containerService.NewSignService(
|
|
|
|
c.key,
|
2020-10-22 11:07:06 +00:00
|
|
|
containerService.NewResponseService(
|
|
|
|
containerService.NewExecutionService(
|
|
|
|
containerMorph.NewExecutor(cnrClient),
|
|
|
|
new(session.ResponseMetaHeader),
|
|
|
|
),
|
|
|
|
c.respSvc,
|
2020-08-24 14:07:08 +00:00
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
)
|
|
|
|
}
|