misc: Drop the raft-cluster experiment
This commit is contained in:
@@ -34,7 +34,6 @@ type FullNodeAPI struct {
|
||||
full.MsigAPI
|
||||
full.WalletAPI
|
||||
full.SyncAPI
|
||||
full.RaftAPI
|
||||
full.EthAPI
|
||||
|
||||
DS dtypes.MetadataDS
|
||||
@@ -119,12 +118,4 @@ func (n *FullNodeAPI) NodeStatus(ctx context.Context, inclChainStatus bool) (sta
|
||||
return status, nil
|
||||
}
|
||||
|
||||
func (n *FullNodeAPI) RaftState(ctx context.Context) (*api.RaftStateData, error) {
|
||||
return n.RaftAPI.GetRaftState(ctx)
|
||||
}
|
||||
|
||||
func (n *FullNodeAPI) RaftLeader(ctx context.Context) (peer.ID, error) {
|
||||
return n.RaftAPI.Leader(ctx)
|
||||
}
|
||||
|
||||
var _ api.FullNode = &FullNodeAPI{}
|
||||
|
||||
@@ -44,8 +44,6 @@ type MpoolAPI struct {
|
||||
WalletAPI
|
||||
GasAPI
|
||||
|
||||
RaftAPI
|
||||
|
||||
MessageSigner messagesigner.MsgSigner
|
||||
|
||||
PushLocks *dtypes.MpoolLocker
|
||||
@@ -145,20 +143,6 @@ func (a *MpoolAPI) MpoolPushMessage(ctx context.Context, msg *types.Message, spe
|
||||
msg = &cp
|
||||
inMsg := *msg
|
||||
|
||||
// Redirect to leader if current node is not leader. A single non raft based node is always the leader
|
||||
if !a.RaftAPI.IsLeader(ctx) {
|
||||
var signedMsg types.SignedMessage
|
||||
redirected, err := a.RaftAPI.RedirectToLeader(ctx, "MpoolPushMessage", api.MpoolMessageWhole{Msg: msg, Spec: spec}, &signedMsg)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
// It's possible that the current node became the leader between the check and the redirect
|
||||
// In that case, continue with rest of execution and only return signedMsg if something was redirected
|
||||
if redirected {
|
||||
return &signedMsg, nil
|
||||
}
|
||||
}
|
||||
|
||||
// Generate spec and uuid if not available in the message
|
||||
if spec == nil {
|
||||
spec = &api.MessageSendSpec{
|
||||
|
||||
@@ -1,50 +0,0 @@
|
||||
package full
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/libp2p/go-libp2p/core/peer"
|
||||
"go.uber.org/fx"
|
||||
"golang.org/x/xerrors"
|
||||
|
||||
"github.com/filecoin-project/lotus/api"
|
||||
"github.com/filecoin-project/lotus/chain/messagesigner"
|
||||
)
|
||||
|
||||
type RaftAPI struct {
|
||||
fx.In
|
||||
|
||||
MessageSigner *messagesigner.MessageSignerConsensus `optional:"true"`
|
||||
}
|
||||
|
||||
func (r *RaftAPI) GetRaftState(ctx context.Context) (*api.RaftStateData, error) {
|
||||
if r.MessageSigner == nil {
|
||||
return nil, xerrors.Errorf("raft consensus not enabled. Please check your configuration")
|
||||
}
|
||||
raftState, err := r.MessageSigner.GetRaftState(ctx)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &api.RaftStateData{NonceMap: raftState.NonceMap, MsgUuids: raftState.MsgUuids}, nil
|
||||
}
|
||||
|
||||
func (r *RaftAPI) Leader(ctx context.Context) (peer.ID, error) {
|
||||
if r.MessageSigner == nil {
|
||||
return "", xerrors.Errorf("raft consensus not enabled. Please check your configuration")
|
||||
}
|
||||
return r.MessageSigner.Leader(ctx)
|
||||
}
|
||||
|
||||
func (r *RaftAPI) IsLeader(ctx context.Context) bool {
|
||||
if r.MessageSigner == nil {
|
||||
return true
|
||||
}
|
||||
return r.MessageSigner.IsLeader(ctx)
|
||||
}
|
||||
|
||||
func (r *RaftAPI) RedirectToLeader(ctx context.Context, method string, arg interface{}, ret interface{}) (bool, error) {
|
||||
if r.MessageSigner == nil {
|
||||
return false, xerrors.Errorf("raft consensus not enabled. Please check your configuration")
|
||||
}
|
||||
return r.MessageSigner.RedirectToLeader(ctx, method, arg, ret)
|
||||
}
|
||||
Reference in New Issue
Block a user