Documentation ¶
Index ¶
- type Database
- func (db *Database) AbortCommit()
- func (db *Database) Close() error
- func (db *Database) Commit() error
- func (db *Database) CommitBatch() (database.Batch, error)
- func (db *Database) Compact(start, limit []byte) error
- func (db *Database) Delete(key []byte) error
- func (db *Database) EndBatch()
- func (db *Database) Get(key []byte) ([]byte, error)
- func (db *Database) Has(key []byte) (bool, error)
- func (db *Database) NewBatch() database.Batch
- func (db *Database) NewIterator() database.Iterator
- func (db *Database) NewIteratorWithPrefix(prefix []byte) database.Iterator
- func (db *Database) NewIteratorWithStart(start []byte) database.Iterator
- func (db *Database) NewIteratorWithStartAndPrefix(start, prefix []byte) database.Iterator
- func (db *Database) Put(key, value []byte) error
- func (db *Database) StartCommit()
- func (db *Database) Stat(stat string) (string, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Database ¶
type Database struct {
// contains filtered or unexported fields
}
func (*Database) AbortCommit ¶
func (db *Database) AbortCommit()
AbortCommit aborts any operations on the versiondb and sets the [versionEnabled] flag to false.
func (*Database) Commit ¶
Commit writes all the operations in the versiondb to the underlying database and sets the [versionEnabled] flag to false. If StartCommit() was never called, then Commit() is a no-op.
func (*Database) CommitBatch ¶
CommitBatch returns a batch that contains all uncommitted puts/deletes. Calling Write() on the returned batch causes the puts/deletes to be written to the underlying database. If CommitBatch returns a nil error, then it holds onto the lock until EndBatch is called. If a non-nil error is returned, CommitBatch releases the lock, so that EndBatch should not be called. Note: if CommitBatch returns an error, such that it releases the lock, then calling EndBatch immediately will cause a panic.
func (*Database) EndBatch ¶
func (db *Database) EndBatch()
EndBatch sets the [versionEnabled] flag back to false and calls Abort() on the versiondb. EndBatch should be called exactly once following a successful call to CommitBatch. Assumes [db.lock] is still held by the initial call to CommitBatch Note: if CommitBatch returns an error, EndBatch should not be called.
func (*Database) NewIterator ¶
NewIterator implements the database.Database interface
func (*Database) NewIteratorWithPrefix ¶
NewIteratorWithPrefix implements the database.Database interface
func (*Database) NewIteratorWithStart ¶
NewIteratorWithStart implements the database.Database interface
func (*Database) NewIteratorWithStartAndPrefix ¶
NewIteratorWithStartAndPrefix implements the database.Database interface
func (*Database) StartCommit ¶
func (db *Database) StartCommit()
StartCommit sets the [versionEnabled] flag to true, so that all operations are performed on top of the versiondb instead of the underlying database.