kvstreams

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Jun 18, 2026 License: GPL-3.0 Imports: 6 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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 struct {
	Begin []byte
	End   []byte
}

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

func (Span) AllGt added in v0.4.0

func (s Span) AllGt(x []byte) bool

AllGt returns true if every key in the span is greater than x

func (Span) AllLt added in v0.4.0

func (s Span) AllLt(x []byte) bool

AllLt returns true if every key in the span is less than x

func (Span) Contains added in v0.4.0

func (s Span) Contains(x []byte) bool

Contains returns true if x is in the Span

func (Span) Marshal added in v0.4.0

func (s Span) Marshal(out []byte) []byte

func (*Span) Unmarshal added in v0.4.0

func (s *Span) Unmarshal(data []byte) error

Jump to

Keyboard shortcuts

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