Documentation ¶
Overview ¶
Package metakv provides simple KV API to some "metadata store". In current implementation it is metadata store that keeps values in ns_server's ns_config.
Sub-namespace that is under directory "/checkpoints/" is going to be implemented specially. It is intended for xdcr checkpoints and will not be replicated between nodes in first version of this package.
Index ¶
- Variables
- func Add(path string, value []byte) error
- func AddSensitive(path string, value []byte) error
- func Delete(path string, rev interface{}) error
- func ExecuteBasicSanityTest(log func(v ...interface{}))
- func Get(path string) (value []byte, rev interface{}, err error)
- func GoRunDebugEndpoint(listen string)
- func IterateChildren(dirpath string, callback Callback) error
- func RecursiveDelete(dirpath string) error
- func RunObserveChildren(dirpath string, callback Callback, cancel <-chan struct{}) error
- func Set(path string, value []byte, rev interface{}) error
- func SetSensitive(path string, value []byte, rev interface{}) error
- type Callback
- type KVEntry
Constants ¶
This section is empty.
Variables ¶
var ErrRevMismatch = errors.New("Rev mismatch")
ErrRevMismatch error is returned from Set and Delete when there is rev mismatch
var RevCreate = &struct{}{}
RevCreate is a special revision which when passed to Set will change Set to Add.
Functions ¶
func Add ¶
Add creates given kv pair. Which must not exist in storage yet. ErrRevMismatch is returned if pair with such key exists.
func AddSensitive ¶
AddSensitive is Add for storing sensitive info.
func ExecuteBasicSanityTest ¶
func ExecuteBasicSanityTest(log func(v ...interface{}))
ExecuteBasicSanityTest runs basic sanity test.
func Get ¶
Get returns matching value and revision for given key. Returns nil value, nil rev and nil error when given path doesn't exist.
func GoRunDebugEndpoint ¶
func GoRunDebugEndpoint(listen string)
GoRunDebugEndpoint function can be used to run simple http server for "manual" debugging of metakv facility.
func IterateChildren ¶
IterateChildren invokes given callback on every kv-pair that's child of given directory path. Path must end on "/".
func RecursiveDelete ¶
RecursiveDelete deletes all keys that are children of given directory path.
func RunObserveChildren ¶
RunObserveChildren invokes gen callback on every kv-pair that is child of given directory path and then on every mutation of affected keys. Deletions will be signalled by passing nil to value argument of callback. Returns only when cancel channel is closed or when children callback returns error. If exit is due to cancel channel being closed returned error is nil. Otherwise error is non-nil. Path must end on "/".
func Set ¶
Set updates given key-value pair. If non-nil, rev is a form of CAS value used to detect races with concurrent mutators in typical read-modify-write cases. Rev is supposed to be same value that is returned from get.
func SetSensitive ¶
SetSensitive is Set for storing sensitive info.
Types ¶
type KVEntry ¶
KVEntry struct represents kv entry returned from ListAllChildren and used as a parameter in Callback
func ListAllChildren ¶
ListAllChildren returns all child entries of given "directory" node.