ceremonyclient/node/app/wire_gen.go

100 lines
3.8 KiB
Go
Raw Normal View History

2023-09-03 23:47:09 +00:00
// 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"
2023-09-25 02:43:35 +00:00
"source.quilibrium.com/quilibrium/monorepo/node/consensus/ceremony"
2023-09-03 23:47:09 +00:00
"source.quilibrium.com/quilibrium/monorepo/node/consensus/master"
2023-09-25 02:43:35 +00:00
ceremony2 "source.quilibrium.com/quilibrium/monorepo/node/execution/ceremony"
2023-09-03 23:47:09 +00:00
"source.quilibrium.com/quilibrium/monorepo/node/keys"
"source.quilibrium.com/quilibrium/monorepo/node/p2p"
2023-09-09 23:45:47 +00:00
"source.quilibrium.com/quilibrium/monorepo/node/store"
2023-09-03 23:47:09 +00:00
)
// Injectors from wire.go:
func NewNode(configConfig *config.Config) (*Node, error) {
zapLogger := logger()
2023-09-09 23:45:47 +00:00
dbConfig := configConfig.DB
db := store.NewPebbleDB(dbConfig)
pebbleClockStore := store.NewPebbleClockStore(db, zapLogger)
2023-09-03 23:47:09 +00:00
p2PConfig := configConfig.P2P
blossomSub := p2p.NewBlossomSub(p2PConfig, zapLogger)
engineConfig := configConfig.Engine
keyConfig := configConfig.Key
fileKeyManager := keys.NewFileKeyManager(keyConfig, zapLogger)
pebbleKeyStore := store.NewPebbleKeyStore(db, zapLogger)
2023-09-25 02:43:35 +00:00
ceremonyDataClockConsensusEngine := ceremony.NewCeremonyDataClockConsensusEngine(engineConfig, zapLogger, fileKeyManager, pebbleClockStore, pebbleKeyStore, blossomSub)
ceremonyExecutionEngine := ceremony2.NewCeremonyExecutionEngine(zapLogger, ceremonyDataClockConsensusEngine, engineConfig, fileKeyManager, blossomSub, pebbleClockStore, pebbleKeyStore)
2023-09-09 23:45:47 +00:00
masterClockConsensusEngine := master.NewMasterClockConsensusEngine(engineConfig, zapLogger, pebbleClockStore, fileKeyManager, blossomSub)
node, err := newNode(zapLogger, pebbleClockStore, blossomSub, ceremonyExecutionEngine, masterClockConsensusEngine)
2023-09-03 23:47:09 +00:00
if err != nil {
return nil, err
}
return node, nil
}
2023-09-09 23:45:47 +00:00
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)
2023-09-09 23:45:47 +00:00
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
}
2023-09-03 23:47:09 +00:00
// 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)))
2023-09-09 23:45:47 +00:00
2023-09-03 23:47:09 +00:00
var pubSubSet = wire.NewSet(wire.FieldsOf(new(*config.Config), "P2P"), p2p.NewBlossomSub, wire.Bind(new(p2p.PubSub), new(*p2p.BlossomSub)))
2023-09-25 02:43:35 +00:00
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)
2023-09-03 23:47:09 +00:00
2023-09-25 02:43:35 +00:00
var consensusSet = wire.NewSet(master.NewMasterClockConsensusEngine, wire.Bind(
2023-09-09 23:45:47 +00:00
new(consensus.ConsensusEngine),
new(*master.MasterClockConsensusEngine),
),
)