badgerdb

package
v0.1.6 Latest Latest
Warning

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

Go to latest
Published: Aug 3, 2021 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Storage

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

Storage is a struct that saves all necessary information to access the database, in this case just a pointer to the BadgerDB database.

func New

func New(dbPath string) (s *Storage)

New creates a new BadgerDB Storage on disk.

func NewMemory

func NewMemory() (s *Storage)

NewMemory create a new BadgerDB Storage in memory.

func (*Storage) AddKeygroupTrigger

func (s *Storage) AddKeygroupTrigger(kg string, id string, host string) error

AddKeygroupTrigger adds a trigger node to the given keygroup in the badgerdb database.

func (*Storage) Append

func (s *Storage) Append(kg, val string, expiry int) (string, error)

Append appends the item to the specified keygroup by incrementing the latest key by one.

func (*Storage) Close

func (s *Storage) Close() error

Close closes the underlying BadgerDB.

func (*Storage) CreateKeygroup

func (s *Storage) CreateKeygroup(kg string) error

CreateKeygroup creates the given keygroup in the badgerdb database.

func (*Storage) Delete

func (s *Storage) Delete(kg string, id string) error

Delete deletes the item with the specified id from the specified keygroup.

func (*Storage) DeleteKeygroup

func (s *Storage) DeleteKeygroup(kg string) error

DeleteKeygroup deletes the given keygroup from the badgerdb database.

func (*Storage) DeleteKeygroupTrigger

func (s *Storage) DeleteKeygroupTrigger(kg string, id string) error

DeleteKeygroupTrigger removes a trigger node from the given keygroup in the badgerdb database.

func (*Storage) Exists

func (s *Storage) Exists(kg string, id string) bool

Exists checks if the given data item exists in the badgerdb database.

func (*Storage) ExistsKeygroup

func (s *Storage) ExistsKeygroup(kg string) bool

ExistsKeygroup checks if the given keygroup exists in the badgerdb database.

func (*Storage) GetKeygroupTrigger

func (s *Storage) GetKeygroupTrigger(kg string) (map[string]string, error)

GetKeygroupTrigger returns a list of all trigger nodes for the given keygroup in the badgerdb database.

func (*Storage) IDs

func (s *Storage) IDs(kg string) ([]string, error)

IDs returns the keys of all items in the specified keygroup.

func (*Storage) Read

func (s *Storage) Read(kg string, id string) (string, error)

Read returns an item with the specified id from the specified keygroup.

func (*Storage) ReadAll

func (s *Storage) ReadAll(kg string) (map[string]string, error)

ReadAll returns all items in the specified keygroup.

func (*Storage) ReadSome

func (s *Storage) ReadSome(kg, id string, count uint64) (map[string]string, error)

ReadSome returns count number of items in the specified keygroup starting at id.

func (*Storage) Update

func (s *Storage) Update(kg, id, val string, append bool, expiry int) error

Update updates the item with the specified id in the specified keygroup.

Jump to

Keyboard shortcuts

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