raft

package
v0.0.63 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2024 License: GPL-3.0 Imports: 32 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewRaftNode added in v0.0.57

func NewRaftNode(raftnode *RaftNode, keys *keys.Keys, TLSConfig *tls.Config, id uint64, peers []string, join bool, getSnapshot func() ([]byte, error), proposeC <-chan string,
	confChangeC <-chan raftpb.ConfChange) (<-chan *Commit, <-chan error, <-chan *snap.Snapshotter)

newRaftNode initiates a raft instance and returns a committed log entry channel and error channel. Proposals for log updates are sent over the provided the proposal channel. All log entries are replayed over the commit channel, followed by a nil message (to indicate the channel is current), then new log entries. To shutdown, close proposeC and read errorC.

Types

type Commit added in v0.0.57

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

type KVStore added in v0.0.57

type KVStore struct {
	ConfChangeC chan<- raftpb.ConfChange // channel for proposing updates
	// contains filtered or unexported fields
}

a key-value store backed by raft

func NewKVStore added in v0.0.57

func NewKVStore(snapshotter *snap.Snapshotter, badger *badger.DB, mgr *manager.Manager, proposeC chan<- string, commitC <-chan *Commit, errorC <-chan error) *KVStore

func (*KVStore) GetSnapshot added in v0.0.57

func (s *KVStore) GetSnapshot() ([]byte, error)

func (*KVStore) Propose added in v0.0.57

func (s *KVStore) Propose(k string, v string)

type RaftNode added in v0.0.57

type RaftNode struct {
	Peers []string // raft peer URLs

	TLSConfig *tls.Config
	// contains filtered or unexported fields
}

A key-value stream backed by raft

func (*RaftNode) IsIDRemoved added in v0.0.57

func (rc *RaftNode) IsIDRemoved(_ uint64) bool

func (*RaftNode) NodeReady added in v0.0.57

func (rc *RaftNode) NodeReady() <-chan raft.Ready

func (*RaftNode) Process added in v0.0.57

func (rc *RaftNode) Process(ctx context.Context, m raftpb.Message) error

func (*RaftNode) ReportSnapshot added in v0.0.57

func (rc *RaftNode) ReportSnapshot(id uint64, status raft.SnapshotStatus)

func (*RaftNode) ReportUnreachable added in v0.0.57

func (rc *RaftNode) ReportUnreachable(id uint64)

Jump to

Keyboard shortcuts

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