raftsupport

package
v0.0.0-...-2c813a9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 12, 2021 License: MIT Imports: 28 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SnapRespHeaderLength = 4
)

Variables

View Source
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 (*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 (*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) AddPeer

func (t *MeyCoinRaftTransport) AddPeer(id rtypes.ID, peerID types.PeerID, urls []string)

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) Decode

func (dec *RaftMsgDecoder) Decode() (raftpb.Message, error)

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

func (*RaftMsgEncoder) Encode

func (enc *RaftMsgEncoder) Encode(m *raftpb.Message) error

type RaftMsgMarshaller

type RaftMsgMarshaller struct {
	*raftpb.Message
}

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()
}

type SnapshotSender

type SnapshotSender interface {
	// Send send snapshot data to target peer and always return the result to snapMsg (i.e. call Message.CloseWithErr() )
	Send(snapMsg *snap.Message)
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL