cluster

package
v0.0.71 Latest Latest
Warning

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

Go to latest
Published: Dec 23, 2019 License: MPL-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrStateKeyAlreadySet = errors.New("specified key is already taken")
	ErrNodeNotFound       = errors.New("specified node not found in mesh")
)

Functions

func MockedMesh

func MockedMesh() *mockedMesh

func NewGossipServiceLayer added in v0.0.64

func NewGossipServiceLayer(name string, logger *zap.Logger, serviceConfig ServiceConfig, discovery DiscoveryLayer) types.GossipServiceLayer

func NewRaftServiceLayer added in v0.0.64

func NewRaftServiceLayer(name string, logger *zap.Logger, serviceConfig ServiceConfig, rpcConfig ServiceConfig, discovery DiscoveryLayer) types.RaftServiceLayer

func ServeRPC added in v0.0.64

func ServeRPC(port int, l pb.LayerServer) net.Listener

Types

type Discoverer

type Discoverer interface {
	EndpointsByService(name string) ([]*pb.NodeService, error)
	ByID(id string) (peers.Peer, error)
	On(event string, handler func(peers.Peer)) func()
}

type DiscoveryLayer added in v0.0.64

type DiscoveryLayer interface {
	Peers() peers.PeerStore
	DialService(name string) (*grpc.ClientConn, error)
	RegisterService(name, address string) error
	UnregisterService(name string) error
	AddServiceTag(service, key, value string) error
	RemoveServiceTag(name string, tag string) error
	Leave()
	Join(hosts []string) error
	Health() string
	ServiceName() string
}

func NewDiscoveryLayer added in v0.0.64

func NewDiscoveryLayer(logger *zap.Logger, userConfig config.Config) DiscoveryLayer

type GossipLayer added in v0.0.64

type GossipLayer interface {
	AddState(key string, state types.GossipState) (types.Channel, error)
	DiscoverPeers(discovery peers.PeerStore)
	Join(peers []string) error
	Members() []*memberlist.Node
	OnNodeJoin(func(id string, meta []byte))
	OnNodeLeave(func(id string, meta []byte))
	OnNodeUpdate(func(id string, meta []byte))
	Leave()
}

Mesh represents the mesh state network, being able to broadcast state across the nodes.

type Mesh

type Mesh interface {
	Join(hosts []string) error
	Peers() peers.PeerStore
	DialService(name string) (*grpc.ClientConn, error)
	RegisterService(name, address string) error
	Leave()
	Health() string
}

Mesh represents the mesh discovery network.

type ServiceConfig

type ServiceConfig struct {
	ID            string
	AdvertiseAddr string
	AdvertisePort int
	BindPort      int
	ServicePort   int
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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