2022-04-22 13:30:20 +00:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
|
|
|
|
"github.com/nspcc-dev/neofs-node/pkg/services/tree"
|
|
|
|
)
|
|
|
|
|
|
|
|
func initTreeService(c *cfg) {
|
|
|
|
treeSvc := tree.New(
|
|
|
|
tree.WithContainerSource(c.cfgObject.cnrSource),
|
|
|
|
tree.WithNetmapSource(c.netMapSource),
|
|
|
|
tree.WithPrivateKey(&c.key.PrivateKey),
|
|
|
|
tree.WithLogger(c.log),
|
|
|
|
tree.WithStorage(c.cfgObject.cfgLocalStorage.localStorage))
|
|
|
|
|
2022-05-06 11:58:36 +00:00
|
|
|
for _, srv := range c.cfgGRPC.servers {
|
|
|
|
tree.RegisterTreeServiceServer(srv, treeSvc)
|
|
|
|
}
|
2022-04-22 13:30:20 +00:00
|
|
|
|
|
|
|
c.workers = append(c.workers, newWorkerFromFunc(func(ctx context.Context) {
|
|
|
|
treeSvc.Start(ctx)
|
|
|
|
}))
|
2022-05-06 11:58:36 +00:00
|
|
|
|
|
|
|
c.onShutdown(treeSvc.Shutdown)
|
2022-04-22 13:30:20 +00:00
|
|
|
}
|