Documentation ¶
Overview ¶
Package lokaldb is a wrapper around bbolt key-value database to manage messaging data in a local database Its primary purpose is to be used persist messages if sending queues like NATS fails.
Index ¶
- Variables
- type ChunkData
- type LokalDB
- func (db *LokalDB) Close() error
- func (db *LokalDB) Count(bucket string) (int, error)
- func (db *LokalDB) CutChunkDown(bucket string, max int) ([]ChunkData, error)
- func (db *LokalDB) CutChunkUp(bucket string, max int) ([]ChunkData, error)
- func (db *LokalDB) Delete(bucket string, key string) error
- func (db *LokalDB) DeleteOnce(bucket string, key []string) error
- func (db *LokalDB) Fetch(bucket string, key string) (data []byte, err error)
- func (db *LokalDB) FetchChunkDown(bucket string, max int, offset int) ([]ChunkData, error)
- func (db *LokalDB) FetchChunkUp(bucket string, max int, offset int) ([]ChunkData, error)
- func (db *LokalDB) FetchDelete(bucket string, key string) ([]byte, error)
- func (db *LokalDB) SliceDown(bucket string) (data []byte, err error)
- func (db *LokalDB) SliceUp(bucket string) (data []byte, err error)
- func (db *LokalDB) Store(bucket string, key string, data []byte) error
- func (db *LokalDB) StoreOnce(bucket string, data []ChunkData) error
Constants ¶
This section is empty.
Variables ¶
var ( ErrLocalDatabaseNotYetOpened = errors.New(`local database not yet opened`) ErrCorruptedInternalBucket = errors.New(`empty or corrupted internal bucket`) ErrBucketDoesNotExist = errors.New(`bucket does not exist`) ErrNoKeysSet = errors.New(`no keys set`) )
Errors
Functions ¶
This section is empty.
Types ¶
type ChunkData ¶
ChunkData represents the key-value chunks of data to be used as a result for slices of key-value data
type LokalDB ¶
type LokalDB struct { FileName string // contains filtered or unexported fields }
LokalDB is a wrapper around bbolt key-value database to manage messaging data in a local database
func (*LokalDB) CutChunkDown ¶
CutChunkDown gets a chunk of data starting from top to bottom in ascending order and removes them.
func (*LokalDB) CutChunkUp ¶
CutChunkUp gets a chunk of data starting from bottom to top in descending order and removes them.
func (*LokalDB) DeleteOnce ¶
DeleteOnce remove records in the local database in one go from a supplied provided key.
func (*LokalDB) Fetch ¶
Fetch gets a single record from the local database with the provided key. If the record does not exist, it will return nil.
func (*LokalDB) FetchChunkDown ¶
FetchChunkDown gets a chunk of data starting from the top to bottom limited by max.
func (*LokalDB) FetchChunkUp ¶
FetchChunkUp gets a chunk of data starting from the bottom to top limited by max.
func (*LokalDB) FetchDelete ¶
FetchDelete gets the record with the provided key and deletes it.