Documentation ¶
Index ¶
- Variables
- type BadgerStore
- func (b *BadgerStore) DeleteRange(min, max uint64) error
- func (b *BadgerStore) FirstIndex() (uint64, error)
- func (b *BadgerStore) Get(key []byte) ([]byte, error)
- func (b *BadgerStore) GetLog(index uint64, log *raft.Log) error
- func (b *BadgerStore) GetUint64(key []byte) (uint64, error)
- func (b *BadgerStore) LastIndex() (uint64, error)
- func (b *BadgerStore) Set(key []byte, val []byte) error
- func (b *BadgerStore) SetUint64(key []byte, val uint64) error
- func (b *BadgerStore) StoreLog(log *raft.Log) error
- func (b *BadgerStore) StoreLogs(logs []*raft.Log) error
- type Cluster
- func (c *Cluster) Addr() string
- func (c *Cluster) Join(addr ...string) (int, error)
- func (c *Cluster) Members() []cluster.Member
- func (c *Cluster) RaftApply(cmd []byte) raft.ApplyFuture
- func (c *Cluster) RaftEnabled() bool
- func (c *Cluster) RaftLeaderID() string
- func (c *Cluster) RaftMembers(replicaSet uint64) []cluster.Member
- func (c *Cluster) RaftState() raft.RaftState
- func (c *Cluster) ReplicaSet() uint64
- func (c *Cluster) SetGatewayAddrs(hostPorts []string) error
- func (c *Cluster) SetTunnelAddrs(hostPorts []string) error
- func (c *Cluster) Shutdown()
- func (c *Cluster) Start()
- func (c *Cluster) TotalReplicas() int
- type Config
- type Member
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrKeyNotFound is an error indicating a given key does not exist ErrKeyNotFound = errors.New("not found") )
Functions ¶
This section is empty.
Types ¶
type BadgerStore ¶
type BadgerStore struct{}
BadgerStore provides access to Badger for Raft to store and retrieve log entries. It also provides key/value storage, and can be used as a LogStore and StableStore.
func (*BadgerStore) DeleteRange ¶
func (b *BadgerStore) DeleteRange(min, max uint64) error
DeleteRange deletes logs within a given range inclusively.
func (*BadgerStore) FirstIndex ¶
func (b *BadgerStore) FirstIndex() (uint64, error)
FirstIndex returns the first known index from the Raft log.
func (*BadgerStore) Get ¶
func (b *BadgerStore) Get(key []byte) ([]byte, error)
Get is used to retrieve a value from the k/v store by key
func (*BadgerStore) GetLog ¶
func (b *BadgerStore) GetLog(index uint64, log *raft.Log) error
GetLog gets a log entry from Badger at a given index.
func (*BadgerStore) GetUint64 ¶
func (b *BadgerStore) GetUint64(key []byte) (uint64, error)
GetUint64 is like Get, but handles uint64 values
func (*BadgerStore) LastIndex ¶
func (b *BadgerStore) LastIndex() (uint64, error)
LastIndex returns the last known index from the Raft log.
func (*BadgerStore) Set ¶
func (b *BadgerStore) Set(key []byte, val []byte) error
Set is used to set a key/value set outside of the raft log.
func (*BadgerStore) SetUint64 ¶
func (b *BadgerStore) SetUint64(key []byte, val uint64) error
SetUint64 is like Set, but handles uint64 values
type Cluster ¶
type Cluster struct { cluster.ReplicaMessageHandler // contains filtered or unexported fields }
func (*Cluster) RaftEnabled ¶
func (*Cluster) RaftLeaderID ¶
func (*Cluster) ReplicaSet ¶
func (*Cluster) SetGatewayAddrs ¶
func (*Cluster) SetTunnelAddrs ¶
func (*Cluster) TotalReplicas ¶
type Config ¶
type Config struct { ServerID []byte Bootstrap bool RaftPort int ReplicaSet uint64 Mode cluster.Mode GossipPort int DataPath string }
Config
type Member ¶
type Member struct { ClusterAddr net.IP ClusterPort uint16 // contains filtered or unexported fields }
Member
func (*Member) GatewayAddr ¶
func (*Member) ReplicaSet ¶
func (*Member) TunnelAddr ¶
Click to show internal directories.
Click to hide internal directories.