protocol

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Mar 13, 2019 License: AGPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CircleProtocol = protocol.ID("/stratumn/node/circle/v1.0.0")

CircleProtocol defines protocol for internal use

View Source
var DiscoverProtocol = protocol.ID("/stratumn/node/circle-discover/v1.0.0")

DiscoverProtocol defines protocol for peer discovery

Functions

This section is empty.

Types

type Circle

type Circle interface {
	Run(ctx context.Context) error
}

Circle exports internal circle process structure

func NewCircleProcess

func NewCircleProcess(
	lib lib.Lib,
	hub *Hub,
	localPeer []byte,
	electionTick int,
	heartbeatTick int,
	maxSizePerMsg uint64,
	maxInflightMsgs int,
	tickerInterval uint64,
) Circle

NewCircleProcess creates an instance of circleProcess

type Hub

type Hub struct {
	// contains filtered or unexported fields
}

Hub centralizes communication between circle and net processes

func NewHub

func NewHub() *Hub

NewHub creates an instance of Hub

func (*Hub) Discover

func (h *Hub) Discover(peerID pb.PeerID) <-chan pb.Peer

Discover returns the list of peers of a remote node

func (*Hub) Expel

func (h *Hub) Expel(peerID pb.PeerID)

Expel removes a node from the cluster

func (*Hub) Invite

func (h *Hub) Invite(peerID pb.PeerID)

Invite adds new node to the cluster

func (*Hub) Join

func (h *Hub) Join(peerID pb.PeerID)

Join starts the node and joins the existing cluster

func (*Hub) Log

func (h *Hub) Log() <-chan pb.Entry

Log lists all committed entries

func (*Hub) Peers

func (h *Hub) Peers() <-chan pb.Peer

Peers returns the list of local peers

func (*Hub) Propose

func (h *Hub) Propose(proposal pb.Proposal)

Propose adds an entry in the log

func (*Hub) Start

func (h *Hub) Start()

Start starts the node

func (*Hub) Status

func (h *Hub) Status() pb.StatusInfo

Status enqueries node status

func (*Hub) Stop

func (h *Hub) Stop()

Stop stops the node

type Net

type Net interface {
	Run(ctx context.Context) error
	CircleHandler(stream inet.Stream)
	DiscoverHandler(stream inet.Stream)
}

Net exports internal net process structure

func NewNetProcess

func NewNetProcess(host host, hub *Hub) Net

NewNetProcess creates a runnable instance of netProcess

Directories

Path Synopsis
lib
mocklib
Package mocklib is a generated GoMock package.
Package mocklib is a generated GoMock package.

Jump to

Keyboard shortcuts

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