Documentation
¶
Index ¶
- Constants
- Variables
- type Config
- type DataStore
- type Event
- type Logger
- func (r Logger) Debug(v ...interface{})
- func (r Logger) Debugf(format string, v ...interface{})
- func (r Logger) Error(v ...interface{})
- func (r Logger) Errorf(format string, v ...interface{})
- func (r Logger) Fatal(v ...interface{})
- func (r Logger) Fatalf(format string, v ...interface{})
- func (r Logger) Info(v ...interface{})
- func (r Logger) Infof(format string, v ...interface{})
- func (r Logger) Panic(v ...interface{})
- func (r Logger) Panicf(format string, v ...interface{})
- func (r Logger) Warning(v ...interface{})
- func (r Logger) Warningf(format string, v ...interface{})
- type Node
- func (n *Node) AddPeer(ctx context.Context, nodeID uint64, peer string) error
- func (n *Node) Addr() string
- func (n *Node) Close() error
- func (n *Node) Delete(ctx context.Context, key string) error
- func (n *Node) Exists(_ context.Context, key string) (bool, error)
- func (n *Node) Get(_ context.Context, key string) ([]byte, error)
- func (n *Node) GetRaftLead() uint64
- func (n *Node) ID() string
- func (n *Node) IsIDRemoved(_ uint64) bool
- func (n *Node) IsReady(ctx context.Context) bool
- func (n *Node) Leader() string
- func (n *Node) LeaderChange() <-chan bool
- func (n *Node) List(_ context.Context, prefix string) ([]engine.Entry, error)
- func (n *Node) ListPeers() map[uint64]string
- func (n *Node) Process(ctx context.Context, m raftpb.Message) error
- func (n *Node) RemovePeer(ctx context.Context, nodeID uint64) error
- func (n *Node) ReportSnapshot(id uint64, status raft.SnapshotStatus)
- func (n *Node) ReportUnreachable(id uint64)
- func (n *Node) Set(ctx context.Context, key string, value []byte) error
- func (n *Node) SetSnapshotThreshold(threshold uint64)
Constants ¶
View Source
const ( ClusterStateNew = "new" ClusterStateExisting = "existing" )
Variables ¶
View Source
var ErrKeyNotFound = errors.New("key not found")
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
// ID is the identity of the local raft. ID cannot be 0.
ID uint64 `yaml:"id"`
// DataDir is the directory to store the raft data which includes snapshot and WALs.
DataDir string `yaml:"data_dir"`
// ClusterState is the state of the cluster, can be one of "new" and "existing".
ClusterState string `yaml:"cluster_state"`
// Peers is the list of raft peers.
Peers []string `yaml:"peers"`
// HeartbeatSeconds is the interval to send heartbeat message. Default is 2 seconds.
HeartbeatSeconds int `yaml:"heartbeat_seconds"`
// ElectionSeconds is the interval to start an election. Default is 10 * HeartBeat.
ElectionSeconds int `yaml:"election_seconds"`
}
type DataStore ¶
type DataStore struct {
// contains filtered or unexported fields
}
func NewDataStore ¶
func (*DataStore) GetDataStoreSnapshot ¶
type Logger ¶
type Logger struct {
*zap.SugaredLogger
}
Logger is a wrapper around zap.SugaredLogger to implement the raft.Logger interface.
type Node ¶
type Node struct {
// contains filtered or unexported fields
}
func (*Node) GetRaftLead ¶
func (*Node) IsIDRemoved ¶
func (*Node) LeaderChange ¶
func (*Node) ReportSnapshot ¶
func (n *Node) ReportSnapshot(id uint64, status raft.SnapshotStatus)
func (*Node) ReportUnreachable ¶
func (*Node) SetSnapshotThreshold ¶
Click to show internal directories.
Click to hide internal directories.