Documentation
¶
Overview ¶
Package service provides the HTTP server for accessing the distributed key-value store. It also provides the endpoint for other nodes to join an existing cluster.
Index ¶
Constants ¶
View Source
const ( // OK for successful response OK = 1000 // ParamsError for params error response ParamsError = 1001 // KeyNotFound for key/value no found response KeyNotFound = 1002 // KeyDuplicate for key/value duplicate response KeyDuplicate = 1003 // InternalError for internal error InternalError = 1004 // NotLeaderError for not leader error NotLeaderError = 1005 )
Variables ¶
View Source
var StatusInternalError = Status{ Code: InternalError, Message: "internal error", }
StatusInternalError for internal error
View Source
var StatusKeyDuplicate = Status{ Code: KeyDuplicate, Message: "key duplicate", }
StatusKeyDuplicate for key/value duplicate status
View Source
var StatusKeyNotFound = Status{ Code: KeyNotFound, Message: "key not found", }
StatusKeyNotFound for key/value no found status
View Source
var StatusNotLeaderError = Status{ Code: NotLeaderError, Message: "i am not the leader", }
StatusNotLeaderError for params error status
View Source
var StatusOK = Status{ Code: OK, Message: "", }
StatusOK for successful status
View Source
var StatusParamsError = Status{ Code: ParamsError, Message: "params error", }
StatusParamsError for params error status
Functions ¶
This section is empty.
Types ¶
type Store ¶
type Store interface { // Open opens a store in a single mode or not Open(singleMode bool) error // Get returns the value for the given key. Get(key string) (string, error) // Add adds key/value, via distributed consensus. Add(key, value string) error // Join joins the node, reachable at addr, to the cluster. Join(addr string) error // Peers returns the store peers Peers() ([]string, error) // Leader returns the leader address Leader() string // Stats return the stats as a map[string]string Stats() map[string]string }
Store is the interface Raft-backed key-value stores must implement.
Click to show internal directories.
Click to hide internal directories.