datastore

package
v0.0.0-...-445c7d5 Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2018 License: Apache-2.0 Imports: 2 Imported by: 3

Documentation

Index

Constants

View Source
const (
	ResponseStateCreated = "Created"
	ResponseStateUpdated = "Updated"
	ResponseStateDeleted = "Deleted"
	ResponseStateUnknown = "Unknown"
)

TODO Write comments for states of a Response (e.g. Deleted, Updated, Created).

Variables

This section is empty.

Functions

This section is empty.

Types

type Store

type Store interface {
	// SetPrefix set the prefix to prefix all given keys with.
	SetKeyPrefix(prefix string)

	// Get return a specific key.
	Get(ctx context.Context, key string, opts ...clientv3.OpOption) (*clientv3.GetResponse, error)
	// Put set a key to a specific value.
	Put(ctx context.Context, key string, value string, opts ...clientv3.OpOption) (*clientv3.PutResponse, error)
	// PutTTL set a key to a specific value with a TTL.
	PutTTL(ctx context.Context, key string, value string, ttl int64, opts ...clientv3.OpOption) (*clientv3.PutResponse, error)
	// Delete delete a key value pair.
	Delete(ctx context.Context, key string, opts ...clientv3.OpOption) (*clientv3.DeleteResponse, error)
	// Txn creates a transaction.
	Txn(ctx context.Context) clientv3.Txn

	// Watch watch a key or directory for creation, changes and deletion.
	Watch(ctx context.Context, key string, opts ...clientv3.OpOption) clientv3.WatchChan
	// Close closes the watcher and cancels all watch requests.
	Close() error
}

Store Interface to abstract get, put, del, watch actions to etcd datastore. TODO does it make sense to have different datastores?

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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