gossipCluster

package
v0.5.23 Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2021 License: BSD-3-Clause Imports: 23 Imported by: 0

Documentation

Index

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 added in v0.5.20

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 added in v0.5.20

func (b *BadgerStore) DeleteRange(min, max uint64) error

DeleteRange deletes logs within a given range inclusively.

func (*BadgerStore) FirstIndex added in v0.5.20

func (b *BadgerStore) FirstIndex() (uint64, error)

FirstIndex returns the first known index from the Raft log.

func (*BadgerStore) Get added in v0.5.20

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 added in v0.5.20

func (b *BadgerStore) GetLog(index uint64, log *raft.Log) error

GetLog gets a log entry from Badger at a given index.

func (*BadgerStore) GetUint64 added in v0.5.20

func (b *BadgerStore) GetUint64(key []byte) (uint64, error)

GetUint64 is like Get, but handles uint64 values

func (*BadgerStore) LastIndex added in v0.5.20

func (b *BadgerStore) LastIndex() (uint64, error)

LastIndex returns the last known index from the Raft log.

func (*BadgerStore) Set added in v0.5.20

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 added in v0.5.20

func (b *BadgerStore) SetUint64(key []byte, val uint64) error

SetUint64 is like Set, but handles uint64 values

func (*BadgerStore) StoreLog added in v0.5.20

func (b *BadgerStore) StoreLog(log *raft.Log) error

StoreLog stores a single raft log.

func (*BadgerStore) StoreLogs added in v0.5.20

func (b *BadgerStore) StoreLogs(logs []*raft.Log) error

StoreLogs stores a set of raft logs.

type Cluster

type Cluster struct {
	cluster.ReplicaMessageHandler
	// contains filtered or unexported fields
}

Cluster

func New

func New(dataPath string, cfg Config) *Cluster

func (*Cluster) Addr

func (c *Cluster) Addr() string

func (*Cluster) Join

func (c *Cluster) Join(addr ...string) (int, error)

func (*Cluster) Members

func (c *Cluster) Members() []cluster.Member

func (*Cluster) RaftApply

func (c *Cluster) RaftApply(cmd []byte) raft.ApplyFuture

func (*Cluster) RaftEnabled added in v0.5.20

func (c *Cluster) RaftEnabled() bool

func (*Cluster) RaftLeaderID

func (c *Cluster) RaftLeaderID() string

func (*Cluster) RaftMembers

func (c *Cluster) RaftMembers(replicaSet uint64) []cluster.Member

func (*Cluster) RaftState

func (c *Cluster) RaftState() raft.RaftState

func (*Cluster) ReplicaSet

func (c *Cluster) ReplicaSet() uint64

func (*Cluster) SetGatewayAddrs

func (c *Cluster) SetGatewayAddrs(hostPorts []string) error

func (*Cluster) SetTunnelAddrs added in v0.5.20

func (c *Cluster) SetTunnelAddrs(hostPorts []string) error

func (*Cluster) Shutdown

func (c *Cluster) Shutdown()

func (*Cluster) Start

func (c *Cluster) Start()

func (*Cluster) TotalReplicas added in v0.5.20

func (c *Cluster) TotalReplicas() int

type Config

type Config struct {
	ServerID   []byte
	Bootstrap  bool
	RaftPort   int
	ReplicaSet uint64
	Mode       cluster.Mode
	GossipPort int
}

Config

type Member

type Member struct {
	ShardRange [2]uint32

	ClusterAddr net.IP
	ClusterPort uint16
	// contains filtered or unexported fields
}

Member

func (*Member) GatewayAddr

func (m *Member) GatewayAddr() []string

func (*Member) Proto

func (m *Member) Proto(p *rony.Edge) *rony.Edge

func (*Member) RaftPort

func (m *Member) RaftPort() int

func (*Member) RaftState

func (m *Member) RaftState() rony.RaftState

func (*Member) ReplicaSet

func (m *Member) ReplicaSet() uint64

func (*Member) ServerID

func (m *Member) ServerID() string

func (*Member) TunnelAddr added in v0.5.20

func (m *Member) TunnelAddr() []string

Jump to

Keyboard shortcuts

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