Help us shape the future of Go! Take the 2026 Go Developer Survey

filekv

package module
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2022 License: MIT Imports: 10 Imported by: 3

README

filekv

file based kv store with optional dedupe mechanism via bloom filters (only supports set and scan operations)

Documentation

Index

Constants

View Source
const MaxBufSize = 512 * 1024 * 1024
View Source
const Separator = ";;;"

Variables

This section is empty.

Functions

This section is empty.

Types

type FileDB

type FileDB struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

FileDB - represents a file db implementation

func Open

func Open(options Options) (*FileDB, error)

Open a new file based db

func (*FileDB) Close

func (fdb *FileDB) Close()

Close ...

func (*FileDB) Merge

func (f *FileDB) Merge(items ...interface{}) (uint, error)

func (*FileDB) MergeFile

func (f *FileDB) MergeFile(filename string) (uint, error)

func (*FileDB) MergeReader

func (f *FileDB) MergeReader(reader io.Reader) (uint, error)

func (*FileDB) Process

func (fdb *FileDB) Process() error

Process added files/slices/elements

func (*FileDB) Reset

func (fdb *FileDB) Reset() error

Reset the db

func (*FileDB) Scan

func (fdb *FileDB) Scan(handler func([]byte, []byte) error) error

Scan - iterate over the whole store using the handler function

func (*FileDB) Set

func (fdb *FileDB) Set(k, v []byte) error

func (*FileDB) Size

func (fdb *FileDB) Size() int64

Size - returns the size of the database in bytes

type Options

type Options struct {
	Path     string
	Dedupe   bool
	Compress bool
	MaxItems uint
	FPRatio  float64
	Cleanup  bool
}
var DefaultOptions Options = Options{
	Dedupe:   true,
	Compress: false,
	MaxItems: math.MaxInt32,
	FPRatio:  0.0000001,
	Cleanup:  true,
}

type Stats

type Stats struct {
	NumberOfAddedItems uint
	NumberOfDupedItems uint
	NumberOfItems      uint
}

Jump to

Keyboard shortcuts

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