options

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: May 4, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type IteratorOption

type IteratorOption interface {
	// ApplyKV applies option to the KV iterator. Implementation may wrap or replace the iterator.
	ApplyKV(it kv.Iterator) kv.Iterator
	// ApplyFlat option to the flat KV iterator. Implementation may wrap or replace the iterator.
	ApplyFlat(it flat.Iterator) flat.Iterator
}

IteratorOption is an additional option that affects iterator behaviour.

Implementations in generic KV package should assert for an optimized version of option (via interface assertion), and fallback to generic implementation if the store doesn't support this option natively.

func WithPrefixFlat

func WithPrefixFlat(pref flat.Key) IteratorOption

WithPrefixFlat returns IteratorOption that limits scanned key to a given binary prefix. Store implementations can optimize this by implementing flat.PrefixIterator.

func WithPrefixKV

func WithPrefixKV(pref kv.Key) IteratorOption

WithPrefixKV returns IteratorOption that limits scanned key to a given binary prefix. Store implementations can optimize this by implementing kv.PrefixIterator.

type PrefixFlat

type PrefixFlat struct {
	Pref flat.Key
}

PrefixFlat implements IteratorOption. See WithPrefixFlat.

func (PrefixFlat) ApplyFlat

func (opt PrefixFlat) ApplyFlat(it flat.Iterator) flat.Iterator

func (PrefixFlat) ApplyKV

func (opt PrefixFlat) ApplyKV(it kv.Iterator) kv.Iterator

type PrefixKV

type PrefixKV struct {
	Pref kv.Key
}

PrefixKV implements IteratorOption. See WithPrefixKV.

func (PrefixKV) ApplyFlat

func (opt PrefixKV) ApplyFlat(it flat.Iterator) flat.Iterator

func (PrefixKV) ApplyKV

func (opt PrefixKV) ApplyKV(it kv.Iterator) kv.Iterator

Jump to

Keyboard shortcuts

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