vermap

package
v0.0.0-...-05bc493 Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const UpdateMask = CanUpdate | CanReplace | CanDelete

Variables

View Source
var (
	ErrInvalidRequest = errors.New("invalid request")
	ErrKeyNotFound    = errors.New("key not found")
	ErrEmptyKey       = errors.New("key cannot be empty")
	ErrExistingKey    = errors.New("existing key")
	ErrInvalidKey     = errors.New("key is restricted")
	ErrConflict       = errors.New("transaction conflict")
	ErrReadOnlyTxn    = errors.New("read-only transaction")
	ErrNoDelete       = errors.New("delete is not allowed")
	ErrDiscardedTxn   = errors.New("transaction has been discarded")
	ErrTxnTooBig      = errors.New("tx is too big")
)

Functions

This section is empty.

Types

type Entry

type Entry struct {
	Key
	Value
	UserMeta uint32
}

func NewByteEntry

func NewByteEntry(key, value []byte) Entry

func NewEntry

func NewEntry(key Key, value Value) Entry

func (Entry) WithMeta

func (e Entry) WithMeta(meta uint32) Entry

type IncrementalMap

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

func (*IncrementalMap) StartUpdate

func (m *IncrementalMap) StartUpdate() TxMap

func (*IncrementalMap) ViewNow

func (m *IncrementalMap) ViewNow() ReadMap

type Key

type Key = longbits.ByteString

type LiveMap

type LiveMap interface {
	//UpdateMap
	ViewNow() ReadMap
	StartUpdate() TxMap
}

type Options

type Options uint32
const (
	CanUpdate Options = 1 << iota
	CanReplace
	CanDelete
)

type ReadMap

type ReadMap interface {
	Get(Key) (Value, error)
	Contains(Key) bool
}

type Tx

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

func (*Tx) Commit

func (t *Tx) Commit() error

func (*Tx) Contains

func (t *Tx) Contains(k Key) bool

func (*Tx) Discard

func (t *Tx) Discard()

func (*Tx) Get

func (t *Tx) Get(k Key) (Value, error)

func (*Tx) GetEntry

func (t *Tx) GetEntry(k Key) (Entry, error)

func (*Tx) Set

func (t *Tx) Set(k Key, v Value) error

func (*Tx) SetEntry

func (t *Tx) SetEntry(kv Entry) error

type TxMap

type TxMap interface {
	UpdateMap

	//GetUpdated(Key) (Value, error)
	Discard()
	Commit() error
}

type UpdateMap

type UpdateMap interface {
	ReadMap
	Set(Key, Value) error
	SetEntry(Entry) error
}

type Value

type Value = []byte

Jump to

Keyboard shortcuts

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