gotkv

package
v0.0.2 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

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

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)

Get is a convenience function for performing Get without creating an Operator.

func GetF

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

GetF is a convenience function for performing GetF without creating an Operator

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 = ptree.Builder

type Entry

type Entry = kvstreams.Entry

type ID

type ID = cadata.ID

type Iterator

type Iterator = kvstreams.Iterator

type Mutation added in v0.0.2

type Mutation struct {
	Span    Span
	Entries []Entry
}

Mutation represents a declarative change to a Span of entries. The result of applying mutation is that

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) Concat added in v0.0.2

func (o *Operator) Concat(ctx context.Context, s cadata.Store, iters ...kvstreams.Iterator) (*Root, error)

Concat copies data from the iterators in order. If the iterators produce out of order keys concat errors.

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) 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) MaxEntry added in v0.0.2

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

func (*Operator) Mutate added in v0.0.2

func (o *Operator) Mutate(ctx context.Context, s cadata.Store, x Root, mutations ...Mutation) (*Root, error)

Mutate applies a batch of mutations to the tree x.

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 = kvstreams.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