Documentation ¶
Overview ¶
Package store provides a simple distributed key-value store. The keys and associated values are changed via distributed consensus, meaning that the values are changed only when a majority of nodes in the cluster agree on the new value.
Distributed consensus is provided via the Raft algorithm.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type NullWriter ¶
type NullWriter int
type RaftModule ¶
type RaftModule struct {
// contains filtered or unexported fields
}
func New ¶
func New() *RaftModule
func (*RaftModule) Delete ¶
func (s *RaftModule) Delete(key string) error
Delete deletes the given key.
func (*RaftModule) Get ¶
func (s *RaftModule) Get(key string) (string, error)
Get returns the value for the given key.
func (*RaftModule) Join ¶
func (s *RaftModule) Join(addr string) error
Join joins a node, located at addr, to this store. The node must be ready to respond to Raft communications at that address.
func (*RaftModule) Open ¶
func (s *RaftModule) Open() error
Open opens the store. If enableSingle is set, and there are no existing peers, then this node becomes the first node, and therefore leader, of the cluster.
func (*RaftModule) Set ¶
func (s *RaftModule) Set(key, value string) error
Set sets the value for the given key.