Documentation ¶
Overview ¶
package badger implements database operations for BadgerDB
Index ¶
- type DB
- func (db *DB) Get(key []byte) (result []byte, err error)
- func (db *DB) GetNames() (map[string]map[string]bool, error)
- func (db *DB) GetNamesAt(t time.Time) (result map[string]map[string]bool, err error)
- func (db *DB) Put(key, value []byte) error
- func (db *DB) PutNames(names map[string]map[string]bool) error
- func (db *DB) PutNamesAt(names map[string]map[string]bool, t time.Time) error
- func (db *DB) Shutdown() error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DB ¶
type DB struct {
// contains filtered or unexported fields
}
DB is a wrapper with reference to underlying Badger database and implements BlockstackDB operations
func (*DB) Get ¶
Get attempts to return value at given key. If an error occurs, it is returned and the result will be an empty byte slice.
func (*DB) GetNamesAt ¶
GetNamesAt returns set of names across all namespaces at a given day. The time parameter is used as the key, rounded to start of day in UTC format, and converted to Unix epoch time. The result is map[NamespaceName][SetOfNames], using a boolean map for the name set since Go does not have builtin sets. The set of names are stored as gzip compressed bytes, and are uncompressed when retrieved from database.
func (*DB) PutNames ¶
PutNames inserts the set of names for each namespace into the database where the key is the current date rounded to start of day.
func (*DB) PutNamesAt ¶
TODO insert the names per namespace as well, otherwise would always need to grab all names PutNamesAt attempts to insert the set of names for each namespace into the database using the given time as key, rounded to start of day in UTC and converted to Unix epoch time. The set of names are stored as gzip compressed bytes, and are uncompressed when retrieved from database.