filekv

package module
v0.0.0-...-d996d46 Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2023 License: MIT Imports: 12 Imported by: 0

README

FileKV

Persistent KV storage with atomic CRUD operations.

Usage

Basic usage:


Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FileKV

type FileKV[K comparable, V any] struct {
	// contains filtered or unexported fields
}

FlieKV Generic KV storage

func New

func New[K comparable, V any](directory string, options ...Option) (*FileKV[K, V], error)

func Recover

func Recover[K comparable, V any](directory string, hashFunction func(K) []byte) (*FileKV[K, V], error)

func (*FileKV[K, V]) Create

func (fileKV *FileKV[K, V]) Create(key K, value V) error

func (*FileKV[K, V]) Delete

func (fileKV *FileKV[K, V]) Delete(key K) error

func (*FileKV[K, V]) ForEach

func (fileKV *FileKV[K, V]) ForEach(callbackFunc func(K, V))

func (*FileKV[K, V]) Read

func (fileKV *FileKV[K, V]) Read(key K) (V, error)

func (*FileKV[K, V]) Update

func (fileKV *FileKV[K, V]) Update(key K, updateFunc func(value V) V) error

type Option

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

Option FileKV configuration options

func BucketCount

func BucketCount(count int) Option

BucketCount create a config option for initial bucket count

func HashFunction

func HashFunction[K comparable](hashFunction func(K) []byte) Option

HashFunction create config option for custom hash function

func LoadFactor

func LoadFactor(loadFactor float64) Option

LoadFactor create config option for load factor

Jump to

Keyboard shortcuts

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