Documentation ¶
Index ¶
Constants ¶
View Source
const ( PeerAddrHeader = 11 RaftConnectType = 2048 RaftDataType = 2049 ChannelTypeMesh = "ctrl.mesh" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ClusterState ¶ added in v0.22.23
type ClusterState uint32
const ( ClusterReadWrite ClusterState = 0 ClusterReadOnly ClusterState = 1 )
type Mesh ¶
type Mesh interface { raft.StreamLayer channel.UnderlayAcceptor // GetOrConnectPeer returns a peer for the given address. If a peer has already been established, // it will be returned, otherwise a new connection will be established GetOrConnectPeer(address string, timeout time.Duration) (*Peer, error) IsReadOnly() bool GetPeerId(address string, timeout time.Duration) (string, error) GetAdvertiseAddr() raft.ServerAddress GetPeers() map[string]*Peer RegisterClusterStateHandler(f func(state ClusterState)) }
Mesh provides the networking layer to raft
func New ¶
func New(id *identity.TokenId, version versions.VersionProvider, raftAddr raft.ServerAddress, bindHandler channel.BindHandler) Mesh
type Peer ¶
type Peer struct { Id raft.ServerID Address string Channel channel.Channel RaftConn *raftPeerConn Version *versions.VersionInfo // contains filtered or unexported fields }
func (*Peer) ContentType ¶
func (*Peer) HandleClose ¶
func (self *Peer) HandleClose(channel.Channel)
func (*Peer) HandleReceive ¶
func (self *Peer) HandleReceive(m *channel.Message, _ channel.Channel)
Click to show internal directories.
Click to hide internal directories.