kvdb

package
v0.0.0-...-b5a3e81 Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2024 License: ISC Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

Module Module

Functions

This section is empty.

Types

type KVStore

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

KVStore provides k/v Insert/Get/Update/Delete interface

func NewKVStore

func NewKVStore(conf *config.Config) *KVStore

NewKVStore creates a kv db

func (*KVStore) Close

func (s *KVStore) Close()

Close closes the db

func (*KVStore) CreateTableIfNotExist

func (s *KVStore) CreateTableIfNotExist(table string) error

CreateTableIfNotExist creates a table if it doesn't exist nothing will happen if the table has existed Thread-Safe

func (*KVStore) DeleteKey

func (s *KVStore) DeleteKey(table, key string) error

DeleteKey deletes key from table Thread-Safe

func (*KVStore) DeleteTable

func (s *KVStore) DeleteTable(table string) error

DeleteTable deletes a table Returns an error if the table cannot be found or if the key represents a non-table value. Thread-Safe

func (*KVStore) Find

func (s *KVStore) Find(table, k string) ([]string, error)

Find query the values with prefix k in table Thread-Safe

func (*KVStore) Get

func (s *KVStore) Get(table, k string) ([]byte, error)

Get gets the value of k in table Thread-Safe

func (*KVStore) HasTable

func (s *KVStore) HasTable(table string) bool

HasTable checks whether a table exists

func (*KVStore) Open

func (s *KVStore) Open() error

Open opens the store. KV DB must be opened before it is used.

func (*KVStore) Put

func (s *KVStore) Put(table, k string, v []byte) error

Put Put Insert k/v in table Thread Safe

func (*KVStore) RemoveDB

func (s *KVStore) RemoveDB() error

RemoveDB will clear the database source file

func (*KVStore) RemoveSmallValues

func (s *KVStore) RemoveSmallValues(table, value string) error

RemoveSmallValues remove the smaller key/value store comparing with specified value

type KeyError

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

KeyError will be thrown when queried key not found

func (*KeyError) Error

func (ke *KeyError) Error() string

Error Error

type TableError

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

TableError will be thrown when query table not found

func (*TableError) Error

func (te *TableError) Error() string

Error Error

Jump to

Keyboard shortcuts

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