kv

package
v0.0.0-...-ab75566 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2022 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type KV

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

KV is an in-memory key/value storage.

func New

func New() *KV

New store

func (*KV) AllCommitted

func (s *KV) AllCommitted() ([]*store.Item, error)

AllCommitted returns all committed items.

func (*KV) AllDirty

func (s *KV) AllDirty() ([]*store.Item, error)

AllDirty returns all uncommitted items.

func (*KV) AllNewerCommitted

func (s *KV) AllNewerCommitted(keyVersions map[string]uint64) ([]*store.Item, error)

AllNewerCommitted returns all committed items who's key is not in keyVersions or who's version is higher than the versions in keyVersions.

func (*KV) AllNewerDirty

func (s *KV) AllNewerDirty(keyVersions map[string]uint64) ([]*store.Item, error)

AllNewerDirty returns all uncommitted items who's key is not in keyVersions or who's version is higher than the versions in keyVersions.

func (*KV) Commit

func (s *KV) Commit(key string, version uint64) error

Commit a version for the given key.

func (*KV) Read

func (s *KV) Read(key string) (*store.Item, error)

Read an item from the store by key. If there is an uncommitted (dirty) version of the item in the store, it returns a ErrDirtystore.Item error. If no item exists for that key it returns a ErrNotFound error.

func (*KV) ReadVersion

func (s *KV) ReadVersion(key string, version uint64) (*store.Item, error)

ReadVersion finds an item for the given key with the matching version. If no item is found for that version of key, ErrNotFound is returned

func (*KV) Write

func (s *KV) Write(key string, val []byte, version uint64) error

Write a new item to the store.

Jump to

Keyboard shortcuts

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