dumb

package module
v2.0.2 Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2024 License: MIT Imports: 9 Imported by: 0

README

An incredibly stupid KV lib.

  • main feature is KISS and you can inspect on-disk data
  • utilizes the filesystem heavily, perhaps slow sometimes
  • kv-dir is file locked, protects against accidental double starts
  • caching on/off, pops randomly on startup to ~100%
    • it will stop if a key is broken
  • eviction is totally random when it reaches 75%
  • eviction cleans all when it reaches 100%

Example

func main()
    store, release, err := dumb.New(dumb.Config{
        Path:      "/my/storage/path",
        CacheSize: 3_000_000_000, // in-memory
        Caching:   true,
    })
    defer release()
}

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalidKey = errors.New("invalid key")

Functions

This section is empty.

Types

type Config

type Config struct {
	Path      string
	CacheSize uint64
	Caching   bool
}

type Store

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

func New

func New(conf Config) (*Store, func(), error)

func (*Store) Get

func (s *Store) Get(key string) ([]byte, error)

func (*Store) Remove

func (s *Store) Remove(key string) error

func (*Store) Set

func (s *Store) Set(key string, value []byte) error

Jump to

Keyboard shortcuts

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