raft

package
v0.0.101 Latest Latest
Warning

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

Go to latest
Published: Jan 6, 2025 License: GPL-3.0 Imports: 34 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Commit added in v0.0.57

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

type KV added in v0.0.65

type KV struct {
	Key      string
	Val      string
	Category string
	Agent    string
}

type KVStore added in v0.0.57

type KVStore struct {
	EtcdC       chan KV
	ObjectsC    chan KV
	ConfChangeC chan<- raftpb.ConfChange // channel for proposing updates
	Agent       string
	// 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, client *client.Http, proposeC chan<- string, commitC <-chan *Commit, errorC <-chan error, etcdC chan KV, objectsC chan KV) (*KVStore, error)

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, agent string)

func (*KVStore) ProposeEtcd added in v0.0.65

func (s *KVStore) ProposeEtcd(k string, v string, agent string)

func (*KVStore) ProposeObject added in v0.0.89

func (s *KVStore) ProposeObject(k string, v string, agent string)

func (*KVStore) ProposeSecret added in v0.0.89

func (s *KVStore) ProposeSecret(k string, v string, agent 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 NewRaftNode added in v0.0.57

func NewRaftNode(raftnode *RaftNode, keys *keys.Keys, TLSConfig *tls.Config, id uint64, peers *node.Nodes, join bool, getSnapshot func() ([]byte, error), proposeC <-chan string,
	confChangeC <-chan raftpb.ConfChange) (*RaftNode, <-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.

func (*RaftNode) IsIDRemoved added in v0.0.57

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

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