trie_test

package
v0.6.1-alpha.10 Latest Latest
Warning

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

Go to latest
Published: Apr 14, 2023 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BinaryStreamFileIterator

type BinaryStreamFileIterator struct {
	*BinaryStreamIterator
	// contains filtered or unexported fields
}

func OpenKVStreamFile

func OpenKVStreamFile(fname string) (*BinaryStreamFileIterator, error)

OpenKVStreamFile opens existing file with key/value stream for reading

func (*BinaryStreamFileIterator) Close

func (fs *BinaryStreamFileIterator) Close() error

type BinaryStreamFileWriter

type BinaryStreamFileWriter struct {
	*BinaryStreamWriter
	// contains filtered or unexported fields
}

func CreateKVStreamFile

func CreateKVStreamFile(fname string) (*BinaryStreamFileWriter, error)

CreateKVStreamFile create a new BinaryStreamFileWriter

func (*BinaryStreamFileWriter) Close

func (fw *BinaryStreamFileWriter) Close() error

type BinaryStreamIterator

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

func NewBinaryStreamIterator

func NewBinaryStreamIterator(r io.Reader) *BinaryStreamIterator

func (BinaryStreamIterator) Iterate

func (b BinaryStreamIterator) Iterate(fun func(k []byte, v []byte) bool) error

type BinaryStreamWriter

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

func NewBinaryStreamWriter

func NewBinaryStreamWriter(w io.Writer) *BinaryStreamWriter

func (*BinaryStreamWriter) Stats

func (b *BinaryStreamWriter) Stats() (int, int)

func (*BinaryStreamWriter) Write

func (b *BinaryStreamWriter) Write(key, value []byte) error

type InMemoryKVStore

type InMemoryKVStore map[string][]byte

func NewInMemoryKVStore

func NewInMemoryKVStore() InMemoryKVStore

func (InMemoryKVStore) Get

func (im InMemoryKVStore) Get(k []byte) []byte

func (InMemoryKVStore) Has

func (im InMemoryKVStore) Has(k []byte) bool

func (InMemoryKVStore) Iterate

func (im InMemoryKVStore) Iterate(f func(k []byte, v []byte) bool)

func (InMemoryKVStore) IterateKeys

func (im InMemoryKVStore) IterateKeys(f func(k []byte) bool)

func (InMemoryKVStore) Iterator

func (im InMemoryKVStore) Iterator(prefix []byte) trie.KVIterator

func (InMemoryKVStore) Set

func (im InMemoryKVStore) Set(k, v []byte)

type KVStreamIterator

type KVStreamIterator interface {
	Iterate(func(k, v []byte) bool) error
}

KVStreamIterator is an interface to iterate stream In general, order is non-deterministic

type KVStreamWriter

type KVStreamWriter interface {
	// Write writes key/value pair
	Write(key, value []byte) error
	// Stats return num k/v pairs and num bytes so far
	Stats() (int, int)
}

KVStreamWriter represents an interface to write a sequence of key/value pairs

type PseudoRandStreamIterator

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

func NewPseudoRandStreamIterator

func NewPseudoRandStreamIterator(p ...PseudoRandStreamParams) *PseudoRandStreamIterator

func (*PseudoRandStreamIterator) Iterate

func (r *PseudoRandStreamIterator) Iterate(fun func(k []byte, v []byte) bool) error

type PseudoRandStreamParams

type PseudoRandStreamParams struct {
	// Seed for deterministic randomization
	Seed int64
	// NumKVPairs maximum number of key value pairs to generate. 0 means infinite
	NumKVPairs int
	// MaxKey maximum length of key (randomly generated)
	MaxKey int
	// MaxValue maximum length of value (randomly generated)
	MaxValue int
}

PseudoRandStreamParams represents parameters of the RandStreamIterator

Jump to

Keyboard shortcuts

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