mesh

package
v0.21.16 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2022 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PeerIdHeader      = 10
	PeerAddrHeader    = 11
	PeerVersionHeader = 12

	RaftConnectType = 2048
	RaftDataType    = 2049

	ChannelTypeMesh = "ctrl.mesh"
)

Variables

This section is empty.

Functions

This section is empty.

Types

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
}

Mesh provides the networking layer to raft

func New

func New(id *identity.TokenId, version string, raftId raft.ServerID, raftAddr raft.ServerAddress, bindHandler channel.BindHandler) Mesh

type Peer

type Peer struct {
	Id       raft.ServerID
	Address  string
	Channel  channel.Channel
	RaftConn *raftPeerConn
	Version  string
	// contains filtered or unexported fields
}

func (*Peer) Connect

func (self *Peer) Connect(timeout time.Duration) error

func (*Peer) ContentType

func (self *Peer) ContentType() int32

func (*Peer) HandleClose

func (self *Peer) HandleClose(channel.Channel)

func (*Peer) HandleReceive

func (self *Peer) HandleReceive(m *channel.Message, ch channel.Channel)

Jump to

Keyboard shortcuts

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