mirror of
https://source.quilibrium.com/quilibrium/ceremonyclient.git
synced 2024-12-27 00:55:17 +00:00
100 lines
3.8 KiB
Go
100 lines
3.8 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/ceremony"
|
|
"source.quilibrium.com/quilibrium/monorepo/node/consensus/master"
|
|
ceremony2 "source.quilibrium.com/quilibrium/monorepo/node/execution/ceremony"
|
|
"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()
|
|
dbConfig := configConfig.DB
|
|
db := store.NewPebbleDB(dbConfig)
|
|
pebbleClockStore := store.NewPebbleClockStore(db, zapLogger)
|
|
p2PConfig := configConfig.P2P
|
|
blossomSub := p2p.NewBlossomSub(p2PConfig, zapLogger)
|
|
engineConfig := configConfig.Engine
|
|
keyConfig := configConfig.Key
|
|
fileKeyManager := keys.NewFileKeyManager(keyConfig, zapLogger)
|
|
pebbleKeyStore := store.NewPebbleKeyStore(db, zapLogger)
|
|
ceremonyDataClockConsensusEngine := ceremony.NewCeremonyDataClockConsensusEngine(engineConfig, zapLogger, fileKeyManager, pebbleClockStore, pebbleKeyStore, blossomSub)
|
|
ceremonyExecutionEngine := ceremony2.NewCeremonyExecutionEngine(zapLogger, ceremonyDataClockConsensusEngine, engineConfig, fileKeyManager, blossomSub, pebbleClockStore, pebbleKeyStore)
|
|
masterClockConsensusEngine := master.NewMasterClockConsensusEngine(engineConfig, zapLogger, pebbleClockStore, fileKeyManager, blossomSub)
|
|
node, err := newNode(zapLogger, pebbleClockStore, blossomSub, ceremonyExecutionEngine, 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)
|
|
pebbleDataProofStore := store.NewPebbleDataProofStore(db, zapLogger)
|
|
dbConsole, err := newDBConsole(pebbleClockStore, pebbleDataProofStore)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return dbConsole, nil
|
|
}
|
|
|
|
func NewClockStore(configConfig *config.Config) (store.ClockStore, error) {
|
|
dbConfig := configConfig.DB
|
|
db := store.NewPebbleDB(dbConfig)
|
|
zapLogger := logger()
|
|
pebbleClockStore := store.NewPebbleClockStore(db, zapLogger)
|
|
return pebbleClockStore, 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, store.NewPebbleKeyStore, store.NewPebbleDataProofStore, wire.Bind(new(store.ClockStore), new(*store.PebbleClockStore)), wire.Bind(new(store.KeyStore), new(*store.PebbleKeyStore)), wire.Bind(new(store.DataProofStore), new(*store.PebbleDataProofStore)))
|
|
|
|
var pubSubSet = wire.NewSet(wire.FieldsOf(new(*config.Config), "P2P"), p2p.NewBlossomSub, wire.Bind(new(p2p.PubSub), new(*p2p.BlossomSub)))
|
|
|
|
var dataConsensusSet = wire.NewSet(wire.FieldsOf(new(*config.Config), "Engine"), ceremony.NewCeremonyDataClockConsensusEngine, wire.Bind(
|
|
new(consensus.DataConsensusEngine),
|
|
new(*ceremony.CeremonyDataClockConsensusEngine),
|
|
),
|
|
)
|
|
|
|
var engineSet = wire.NewSet(ceremony2.NewCeremonyExecutionEngine)
|
|
|
|
var consensusSet = wire.NewSet(master.NewMasterClockConsensusEngine, wire.Bind(
|
|
new(consensus.ConsensusEngine),
|
|
new(*master.MasterClockConsensusEngine),
|
|
),
|
|
)
|