hashicorp

package
v2.3.5 Latest Latest
Warning

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

Go to latest
Published: Jun 1, 2023 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// DefaultRaftTimeout is used to apply I/O deadlines. For InstallSnapshot, we multiply
	// DefaultRaftTimeout by (SnapshotSize / TimeoutScale).
	DefaultRaftTimeout = 10 * time.Second
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Fsm

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

func NewFsm

func NewFsm(notifyCh chan<- *message.Message) *Fsm

func (*Fsm) Apply

func (f *Fsm) Apply(l *raft.Log) interface{}

func (*Fsm) DelByNode

func (f *Fsm) DelByNode(node string) int

func (*Fsm) Restore

func (f *Fsm) Restore(ir io.ReadCloser) error

func (*Fsm) Search

func (f *Fsm) Search(key string) []string

func (*Fsm) Snapshot

func (f *Fsm) Snapshot() (raft.FSMSnapshot, error)

type KVStore

type KVStore struct {
	Data map[string][]string
	// contains filtered or unexported fields
}

func NewKVStore

func NewKVStore() KVStore

func (*KVStore) Del

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

func (*KVStore) DelByValue

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

func (*KVStore) Get

func (d *KVStore) Get(key string) []string

func (*KVStore) Persist

func (d *KVStore) Persist(sink raft.SnapshotSink) error

func (*KVStore) Release

func (d *KVStore) Release()

func (*KVStore) Set

func (d *KVStore) Set(key, value string)

type Peer

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

func Setup

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

func (*Peer) DelByNode

func (p *Peer) DelByNode(node string) int

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) 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) Propose

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

func (*Peer) Status

func (p *Peer) Status() ([]byte, error)

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