forked from TrueCloudLab/frostfs-node
a4adb79db7
Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
32 lines
811 B
Go
32 lines
811 B
Go
package main
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/nspcc-dev/neofs-node/cmd/neofs-node/config"
|
|
"github.com/nspcc-dev/neofs-node/pkg/services/tree"
|
|
)
|
|
|
|
func initTreeService(c *cfg) {
|
|
if !config.BoolSafe(c.appCfg.Sub("tree"), "enabled") {
|
|
c.log.Info("tree service is not enabled, skip initialization")
|
|
return
|
|
}
|
|
|
|
c.treeService = 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))
|
|
|
|
for _, srv := range c.cfgGRPC.servers {
|
|
tree.RegisterTreeServiceServer(srv, c.treeService)
|
|
}
|
|
|
|
c.workers = append(c.workers, newWorkerFromFunc(func(ctx context.Context) {
|
|
c.treeService.Start(ctx)
|
|
}))
|
|
|
|
c.onShutdown(c.treeService.Shutdown)
|
|
}
|