Documentation ¶
Overview ¶
package bolt implements operations using Bolt as the underlying database
Index ¶
- type DB
- func (db *DB) Get(bucket, 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(bucket, 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 {
DB *bolt.DB
}
DB is a wrapper with reference to underlying Bolt 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) Put ¶
Put attempts to insert the given key value pair under the provided bucket name. The bucket is created if it doesn't exist.
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 ¶
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.