Documentation ¶
Index ¶
- Constants
- Variables
- type ClusterInfoReceiver
- type ConcurrentClusterInfoReceiver
- type MeyCoinRaftTransport
- func (t *MeyCoinRaftTransport) ActivePeers() int
- func (t *MeyCoinRaftTransport) ActiveSince(id rtypes.ID) time.Time
- func (t *MeyCoinRaftTransport) AddPeer(id rtypes.ID, peerID types.PeerID, urls []string)
- func (t *MeyCoinRaftTransport) AddRemote(id rtypes.ID, urls []string)
- func (t *MeyCoinRaftTransport) Handler() http.Handler
- func (t *MeyCoinRaftTransport) NewSnapshotReceiver(peer p2pcommon.RemotePeer, rwc io.ReadWriteCloser) SnapshotReceiver
- func (t *MeyCoinRaftTransport) NewSnapshotSender(peer p2pcommon.RemotePeer) SnapshotSender
- func (t *MeyCoinRaftTransport) OnPeerConnect(pid types.PeerID)
- func (t *MeyCoinRaftTransport) OnPeerDisconnect(peer p2pcommon.RemotePeer)
- func (t *MeyCoinRaftTransport) OnRaftSnapshot(s network.Stream)
- func (t *MeyCoinRaftTransport) RemoveAllPeers()
- func (t *MeyCoinRaftTransport) RemovePeer(id rtypes.ID)
- func (t *MeyCoinRaftTransport) Send(msgs []raftpb.Message)
- func (t *MeyCoinRaftTransport) SendSnapshot(m snap.Message)
- func (t *MeyCoinRaftTransport) Start() error
- func (t *MeyCoinRaftTransport) Stop()
- func (t *MeyCoinRaftTransport) UpdatePeer(id rtypes.ID, urls []string)
- 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 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 MeyCoinRaftTransport ¶
type MeyCoinRaftTransport struct { // copied from original transport ServerStats *stats.ServerStats LeaderStats *stats.LeaderStats // contains filtered or unexported fields }
MeyCoinRaftTransport is wrapper of p2p module
func NewMeyCoinRaftTransport ¶
func NewMeyCoinRaftTransport(logger *log.Logger, nt p2pcommon.NetworkTransport, pm p2pcommon.PeerManager, mf p2pcommon.MoFactory, consAcc consensus.ConsensusAccessor, cluster interface{}) *MeyCoinRaftTransport
func (*MeyCoinRaftTransport) ActivePeers ¶
func (t *MeyCoinRaftTransport) ActivePeers() int
func (*MeyCoinRaftTransport) ActiveSince ¶
func (t *MeyCoinRaftTransport) ActiveSince(id rtypes.ID) time.Time
func (*MeyCoinRaftTransport) AddRemote ¶
func (t *MeyCoinRaftTransport) AddRemote(id rtypes.ID, urls []string)
func (*MeyCoinRaftTransport) Handler ¶
func (t *MeyCoinRaftTransport) Handler() http.Handler
func (*MeyCoinRaftTransport) NewSnapshotReceiver ¶
func (t *MeyCoinRaftTransport) NewSnapshotReceiver(peer p2pcommon.RemotePeer, rwc io.ReadWriteCloser) SnapshotReceiver
func (*MeyCoinRaftTransport) NewSnapshotSender ¶
func (t *MeyCoinRaftTransport) NewSnapshotSender(peer p2pcommon.RemotePeer) SnapshotSender
func (*MeyCoinRaftTransport) OnPeerConnect ¶
func (t *MeyCoinRaftTransport) OnPeerConnect(pid types.PeerID)
func (*MeyCoinRaftTransport) OnPeerDisconnect ¶
func (t *MeyCoinRaftTransport) OnPeerDisconnect(peer p2pcommon.RemotePeer)
func (*MeyCoinRaftTransport) OnRaftSnapshot ¶
func (t *MeyCoinRaftTransport) OnRaftSnapshot(s network.Stream)
func (*MeyCoinRaftTransport) RemoveAllPeers ¶
func (t *MeyCoinRaftTransport) RemoveAllPeers()
func (*MeyCoinRaftTransport) RemovePeer ¶
func (t *MeyCoinRaftTransport) RemovePeer(id rtypes.ID)
func (*MeyCoinRaftTransport) Send ¶
func (t *MeyCoinRaftTransport) Send(msgs []raftpb.Message)
Send must send message to target peer or report unreachable if sending peer is failed.
func (*MeyCoinRaftTransport) SendSnapshot ¶
func (t *MeyCoinRaftTransport) SendSnapshot(m snap.Message)
func (*MeyCoinRaftTransport) Start ¶
func (t *MeyCoinRaftTransport) Start() error
func (*MeyCoinRaftTransport) Stop ¶
func (t *MeyCoinRaftTransport) Stop()
func (*MeyCoinRaftTransport) UpdatePeer ¶
func (t *MeyCoinRaftTransport) UpdatePeer(id rtypes.ID, urls []string)
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()
}