etcd

package
v2.4.0 Latest Latest
Warning

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

Go to latest
Published: Aug 23, 2023 License: MIT Imports: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidID = errors.New("node name must be a number")
)

Functions

This section is empty.

Types

type KVStore

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

KVStore is a key-value store backed by raft

func (*KVStore) Add

func (s *KVStore) Add(key, value string)

func (*KVStore) Del

func (s *KVStore) Del(key, value string)

func (*KVStore) DelByValue

func (d *KVStore) DelByValue(value string) int

func (*KVStore) GetErrorC

func (s *KVStore) GetErrorC(key, value string) <-chan error

func (*KVStore) Lookup

func (s *KVStore) Lookup(key string) ([]string, bool)

type Peer

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

func Setup

func Setup(conf *config.Cluster, notifyCh chan<- *message.Message) (*Peer, error)

Setup 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 (*Peer) GenPeersFile

func (p *Peer) GenPeersFile(file string) error

func (*Peer) GetLeader

func (p *Peer) GetLeader() (addr, id string)

func (*Peer) IsApplyRight

func (p *Peer) IsApplyRight() bool

func (*Peer) IsIDRemoved

func (p *Peer) IsIDRemoved(id uint64) bool

func (*Peer) Join

func (p *Peer) Join(nodeId, addr string) error

func (*Peer) Leave

func (p *Peer) Leave(nodeId string) error

func (*Peer) Lookup

func (p *Peer) Lookup(key string) []string

func (*Peer) Process

func (p *Peer) Process(ctx context.Context, m raftpb.Message) error

func (*Peer) Propose

func (p *Peer) Propose(msg *message.Message) error

func (*Peer) ReportSnapshot

func (p *Peer) ReportSnapshot(id uint64, status raft.SnapshotStatus)

func (*Peer) ReportUnreachable

func (p *Peer) ReportUnreachable(id uint64)

func (*Peer) Stop

func (p *Peer) Stop()

Jump to

Keyboard shortcuts

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