Documentation ¶
Index ¶
- Constants
- Variables
- type AergoRaftTransport
- func (t *AergoRaftTransport) ActivePeers() int
- func (t *AergoRaftTransport) ActiveSince(id rtypes.ID) time.Time
- func (t *AergoRaftTransport) AddPeer(id rtypes.ID, peerID types.PeerID, urls []string)
- func (t *AergoRaftTransport) AddRemote(id rtypes.ID, urls []string)
- func (t *AergoRaftTransport) Handler() http.Handler
- func (t *AergoRaftTransport) NewSnapshotReceiver(peer p2pcommon.RemotePeer, rwc io.ReadWriteCloser) SnapshotReceiver
- func (t *AergoRaftTransport) NewSnapshotSender(peer p2pcommon.RemotePeer) SnapshotSender
- func (t *AergoRaftTransport) OnPeerConnect(pid types.PeerID)
- func (t *AergoRaftTransport) OnPeerDisconnect(peer p2pcommon.RemotePeer)
- func (t *AergoRaftTransport) OnRaftSnapshot(s network.Stream)
- func (t *AergoRaftTransport) RemoveAllPeers()
- func (t *AergoRaftTransport) RemovePeer(id rtypes.ID)
- func (t *AergoRaftTransport) Send(msgs []raftpb.Message)
- func (t *AergoRaftTransport) SendSnapshot(m snap.Message)
- func (t *AergoRaftTransport) Start() error
- func (t *AergoRaftTransport) Stop()
- func (t *AergoRaftTransport) UpdatePeer(id rtypes.ID, urls []string)
- type ClusterInfoReceiver
- type ConcurrentClusterInfoReceiver
- type RaftMsgDecoder
- type RaftMsgEncoder
- type RaftMsgMarshaller
- type SnapshotIOFactory
- type SnapshotReceiver
- type SnapshotSender
Constants ¶
const (
SnapRespHeaderLength = 4
)
Variables ¶
var (
ErrExceedSizeLimit = errors.New("raftsupport: error limit exceeded")
)
Functions ¶
This section is empty.
Types ¶
type AergoRaftTransport ¶
type AergoRaftTransport struct { // copied from original transport ServerStats *stats.ServerStats LeaderStats *stats.LeaderStats // contains filtered or unexported fields }
AergoRaftTransport is wrapper of p2p module
func NewAergoRaftTransport ¶
func NewAergoRaftTransport(logger *log.Logger, nt p2pcommon.NetworkTransport, pm p2pcommon.PeerManager, mf p2pcommon.MoFactory, consAcc consensus.ConsensusAccessor, cluster interface{}) *AergoRaftTransport
func (*AergoRaftTransport) ActivePeers ¶
func (t *AergoRaftTransport) ActivePeers() int
func (*AergoRaftTransport) ActiveSince ¶
func (t *AergoRaftTransport) ActiveSince(id rtypes.ID) time.Time
func (*AergoRaftTransport) AddRemote ¶
func (t *AergoRaftTransport) AddRemote(id rtypes.ID, urls []string)
func (*AergoRaftTransport) Handler ¶
func (t *AergoRaftTransport) Handler() http.Handler
func (*AergoRaftTransport) NewSnapshotReceiver ¶
func (t *AergoRaftTransport) NewSnapshotReceiver(peer p2pcommon.RemotePeer, rwc io.ReadWriteCloser) SnapshotReceiver
func (*AergoRaftTransport) NewSnapshotSender ¶
func (t *AergoRaftTransport) NewSnapshotSender(peer p2pcommon.RemotePeer) SnapshotSender
func (*AergoRaftTransport) OnPeerConnect ¶
func (t *AergoRaftTransport) OnPeerConnect(pid types.PeerID)
func (*AergoRaftTransport) OnPeerDisconnect ¶
func (t *AergoRaftTransport) OnPeerDisconnect(peer p2pcommon.RemotePeer)
func (*AergoRaftTransport) OnRaftSnapshot ¶
func (t *AergoRaftTransport) OnRaftSnapshot(s network.Stream)
func (*AergoRaftTransport) RemoveAllPeers ¶
func (t *AergoRaftTransport) RemoveAllPeers()
func (*AergoRaftTransport) RemovePeer ¶
func (t *AergoRaftTransport) RemovePeer(id rtypes.ID)
func (*AergoRaftTransport) Send ¶
func (t *AergoRaftTransport) Send(msgs []raftpb.Message)
Send must send message to target peer or report unreachable if sending peer is failed.
func (*AergoRaftTransport) SendSnapshot ¶
func (t *AergoRaftTransport) SendSnapshot(m snap.Message)
func (*AergoRaftTransport) Start ¶
func (t *AergoRaftTransport) Start() error
func (*AergoRaftTransport) Stop ¶
func (t *AergoRaftTransport) Stop()
func (*AergoRaftTransport) UpdatePeer ¶
func (t *AergoRaftTransport) UpdatePeer(id rtypes.ID, urls []string)
type ClusterInfoReceiver ¶
type ClusterInfoReceiver struct {
// contains filtered or unexported fields
}
ClusterInfoReceiver is send p2p getClusterInfo to connected peers and Receive p2p responses one of peers return successful response The first version will be simplified version. it send and Receive one by one.
func NewClusterInfoReceiver ¶
func NewClusterInfoReceiver(actor p2pcommon.ActorService, mf p2pcommon.MoFactory, peers []p2pcommon.RemotePeer, ttl time.Duration, req *message.GetCluster) *ClusterInfoReceiver
func (*ClusterInfoReceiver) ReceiveResp ¶
func (br *ClusterInfoReceiver) ReceiveResp(msg p2pcommon.Message, msgBody p2pcommon.MessageBody) (ret bool)
ReceiveResp must be called just in read go routine
func (*ClusterInfoReceiver) StartGet ¶
func (br *ClusterInfoReceiver) StartGet()
type ConcurrentClusterInfoReceiver ¶
type ConcurrentClusterInfoReceiver struct {
// contains filtered or unexported fields
}
ClusterInfoReceiver is send p2p getClusterInfo to connected peers and Receive p2p responses one of peers return successful response The first version will be simplified version. it send and Receive one by one.
func NewConcClusterInfoReceiver ¶
func NewConcClusterInfoReceiver(actor p2pcommon.ActorService, mf p2pcommon.MoFactory, peers []p2pcommon.RemotePeer, ttl time.Duration, req *message.GetCluster, logger *log.Logger) *ConcurrentClusterInfoReceiver
func (*ConcurrentClusterInfoReceiver) ReceiveResp ¶
func (r *ConcurrentClusterInfoReceiver) ReceiveResp(msg p2pcommon.Message, msgBody p2pcommon.MessageBody) (ret bool)
ReceiveResp must be called just in read go routine
func (*ConcurrentClusterInfoReceiver) StartGet ¶
func (r *ConcurrentClusterInfoReceiver) StartGet()
type RaftMsgDecoder ¶
type RaftMsgDecoder struct {
// contains filtered or unexported fields
}
func (*RaftMsgDecoder) DecodeLimit ¶
func (dec *RaftMsgDecoder) DecodeLimit(numBytes uint64) (raftpb.Message, error)
type RaftMsgEncoder ¶
type RaftMsgEncoder struct {
// contains filtered or unexported fields
}
RaftMsgEncoder is encode raftpb.Message itt result will be same as rafthttp.messageEncoder
type RaftMsgMarshaller ¶
func (RaftMsgMarshaller) MarshalZerologObject ¶
func (m RaftMsgMarshaller) MarshalZerologObject(e *zerolog.Event)
type SnapshotIOFactory ¶
type SnapshotIOFactory interface { NewSnapshotSender(peer p2pcommon.RemotePeer) SnapshotSender NewSnapshotReceiver(peer p2pcommon.RemotePeer, rwc io.ReadWriteCloser) SnapshotReceiver }
SnapshotIOFactory create SnapshotSender or SnapshotReceiver for a peer
type SnapshotReceiver ¶
type SnapshotReceiver interface {
Receive()
}