forked from TrueCloudLab/frostfs-node
Alex Vanin
20de74a505
Due to source code relocation from GitHub. Signed-off-by: Alex Vanin <a.vanin@yadro.com>
34 lines
1 KiB
Go
34 lines
1 KiB
Go
package main
|
|
|
|
import (
|
|
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"
|
|
)
|
|
|
|
func initAccountingService(c *cfg) {
|
|
if c.cfgMorph.client == nil {
|
|
initMorphComponents(c)
|
|
}
|
|
|
|
balanceMorphWrapper, err := balance.NewFromMorph(c.cfgMorph.client, c.cfgAccounting.scriptHash, 0)
|
|
fatalOnErr(err)
|
|
|
|
server := accountingTransportGRPC.New(
|
|
accountingService.NewSignService(
|
|
&c.key.PrivateKey,
|
|
accountingService.NewResponseService(
|
|
accountingService.NewExecutionService(
|
|
accounting.NewExecutor(balanceMorphWrapper),
|
|
),
|
|
c.respSvc,
|
|
),
|
|
),
|
|
)
|
|
|
|
for _, srv := range c.cfgGRPC.servers {
|
|
accountingGRPC.RegisterAccountingServiceServer(srv, server)
|
|
}
|
|
}
|