kvdb

package module
v0.0.0-...-601d287 Latest Latest
Warning

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

Go to latest
Published: Jan 24, 2023 License: MIT Imports: 4 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type KVRecord

type KVRecord struct {
	Key   string
	Value []byte
}

KVRecord represents key-value record in our Store

type Store

type Store struct {
	DB *badger.DB
}

Store represents Badger DB

func NewStore

func NewStore(dir string) (*Store, error)

NewStore create new Store object

func (*Store) Add

func (s *Store) Add(rec KVRecord) error

Add adds give record to the store

func (*Store) AddKeyValue

func (s *Store) AddKeyValue(key, value string) error

Add adds give record to the store

func (*Store) Cleaner

func (s *Store) Cleaner()

StoreCleaner may be run as goroutine to perform Badger GC

func (*Store) Close

func (s *Store) Close()

Close closes KV Store

func (*Store) Delete

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

Delete deletes key entry in our store

func (*Store) Get

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

Get finds record in our store for given key

func (*Store) Records

func (s *Store) Records() []KVRecord

Records returns full list of records in our store

Jump to

Keyboard shortcuts

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