store

package
v0.0.0-...-ff5f600 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 30, 2016 License: BSD-3-Clause Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (

	// KeyExists means the given key already exists in the store.
	ErrKeyExists = verror.Register("v.io/x/ref/services/groups/internal/store.KeyExists", verror.NoRetry, "{1:}{2:} Key exists{:_}")
	// UnknownKey means the given key does not exist in the store.
	ErrUnknownKey = verror.Register("v.io/x/ref/services/groups/internal/store.UnknownKey", verror.NoRetry, "{1:}{2:} Unknown key{:_}")
)

Functions

func NewErrKeyExists

func NewErrKeyExists(ctx *context.T) error

NewErrKeyExists returns an error with the ErrKeyExists ID.

func NewErrUnknownKey

func NewErrUnknownKey(ctx *context.T) error

NewErrUnknownKey returns an error with the ErrUnknownKey ID.

Types

type Store

type Store interface {
	// Get returns the value for the given key (decoding into v).
	// Fails if the given key is unknown (ErrUnknownKey).
	Get(k string, v interface{}) (version string, err error)

	// Insert writes the given value for the given key.
	// Fails if an entry already exists for the given key (ErrKeyExists).
	Insert(k string, v interface{}) error

	// Update writes the given value for the given key.
	// Fails if the given key is unknown (ErrUnknownKey).
	// Fails if version doesn't match (ErrBadVersion).
	Update(k string, v interface{}, version string) error

	// Delete deletes the entry for the given key.
	// Fails if the given key is unknown (ErrUnknownKey).
	// Fails if version doesn't match (ErrBadVersion).
	Delete(k string, version string) error

	// Close closes the store. All subsequent method calls will fail.
	Close() error
}

Store is a key-value store that uses versions for optimistic concurrency control. The versions passed to Update and Delete must come from Get. If in the meantime some client has called Update or Delete on the same key, the version will be stale and the method call will fail.

Note, this API disallows empty versions to simplify implementation. The group server is the only client of this API and always specifies versions.

Directories

Path Synopsis
Package leveldb provides an implementation of the groups server Store interface that uses the levelDB-based syncbase storage layer.
Package leveldb provides an implementation of the groups server Store interface that uses the levelDB-based syncbase storage layer.
Package mem provides a simple, in-memory implementation of server.Store.
Package mem provides a simple, in-memory implementation of server.Store.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL