cluster

package module
v1.7.10 Latest Latest
Warning

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

Go to latest
Published: Jan 7, 2021 License: MPL-2.0 Imports: 15 Imported by: 5

README

Golang clustering lib, based on memberlist, etcd-raft

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GossipConfig

type GossipConfig struct {
	JoinList                 []string
	Network                  NetworkConfig
	WANMode                  bool
	DistributedStateDelegate memberlist.Delegate
	NodeEventDelegate        membership.Recorder
}

type MultiNode

type MultiNode interface {
	Call(id uint64, f func(*grpc.ClientConn) error) error
	Gossip() membership.Pool
	Node(cluster string, config RaftConfig) Node
	Shutdown() error
}

func NewMultiNode

func NewMultiNode(config NodeConfig, dialer func(address string, opts ...grpc.DialOption) (*grpc.ClientConn, error), server *grpc.Server, logger *zap.Logger) MultiNode

type NetworkConfig

type NetworkConfig struct {
	AdvertizedHost string
	AdvertizedPort int
	ListeningPort  int
}

func (NetworkConfig) AdvertizedAddress

func (n NetworkConfig) AdvertizedAddress() string

type Node

type Node interface {
	Run(context.Context)
	Shutdown() error
	Apply(context.Context, []byte) (uint64, error)
	Ready() <-chan struct{}
	Call(id uint64, f func(*grpc.ClientConn) error) error
	Index() uint64
	Leader() uint64
}

type NodeConfig

type NodeConfig struct {
	ID            uint64
	ServiceName   string
	DataDirectory string
	Version       string
	GossipConfig  GossipConfig
	RaftConfig    RaftConfig
}

type NodeRPCServer

type NodeRPCServer struct {
}

type RaftConfig

type RaftConfig struct {
	ExpectedNodeCount         int
	AppliedIndex              uint64
	DisableProposalForwarding bool
	CheckQuorum               bool
	LeaderFunc                func(context.Context, raft.RaftStatusProvider) error
	Network                   NetworkConfig
	GetStateSnapshot          func() ([]byte, error)
	CommitApplier             raft.CommitApplier
	SnapshotApplier           raft.SnapshotApplier
	ConfChangeApplier         raft.ConfChangeApplier
	OnNodeRemoved             func(id uint64, leader bool)
	OnNodeAdded               func(id uint64, leader bool)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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