Documentation ¶
Index ¶
- Variables
- type Cluster
- type Raft
- func (r *Raft) AddPeer(peer string) error
- func (r *Raft) Apply(b []byte) error
- func (r *Raft) Close() error
- func (r *Raft) GetLeader() string
- func (r *Raft) IsLeader() bool
- func (r *Raft) Leader() string
- func (r *Raft) LeaderCh() <-chan interface{}
- func (r *Raft) Peers() ([]string, error)
- func (r *Raft) RemovePeer(peer string) error
- func (r *Raft) SetPeers(peers []string) error
- func (r *Raft) ShutdownCh() <-chan struct{}
Constants ¶
This section is empty.
Variables ¶
var ( // ErrKeyNotFound - Key does not exist in the store ErrKeyNotFound = libkvstore.ErrKeyNotFound // ErrKeyModified - Key was modified during atomic operation ErrKeyModified = libkvstore.ErrKeyModified // ErrCallNotSupported - call is not supported ErrCallNotSupported = libkvstore.ErrCallNotSupported )
Functions ¶
This section is empty.
Types ¶
type Cluster ¶
type Cluster struct {
// contains filtered or unexported fields
}
Cluster is used to manage all the cluster state for a given node
func New ¶
func New(l net.Listener, rpcDialer rpc.DialerFn, home, addr, peer string, logger io.Writer) (*Cluster, error)
New creates a new Cluster and starts it
func (*Cluster) Errors ¶
Errors returns a channel receiver that callers can use to listen for cluster errors
func (*Cluster) KVStore ¶
func (c *Cluster) KVStore() libkvstore.Store
KVStore provides access to the underlying KV store
func (*Cluster) ShutdownCh ¶
func (c *Cluster) ShutdownCh() <-chan struct{}
ShutdownCh returns a channel that can be watched to determine if the cluster has been shut down
type Raft ¶
type Raft struct {
// contains filtered or unexported fields
}
Raft wraps the underlying raft.Raft with some extra helpers to expose to other, non-raft components
func (*Raft) Apply ¶
Apply applies the bytes to the raft log If this is not the leader node, the request is sent to the leader
func (*Raft) LeaderCh ¶
func (r *Raft) LeaderCh() <-chan interface{}
LeaderCh can be watched for changes in raft node state
func (*Raft) RemovePeer ¶
RemovePeer removes the given peer from the raft cluster
func (*Raft) ShutdownCh ¶
func (r *Raft) ShutdownCh() <-chan struct{}
ShutdownCh can be watched to determine if the raft has been shutdown