kvstreams

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jan 29, 2026 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CopyEntry

func CopyEntry(dst *Entry, src Entry)

CopyEntry copies an entry from src to dst.

func KeyAfter

func KeyAfter(x []byte) []byte

KeyAfter returns the key immediately after x. There will be no key less than the result and greater than x

func PrefixEnd

func PrefixEnd(prefix []byte) []byte

PrefixEnd return the key > all the keys with prefix p, but < any other key

Types

type Entry

type Entry struct {
	Key, Value []byte
}

Entry is a single entry in a stream/tree

func Peek

func Peek(ctx context.Context, it streams.Peekable[Entry]) (*Entry, error)

func (Entry) Clone

func (e Entry) Clone() Entry

Clone makes a copy of Entry where Key and Value do not point to memory overlapping with the original

func (Entry) String

func (e Entry) String() string

type Iterator

type Iterator = streams.Iterator[Entry]

Iterator iterates over entries

e.g.

if err := it.Seek(ctx, key); err != nil {
  return err
}

var ent Entry

for err := it.Next(ctx, &ent); err != EOS; err = it.Next(ctx, &ent) {
  if err != nil {
	   return err
  }
  // use ent here. ent will be valid until the next call to it.Next
}

type Literal

type Literal = streams.Slice[Entry]

Literal is a stream literal, satisfying the Iterator interface. It can be constructed with a slice using NewLiteral

func NewLiteral

func NewLiteral(xs []Entry) *Literal

type Span

type Span = state.ByteSpan

A span of keys [Begin, End) If you want to include a specific end key, use the KeyAfter function. nil is interpretted as no bound, not as a 0 length key. This behaviour is only releveant for End.

func CloneSpan

func CloneSpan(x Span) Span

func PrefixSpan

func PrefixSpan(p []byte) Span

PrefixSpan returns a Span that includes all keys with prefix p

func SingleItemSpan

func SingleItemSpan(x []byte) Span

func TotalSpan

func TotalSpan() Span

Jump to

Keyboard shortcuts

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