raft

package
v0.0.0-...-2200cc9 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2022 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ConfigRaft

type ConfigRaft struct {
	LogDir   string
	Name     string
	Size     int
	NatsAddr string
	HTTPAddr string
}

ConfigRaft is the configuration to spawn a new Raft node

type Raft

type Raft struct {
	Name                string
	Node                *graft.Node
	LogDir              string
	ExpectedClusterSize int
	NatsAddr            string
	HTTPAddr            string

	ExitChan        chan bool
	ErrChan         chan error
	StateChangeChan chan graft.StateChange

	OnBecomingLeader    func(state graft.State)
	OnBecomingFollower  func(state graft.State)
	OnBecomingCandidate func(state graft.State)
	OnClosed            func(state graft.State)
	// contains filtered or unexported fields
}

Raft is a structure that represents a Raft node

func NewRaft

func NewRaft(conf ConfigRaft) (*Raft, error)

NewRaft is the constructor for a Raft node

func (*Raft) Close

func (r *Raft) Close()

Close stops participating in quorum election.

func (*Raft) RunBlocking

func (r *Raft) RunBlocking(ctx context.Context)

Run initiates the quorum participation of this Raft node

type RaftHTTPGet

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

func NewRaftHTTPGet

func NewRaftHTTPGet(raft *Raft) *RaftHTTPGet

func (*RaftHTTPGet) ServeHTTP

func (handler *RaftHTTPGet) ServeHTTP(w http.ResponseWriter, r *http.Request)

Jump to

Keyboard shortcuts

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