gotkv

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2021 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrKeyNotFound = errors.Errorf("key not found")

Functions

func CopyAll

func CopyAll(ctx context.Context, b Builder, it Iterator) error

CopyAll copies all the entries from iterator to builder.

func Get

func Get(ctx context.Context, s Store, x Root, key []byte) ([]byte, error)

func GetF

func GetF(ctx context.Context, s Store, x Root, key []byte, fn func([]byte) error) error

func KeyAfter

func KeyAfter(x []byte) []byte

func Populate

func Populate(ctx context.Context, s Store, x Root, set stores.Set, entryFn func(ent Entry) error) error

Populate adds all blobs reachable from x to set. If an item is in set all of the blobs reachable from it are also assumed to also be in set.

func PrefixEnd

func PrefixEnd(prefix []byte) []byte

func Sync

func Sync(ctx context.Context, dst, src Store, x Root, entryFn func(Entry) error) error

Sync ensures dst has all the data reachable from x.

Types

type Builder

type Builder interface {
	Put(ctx context.Context, key, value []byte) error
	Finish(ctx context.Context) (*Root, error)
}

type Entry

type Entry = ptree.Entry

type ID

type ID = cadata.ID

type Iterator

type Iterator = kvstreams.Iterator

type Operator

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

Operator holds common configuration for operations on gotkv instances. It has nothing to do with the state of a particular gotkv instance. It is NOT analagous to a collection object. It is safe for use by multiple goroutines.

func NewOperator

func NewOperator(opts ...Option) Operator

func (*Operator) AddPrefix

func (o *Operator) AddPrefix(x Root, prefix []byte) Root

func (*Operator) Delete

func (o *Operator) Delete(ctx context.Context, s cadata.Store, x Root, key []byte) (*Root, error)

func (*Operator) DeleteSpan

func (o *Operator) DeleteSpan(ctx context.Context, s cadata.Store, x Root, span Span) (*Root, error)

func (*Operator) Diff

func (o *Operator) Diff(ctx context.Context, s cadata.Store, left, right Root, span Span, fn kvstreams.DiffFn) error

func (*Operator) Filter

func (o *Operator) Filter(ctx context.Context, s cadata.Store, root Root, span Span, fn func(Entry) bool) (*Root, error)

func (*Operator) ForEach

func (o *Operator) ForEach(ctx context.Context, s Store, root Root, span Span, fn func(Entry) error) error

func (*Operator) Get

func (o *Operator) Get(ctx context.Context, s cadata.Store, x Root, key []byte) ([]byte, error)

func (*Operator) GetF

func (o *Operator) GetF(ctx context.Context, s cadata.Store, x Root, key []byte, fn func([]byte) error) error

func (*Operator) MaxKey

func (o *Operator) MaxKey(ctx context.Context, s cadata.Store, x Root, under []byte) ([]byte, error)

func (*Operator) NewBuilder

func (o *Operator) NewBuilder(s Store) Builder

func (*Operator) NewEmpty

func (o *Operator) NewEmpty(ctx context.Context, s cadata.Store) (*Root, error)

func (*Operator) NewIterator

func (o *Operator) NewIterator(s Store, root Root, span Span) Iterator

func (*Operator) Put

func (o *Operator) Put(ctx context.Context, s cadata.Store, x Root, key, value []byte) (*Root, error)

func (*Operator) RemovePrefix

func (o *Operator) RemovePrefix(ctx context.Context, s cadata.Store, x Root, prefix []byte) (*Root, error)

type Option

type Option func(op *Operator)

func WithAverageSize

func WithAverageSize(x int) Option

WithAverageSize sets the average size of blobs made by the operator

func WithDataOperator

func WithDataOperator(ro gdat.Operator) Option

func WithMaxSize

func WithMaxSize(x int) Option

WithMaxSize sets the max size of blobs made by the operator

func WithSeed

func WithSeed(seed *[32]byte) Option

type Ref

type Ref = gdat.Ref

type Root

type Root = ptree.Root

type Span

type Span = ptree.Span

func PrefixSpan

func PrefixSpan(prefix []byte) Span

func SingleKeySpan

func SingleKeySpan(k []byte) Span

func TotalSpan

func TotalSpan() Span

type Store

type Store = cadata.Store

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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