mtbl

package module
v0.0.0-...-1cc7d24 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2022 License: Apache-2.0 Imports: 6 Imported by: 0

README

mtbl for go

This cgo module wraps libmtbl (prefer 1.3.0+).

Value merging may still not work as expected and we recommend pre-merging values before creating mtbls with this wrapper.

Install the libmtbl dependencies on Ubuntu 22.04+ with:

sudo apt install libmtbl-dev

The mtbl utilities are useful for verification as well:

sudo apt install mtbl-bin

The original golang-mtbl package did not have an explicit license and was forked under the same license as mtbl itself (Apache License 2.0).

Documentation

Index

Constants

View Source
const COMPRESSION_LZ4 = C.MTBL_COMPRESSION_LZ4
View Source
const COMPRESSION_LZ4HC = C.MTBL_COMPRESSION_LZ4HC
View Source
const COMPRESSION_NONE = C.MTBL_COMPRESSION_NONE
View Source
const COMPRESSION_SNAPPY = C.MTBL_COMPRESSION_SNAPPY
View Source
const COMPRESSION_ZLIB = C.MTBL_COMPRESSION_ZLIB

Variables

This section is empty.

Functions

func Get

func Get(s Source, key []byte) (val []byte, ok bool)

func Write

func Write(s Source, w Writer) (e error)

Types

type Fileset

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

func FilesetInit

func FilesetInit(fname string, fopt *FilesetOptions) (f *Fileset, e error)

func (*Fileset) Destroy

func (f *Fileset) Destroy()

func (*Fileset) String

func (f *Fileset) String() string

type FilesetOptions

type FilesetOptions struct {
	ReloadInterval uint32
	Merge          MergeFunc
	CMerge         unsafe.Pointer
	CMergeData     unsafe.Pointer
}

type Iter

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

func IterAll

func IterAll(s Source) (it *Iter)

func IterPrefix

func IterPrefix(s Source, prefix []byte) (it *Iter)

func IterRange

func IterRange(s Source, key0 []byte, key1 []byte) (it *Iter)

func (*Iter) Destroy

func (it *Iter) Destroy()

func (Iter) Next

func (it Iter) Next() (key []byte, val []byte, ok bool)

func (*Iter) String

func (it *Iter) String() string

type MergeFunc

type MergeFunc func(key []byte, val0 []byte, val1 []byte) (mergedVal []byte)

type Merger

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

func MergerInit

func MergerInit(mopt *MergerOptions) (m *Merger)

func (*Merger) AddSource

func (m *Merger) AddSource(s Source)

func (*Merger) Destroy

func (m *Merger) Destroy()

func (*Merger) String

func (m *Merger) String() string

type MergerOptions

type MergerOptions struct {
	Merge      MergeFunc
	CMerge     unsafe.Pointer
	CMergeData unsafe.Pointer
}

type Reader

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

func ReaderInit

func ReaderInit(fname string, ropt *ReaderOptions) (r *Reader, e error)

func (*Reader) Destroy

func (r *Reader) Destroy()

func (*Reader) String

func (r *Reader) String() string

type ReaderOptions

type ReaderOptions struct {
	VerifyChecksums bool
}

type Sorter

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

func SorterInit

func SorterInit(sopt *SorterOptions) (s *Sorter)

func (*Sorter) Add

func (s *Sorter) Add(key []byte, val []byte) (e error)

func (*Sorter) Destroy

func (s *Sorter) Destroy()

func (*Sorter) String

func (s *Sorter) String() string

func (*Sorter) Write

func (s *Sorter) Write(w *Writer) (e error)

type SorterOptions

type SorterOptions struct {
	TempDir    string
	MaxMemory  uint64
	Merge      MergeFunc
	CMerge     unsafe.Pointer
	CMergeData unsafe.Pointer
}

type Source

type Source interface {
	// contains filtered or unexported methods
}

type Writer

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

func WriterInit

func WriterInit(fname string, wopt *WriterOptions) (w *Writer, e error)

func (*Writer) Add

func (w *Writer) Add(key []byte, val []byte) (e error)

func (*Writer) Destroy

func (w *Writer) Destroy()

func (*Writer) String

func (w *Writer) String() string

type WriterOptions

type WriterOptions struct {
	Compression          int
	BlockSize            int
	BlockRestartInterval int
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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