mirror of
https://source.quilibrium.com/quilibrium/ceremonyclient.git
synced 2024-11-14 04:05:17 +00:00
82 lines
2.6 KiB
Go
82 lines
2.6 KiB
Go
// Code generated by Wire. DO NOT EDIT.
|
|
|
|
//go:generate go run github.com/google/wire/cmd/wire
|
|
//go:build !wireinject
|
|
// +build !wireinject
|
|
|
|
package app
|
|
|
|
import (
|
|
"github.com/google/wire"
|
|
"go.uber.org/zap"
|
|
"source.quilibrium.com/quilibrium/monorepo/node/config"
|
|
"source.quilibrium.com/quilibrium/monorepo/node/consensus"
|
|
"source.quilibrium.com/quilibrium/monorepo/node/consensus/master"
|
|
"source.quilibrium.com/quilibrium/monorepo/node/execution/nop"
|
|
"source.quilibrium.com/quilibrium/monorepo/node/keys"
|
|
"source.quilibrium.com/quilibrium/monorepo/node/p2p"
|
|
"source.quilibrium.com/quilibrium/monorepo/node/store"
|
|
)
|
|
|
|
// Injectors from wire.go:
|
|
|
|
func NewNode(configConfig *config.Config) (*Node, error) {
|
|
zapLogger := logger()
|
|
nopExecutionEngine := nop.NewNopExecutionEngine(zapLogger)
|
|
engineConfig := configConfig.Engine
|
|
dbConfig := configConfig.DB
|
|
db := store.NewPebbleDB(dbConfig)
|
|
pebbleClockStore := store.NewPebbleClockStore(db, zapLogger)
|
|
keyConfig := configConfig.Key
|
|
fileKeyManager := keys.NewFileKeyManager(keyConfig, zapLogger)
|
|
p2PConfig := configConfig.P2P
|
|
blossomSub := p2p.NewBlossomSub(p2PConfig, zapLogger)
|
|
masterClockConsensusEngine := master.NewMasterClockConsensusEngine(engineConfig, zapLogger, pebbleClockStore, fileKeyManager, blossomSub)
|
|
node, err := newNode(nopExecutionEngine, masterClockConsensusEngine)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return node, nil
|
|
}
|
|
|
|
func NewDBConsole(configConfig *config.Config) (*DBConsole, error) {
|
|
dbConfig := configConfig.DB
|
|
db := store.NewPebbleDB(dbConfig)
|
|
zapLogger := logger()
|
|
pebbleClockStore := store.NewPebbleClockStore(db, zapLogger)
|
|
dbConsole, err := newDBConsole(pebbleClockStore)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return dbConsole, nil
|
|
}
|
|
|
|
// wire.go:
|
|
|
|
func logger() *zap.Logger {
|
|
log, err := zap.NewProduction()
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
|
|
return log
|
|
}
|
|
|
|
var loggerSet = wire.NewSet(
|
|
logger,
|
|
)
|
|
|
|
var keyManagerSet = wire.NewSet(wire.FieldsOf(new(*config.Config), "Key"), keys.NewFileKeyManager, wire.Bind(new(keys.KeyManager), new(*keys.FileKeyManager)))
|
|
|
|
var storeSet = wire.NewSet(wire.FieldsOf(new(*config.Config), "DB"), store.NewPebbleDB, store.NewPebbleClockStore, wire.Bind(new(store.ClockStore), new(*store.PebbleClockStore)))
|
|
|
|
var pubSubSet = wire.NewSet(wire.FieldsOf(new(*config.Config), "P2P"), p2p.NewBlossomSub, wire.Bind(new(p2p.PubSub), new(*p2p.BlossomSub)))
|
|
|
|
var engineSet = wire.NewSet(nop.NewNopExecutionEngine)
|
|
|
|
var consensusSet = wire.NewSet(wire.FieldsOf(new(*config.Config), "Engine"), master.NewMasterClockConsensusEngine, wire.Bind(
|
|
new(consensus.ConsensusEngine),
|
|
new(*master.MasterClockConsensusEngine),
|
|
),
|
|
)
|