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 ¶
- type Store
- func (s *Store) Add(key, value string) error
- func (s *Store) Delete(key string) error
- func (s *Store) Get(key string) (string, error)
- func (s *Store) Join(addr string) error
- func (s *Store) Leader() string
- func (s *Store) Open(enableSingle bool) error
- func (s *Store) Peers() ([]string, error)
- func (s *Store) Set(key, value string) error
- func (s *Store) Stats() map[string]string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Store ¶
Store is a simple key-value store, where all changes are made via Raft consensus.
func (*Store) Join ¶
Join joins a node, located at addr, to this store. The node must be ready to respond to Raft communications at that address.
func (*Store) Open ¶
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.