mgr

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jan 7, 2022 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewDefaultTicker

func NewDefaultTicker(d time.Duration) *defaultTicker

Types

type Config

type Config struct {
	TickIntervalMilliSec int64
	ElectionTimeoutMin   int64
	ElectionTimeoutMax   int64
	DebugMode            bool
}

type ConfigChange

type ConfigChange struct {
	Op     ConfigOp
	Server core.Address
}

type ConfigOp

type ConfigOp int
const (
	Add ConfigOp = iota
	Remove
)

type RaftManager

type RaftManager struct {
	Dispatcher dispatcher
	// contains filtered or unexported fields
}

func NewRaftMgr

func NewRaftMgr(cls core.Cluster, cfg Config, sm core.StateMachine, inputCh chan *Rpc) *RaftManager

func NewRaftMgrWithTicker

func NewRaftMgrWithTicker(cls core.Cluster, cfg Config, sm core.StateMachine, inputCh chan *Rpc, ticker Ticker) *RaftManager

func (*RaftManager) GetAllEntries

func (m *RaftManager) GetAllEntries() []core.Entry

func (*RaftManager) GetOthers

func (m *RaftManager) GetOthers() []core.Address

func (*RaftManager) IsCandidate

func (m *RaftManager) IsCandidate() bool

func (*RaftManager) IsFollower

func (m *RaftManager) IsFollower() bool

func (*RaftManager) IsLeader

func (m *RaftManager) IsLeader() bool

func (*RaftManager) Run

func (m *RaftManager) Run()

func (*RaftManager) Stop

func (m *RaftManager) Stop()

type Rpc

type Rpc struct {
	Ctx     context.Context
	Addr    core.Address
	Payload interface{}
}

type Ticker

type Ticker interface {
	GetTickCh() <-chan time.Time
	Start()
	Stop()
}

Jump to

Keyboard shortcuts

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