store

package
v0.0.0-...-caa851c Latest Latest
Warning

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

Go to latest
Published: Jun 21, 2021 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrKeyNotFound error = store.ErrKeyNotFound

Functions

This section is empty.

Types

type Backend

type Backend store.Backend

type Entry

type Entry struct {
	Type    string
	Ttl     uint32
	Payload string
}

type LibKVStore

type LibKVStore struct {
	// contains filtered or unexported fields
}

func (LibKVStore) AtomicPut

func (s LibKVStore) AtomicPut(key string, value []byte, previous Pair, options *WriteOptions) (bool, Pair, error)

func (LibKVStore) Get

func (s LibKVStore) Get(key string) (Pair, error)

func (LibKVStore) List

func (s LibKVStore) List(directory string) (result []Pair, err error)

func (LibKVStore) Put

func (s LibKVStore) Put(key string, value []byte, options *WriteOptions) error

type MockStore

type MockStore struct {
	GetFunc       func(string) (Pair, error)
	PutFunc       func(key string, value []byte, options *WriteOptions) error
	ListFunc      func(directory string) ([]Pair, error)
	AtomicPutFunc func(key string, value []byte, previous Pair, options *WriteOptions) (bool, Pair, error)
}

func (MockStore) AtomicPut

func (kv MockStore) AtomicPut(key string, value []byte, previous Pair, options *WriteOptions) (bool, Pair, error)

func (MockStore) Get

func (kv MockStore) Get(key string) (Pair, error)

func (MockStore) List

func (kv MockStore) List(directory string) ([]Pair, error)

func (MockStore) Put

func (kv MockStore) Put(key string, value []byte, options *WriteOptions) error

type Pair

type Pair interface {
	Key() string
	Value() []byte
	LastIndex() uint64
}

func NewPair

func NewPair(key string, value []byte, lastIndex uint64) (pair Pair)

type PairImpl

type PairImpl struct {
	// contains filtered or unexported fields
}

func (*PairImpl) Key

func (p *PairImpl) Key() string

func (*PairImpl) LastIndex

func (p *PairImpl) LastIndex() uint64

func (*PairImpl) Value

func (p *PairImpl) Value() []byte

type Query

type Query struct {
	Name string
	Type string
}

type Store

type Store interface {
	Get(key string) (Pair, error)
	Put(key string, value []byte, options *WriteOptions) error
	List(directory string) ([]Pair, error)
	AtomicPut(key string, value []byte, previous Pair, options *WriteOptions) (bool, Pair, error)
}

func NewLibKVStore

func NewLibKVStore(kvBackend string, kvAddress []string) (Store, error)

type WriteOptions

type WriteOptions store.WriteOptions

Jump to

Keyboard shortcuts

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