mesh

package
v0.19.21 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	PeerIdHeader   = 10
	PeerAddrHeader = 11

	RaftConnectType = 2048
	RaftDataType    = 2049
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Mesh

type Mesh interface {
	raft.StreamLayer

	// Listen starts a network listener for the mesh on the given address
	Listen(listenAddr string) error

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

Mesh provides the networking layer to raft

func New

func New(id *identity.TokenId, 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
	// 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