db

package
v0.16.4 Latest Latest
Warning

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

Go to latest
Published: May 8, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultDBPath       = ".e-dnevnik.db"  // default BadgerDB folder
	DefaultTTL          = time.Hour * 9000 // a bit more than 1 year TTL
	DefaultDiscardRatio = 0.5              // recommended discard ratio from Badger docs
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Edb

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

Edb holds e-dnevnik structure including Bardger struct.

func New

func New(filePath string) (*Edb, error)

New opens a new database, flagging if the database already preexisting.

func (*Edb) CheckAndFlag

func (db *Edb) CheckAndFlag(bucket, subBucket string, target []string) (bool, error)

CheckAndFlag checks presence of a SHA256(bucket, subBucket, []target) in a KV database, returning if it has been found or not, flagging it for the next time and returning error if encountered.

func (*Edb) Close

func (db *Edb) Close() error

Close closes database, optionally running GC (removing state data from value log file).

func (*Edb) Existing

func (db *Edb) Existing() bool

Existing returns if the database was freshly initialized.

Jump to

Keyboard shortcuts

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