raft

package
v0.0.0-...-c46e59b Latest Latest
Warning

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

Go to latest
Published: Mar 19, 2022 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Opt

type Opt func(o *Options)

func WithAdvertiseAddr

func WithAdvertiseAddr(addr net.Addr) Opt

func WithClusterSecret

func WithClusterSecret(secret string) Opt

func WithCommitTimeout

func WithCommitTimeout(timeout time.Duration) Opt

func WithDebug

func WithDebug(debug bool) Opt

func WithElectionTimeout

func WithElectionTimeout(timeout time.Duration) Opt

func WithHeartbeatTimeout

func WithHeartbeatTimeout(timeout time.Duration) Opt

func WithIsLeader

func WithIsLeader(isLeader bool) Opt

func WithLeaderLeaseTimeout

func WithLeaderLeaseTimeout(timeout time.Duration) Opt

func WithMaxPool

func WithMaxPool(max int) Opt

func WithPeerID

func WithPeerID(peerID string) Opt

func WithRaftDir

func WithRaftDir(dir string) Opt

func WithRestoreSnapshotOnRestart

func WithRestoreSnapshotOnRestart(restore bool) Opt

func WithSnapshotRetention

func WithSnapshotRetention(retention int) Opt

func WithTimeout

func WithTimeout(timeout time.Duration) Opt

type Options

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

type Raft

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

func NewRaft

func NewRaft(fsm raft.FSM, lis net.Listener, opts ...Opt) (*Raft, error)

func (*Raft) Apply

func (s *Raft) Apply(bits []byte) (interface{}, error)

func (*Raft) Close

func (r *Raft) Close() error

func (*Raft) Join

func (s *Raft) Join(nodeID, addr string) error

func (*Raft) LeaderAddr

func (s *Raft) LeaderAddr() string

func (*Raft) PeerID

func (r *Raft) PeerID() string

func (*Raft) Servers

func (s *Raft) Servers() ([]raft.Server, error)

func (*Raft) State

func (r *Raft) State() raft.RaftState

func (*Raft) Stats

func (s *Raft) Stats() map[string]string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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