store

package
v1.16.1 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2019 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package store is an interface for distribute data storage.

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrNotFound is returned when a Read key doesn't exist
	ErrNotFound = errors.New("not found")
)

Functions

func Namespace

func Namespace(n string) options.Option

Namespace offers a way to have multiple isolated stores in the same backend, if supported.

func Nodes

func Nodes(a ...string) options.Option

Nodes is a list of nodes used to back the store

func Prefix

func Prefix(p string) options.Option

Prefix sets a prefix to any key ids used

Types

type Record

type Record struct {
	Key    string
	Value  []byte
	Expiry time.Duration
}

Record represents a data record

type Store

type Store interface {
	// List all the known records
	List() ([]*Record, error)
	// Read records with keys
	Read(key ...string) ([]*Record, error)
	// Write records
	Write(rec ...*Record) error
	// Delete records with keys
	Delete(key ...string) error
}

Store is a data storage interface

Directories

Path Synopsis
Package cloudflare is a store implementation backed by cloudflare workers kv Note that the cloudflare workers KV API is eventually consistent.
Package cloudflare is a store implementation backed by cloudflare workers kv Note that the cloudflare workers KV API is eventually consistent.
Package etcd is an etcd v3 implementation of kv
Package etcd is an etcd v3 implementation of kv
Package memory is a in-memory store store
Package memory is a in-memory store store
Package postgresql implements a micro Store backed by sql
Package postgresql implements a micro Store backed by sql
Package service implements the store service interface
Package service implements the store service interface

Jump to

Keyboard shortcuts

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