Documentation ¶
Index ¶
- type BoltDB
- func (db *BoltDB) Clear(bucket []byte) error
- func (db *BoltDB) Close() error
- func (db *BoltDB) Delete(bucket []byte, key []byte) error
- func (db *BoltDB) DoesKeyExist(bucket, key []byte) (bool, error)
- func (db *BoltDB) Get(bucket []byte, key []byte, destination interfaces.BinaryMarshallable) (interfaces.BinaryMarshallable, error)
- func (db *BoltDB) GetAll(bucket []byte, sample interfaces.BinaryMarshallableAndCopyable) ([]interfaces.BinaryMarshallableAndCopyable, [][]byte, error)
- func (db *BoltDB) Init(bucketList [][]byte, filename string)
- func (db *BoltDB) ListAllBuckets() ([][]byte, error)
- func (db *BoltDB) ListAllKeys(bucket []byte) (keys [][]byte, err error)
- func (db *BoltDB) Put(bucket []byte, key []byte, data interfaces.BinaryMarshallable) error
- func (db *BoltDB) PutInBatch(records []interfaces.Record) error
- func (db *BoltDB) Trim()
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BoltDB ¶
This database stores and retrieves interfaces.IBlock instances. To do that, it needs a list of buckets that the using function wants, so it can make sure all those buckets exist. (Avoids checking and building buckets in every write).
It also needs a map of a hash to a interfaces.IBlock instance. To support this, every block needs to be able to give the database a Hash for its type. This has to match the reverse, where looking up the hash gives the database the type for the hash. This way, the database can marshal and unmarshal interfaces.IBlocks for storage in the database. And since the interfaces.IBlocks can provide the hash, we don't need two maps. Just the Hash to the interfaces.IBlock.
Lastly it needs a filename with a full path. If none is specified, it will use "/tmp/bolt_my.db". Not the best idea to let this code default.
func NewAndCreateBoltDB ¶
func (*BoltDB) Get ¶
func (db *BoltDB) Get(bucket []byte, key []byte, destination interfaces.BinaryMarshallable) (interfaces.BinaryMarshallable, error)
func (*BoltDB) GetAll ¶
func (db *BoltDB) GetAll(bucket []byte, sample interfaces.BinaryMarshallableAndCopyable) ([]interfaces.BinaryMarshallableAndCopyable, [][]byte, error)
func (*BoltDB) Init ¶
We have to make accommodation for many Init functions. But what we really want here is:
Init(bucketList [][]byte, filename string)
func (*BoltDB) ListAllBuckets ¶
func (*BoltDB) ListAllKeys ¶
func (*BoltDB) Put ¶
func (db *BoltDB) Put(bucket []byte, key []byte, data interfaces.BinaryMarshallable) error
func (*BoltDB) PutInBatch ¶
func (db *BoltDB) PutInBatch(records []interfaces.Record) error