Cluster raft config changes
This commit is contained in:
parent
4be8861f41
commit
81c729e09c
@ -3,6 +3,7 @@ package node
|
|||||||
import (
|
import (
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
|
gorpc "github.com/libp2p/go-libp2p-gorpc"
|
||||||
"go.uber.org/fx"
|
"go.uber.org/fx"
|
||||||
"golang.org/x/xerrors"
|
"golang.org/x/xerrors"
|
||||||
|
|
||||||
@ -28,6 +29,7 @@ import (
|
|||||||
"github.com/filecoin-project/lotus/chain/wallet"
|
"github.com/filecoin-project/lotus/chain/wallet"
|
||||||
ledgerwallet "github.com/filecoin-project/lotus/chain/wallet/ledger"
|
ledgerwallet "github.com/filecoin-project/lotus/chain/wallet/ledger"
|
||||||
"github.com/filecoin-project/lotus/chain/wallet/remotewallet"
|
"github.com/filecoin-project/lotus/chain/wallet/remotewallet"
|
||||||
|
consensus2 "github.com/filecoin-project/lotus/lib/consensus/raft"
|
||||||
"github.com/filecoin-project/lotus/lib/peermgr"
|
"github.com/filecoin-project/lotus/lib/peermgr"
|
||||||
"github.com/filecoin-project/lotus/markets/storageadapter"
|
"github.com/filecoin-project/lotus/markets/storageadapter"
|
||||||
"github.com/filecoin-project/lotus/node/config"
|
"github.com/filecoin-project/lotus/node/config"
|
||||||
@ -237,6 +239,15 @@ func ConfigFullNode(c interface{}) Option {
|
|||||||
Unset(new(*wallet.LocalWallet)),
|
Unset(new(*wallet.LocalWallet)),
|
||||||
Override(new(wallet.Default), wallet.NilDefault),
|
Override(new(wallet.Default), wallet.NilDefault),
|
||||||
),
|
),
|
||||||
|
// Chain node cluster enabled
|
||||||
|
If(cfg.Raft.ClusterModeEnabled,
|
||||||
|
Override(new(*gorpc.Client), modules.NewRPCClient),
|
||||||
|
Override(new(*consensus.Consensus), consensus2.NewConsensusWithRPCClient(false)),
|
||||||
|
Override(new(*messagesigner.MessageSignerConsensus), messagesigner.NewMessageSignerConsensus),
|
||||||
|
Override(new(messagesigner.MsgSigner), func(ms *messagesigner.MessageSignerConsensus) *messagesigner.MessageSignerConsensus { return ms }),
|
||||||
|
Override(new(*modules.RPCHandler), modules.NewRPCHandler),
|
||||||
|
Override(RPCServer, modules.NewRPCServer),
|
||||||
|
),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -118,6 +118,12 @@ of automatically performing on-chain operations.`,
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
"ClusterRaftConfig": []DocField{
|
"ClusterRaftConfig": []DocField{
|
||||||
|
{
|
||||||
|
Num: "ClusterModeEnabled",
|
||||||
|
Type: "bool",
|
||||||
|
|
||||||
|
Comment: `config to enabled node cluster with raft consensus`,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
Num: "HostShutdown",
|
Num: "HostShutdown",
|
||||||
Type: "bool",
|
Type: "bool",
|
||||||
|
@ -598,6 +598,8 @@ type FeeConfig struct {
|
|||||||
|
|
||||||
// ClusterRaftConfig allows to configure the Raft Consensus component for the node cluster.
|
// ClusterRaftConfig allows to configure the Raft Consensus component for the node cluster.
|
||||||
type ClusterRaftConfig struct {
|
type ClusterRaftConfig struct {
|
||||||
|
// config to enabled node cluster with raft consensus
|
||||||
|
ClusterModeEnabled bool
|
||||||
// will shutdown libp2p host on shutdown. Useful for testing
|
// will shutdown libp2p host on shutdown. Useful for testing
|
||||||
HostShutdown bool
|
HostShutdown bool
|
||||||
// A folder to store Raft's data.
|
// A folder to store Raft's data.
|
||||||
|
Loading…
Reference in New Issue
Block a user