cluster

package
v0.0.0-...-d62ec89 Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2021 License: MPL-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	NodeName          string
	ServiceName       string
	Tags              map[string]string
	BootstrapExpected int64
	LogOutput         io.Writer
	GRPCAddr          *net.TCPAddr
}

func DefaultConfig

func DefaultConfig() *Config

type RaftLayer

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

func NewRaftLayer

func NewRaftLayer(addr net.Addr) *RaftLayer

func (*RaftLayer) Accept

func (l *RaftLayer) Accept() (net.Conn, error)

func (*RaftLayer) Addr

func (l *RaftLayer) Addr() net.Addr

func (*RaftLayer) Close

func (l *RaftLayer) Close() error

func (*RaftLayer) Dial

func (l *RaftLayer) Dial(address raft.ServerAddress, timeout time.Duration) (net.Conn, error)

type Server

type Server struct {
	Config *Config

	// serf
	Serf *serf.Serf

	EventCh chan serf.Event

	// raft
	Raft     *raft.Raft
	LeaderCh chan bool
	// contains filtered or unexported fields
}

func NewServer

func NewServer(config *Config, logger *log.Logger) *Server

func (*Server) Apply

func (s *Server) Apply(cmd []byte, timeout time.Duration) raft.ApplyFuture

func (*Server) GRPCServer

func (s *Server) GRPCServer() *grpc.Server

func (*Server) IsLeader

func (s *Server) IsLeader() bool

func (*Server) SetupGRPC

func (s *Server) SetupGRPC() error

func (*Server) SetupRaft

func (s *Server) SetupRaft(fsm raft.FSM) error

func (*Server) SetupSerf

func (s *Server) SetupSerf() error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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