store

package
v0.0.0-...-a355528 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2017 License: Apache-2.0 Imports: 1 Imported by: 0

README

Store API

  • This API is still evolving. Provided implementations may change. *

The current iteration of the Store API does not define a plugin interface. When the plugin interface is finalized, we expect implementations using different backends to reside in their own git repos.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Visit

func Visit(store KV, tags map[string]string,
	getTags func(interface{}) map[string]string,
	decode func([]byte) (interface{}, error),
	visit func(interface{}) (bool, error)) error

Visit visits all entries matching the tags

Types

type KV

type KV interface {
	io.Closer

	// Write writes the object and returns an id or error.
	Write(key interface{}, value []byte) error
	// Key returns an id given the key. The id contains type, etc.
	Key(key interface{}) string
	// Read loads the object
	Read(key interface{}) ([]byte, error)
	// Exists checks for existence
	Exists(key interface{}) (bool, error)
	// Delete deletes the object by id
	Delete(key interface{}) error
	// Entries returns the entries, unsorted
	Entries() (<-chan Pair, error)
}

KV stores key-value pairs

type Pair

type Pair struct {
	Key   interface{}
	Value []byte
}

Pair is the kv pair

type Snapshot

type Snapshot interface {
	io.Closer

	// Save marshals (encodes) and saves a snapshot of the given object.
	Save(obj interface{}) error

	// Load loads a snapshot and marshals (decodes) into the given reference.
	// If no data is available to unmarshal into the given struct, the fuction returns nil.
	Load(output interface{}) error
}

Snapshot provides means to save and load an object. This is not meant to be a generic k-v store.

Directories

Path Synopsis
etcd
v3

Jump to

Keyboard shortcuts

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