kvstore

package
v0.0.0-...-6b20bf8 Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2019 License: MIT Imports: 2 Imported by: 0

README

kvstore

The kvstore package provides an interface for operations on a KV store with multiple implementations.

Documentation

Interface

type Store interface {
	Get(key string) ([]byte, error)
	Put(key string, data []byte) error
	Delete(key string) error
}

Implementations

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrCacheMiss = errors.New("kvstore: cache miss")

ErrCacheMiss is returned when a key is not found in the store

Functions

func GetLock

func GetLock(store Store, key string) error

GetLock attempts to get a lock for the key in the given store

func ReleaseLock

func ReleaseLock(store Store, key string) error

ReleaseLock releases the lock for the key in the given store

Types

type Store

type Store interface {
	// Get returns a certificate data for the specified key or error.
	// If there's no such key in the store ErrCacheMiss will be returned
	Get(key string) ([]byte, error)

	// Put stores the data in the store under the specified key.
	// Underlying implementations may use any data storage format,
	// as long as the reverse operation, Get, results in the original data.
	Put(key string, data []byte) error

	// Delete removes data from the store under the specified key.
	// If there's no such key in the store, Delete returns nil.
	Delete(key string) error
}

Store provides an interface for operations on a KV store

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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