forked from TrueCloudLab/frostfs-node
Dmitrii Stepanov
e515dd4582
It could be called for every shard on metabase resync concurrently and it is possible to get state with initialized client but not initialized contract hashes. Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
34 lines
1 KiB
Go
34 lines
1 KiB
Go
package main
|
|
|
|
import (
|
|
"context"
|
|
"net"
|
|
|
|
accountingGRPC "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/accounting/grpc"
|
|
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/morph/client/balance"
|
|
accountingTransportGRPC "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/network/transport/accounting/grpc"
|
|
accountingService "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/services/accounting"
|
|
accounting "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/services/accounting/morph"
|
|
"google.golang.org/grpc"
|
|
)
|
|
|
|
func initAccountingService(ctx context.Context, c *cfg) {
|
|
c.initMorphComponents(ctx)
|
|
|
|
balanceMorphWrapper, err := balance.NewFromMorph(c.cfgMorph.client, c.cfgAccounting.scriptHash, 0)
|
|
fatalOnErr(err)
|
|
|
|
server := accountingTransportGRPC.New(
|
|
accountingService.NewSignService(
|
|
&c.key.PrivateKey,
|
|
accountingService.NewExecutionService(
|
|
accounting.NewExecutor(balanceMorphWrapper),
|
|
c.respSvc,
|
|
),
|
|
),
|
|
)
|
|
|
|
c.cfgGRPC.performAndSave(func(_ string, _ net.Listener, s *grpc.Server) {
|
|
accountingGRPC.RegisterAccountingServiceServer(s, server)
|
|
})
|
|
}
|