cluster

package
v0.0.63-rc20 Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2019 License: MPL-2.0 Imports: 22 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 New

func New(userConfig Config) *memberlistMesh

func NewServiceLayer

func NewServiceLayer(name string, serviceConfig ServiceConfig, discovery Mesh) types.ServiceLayer

Types

type Config

type Config struct {
	ID            string
	AdvertiseAddr string
	AdvertisePort int
	BindPort      int
	// contains filtered or unexported fields
}

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 Layer

type Layer interface {
	AddState(key string, state types.State) (types.Channel, error)
	DiscoverPeers(discovery peers.PeerStore)
	Join(peers []string)
	Members() []*memberlist.Node
	Leave()
}

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

func NewLayer

func NewLayer(name string, userConfig Config, meta pb.NodeMeta) Layer

type Mesh

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

Mesh represents the mesh discovery network.

type Service

type Service struct {
	ID      string
	Address string
}

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