versiondb
v1.21.5
Documentation
pkg.go.dev ↗Types
Commitable
type Commitable interface {
// Commit writes all the queued operations to the underlying data structure.
Commit() error
}
Commitable defines the interface that specifies that something may be committed.
Database
type Database struct {
// contains filtered or unexported fields
}
Database implements the Database interface by living on top of another database, writing changes to the underlying database only when commit is called.
New
func New(db database.Database) *Database
New returns a new versioned database
Database.Abort
func (db *Database) Abort()
Abort all changes to the underlying database
Database.Backup
func (db *Database) Backup(w io.Writer, since uint64) (uint64, error)
Database.Close
func (db *Database) Close() error
Database.Commit
func (db *Database) Commit() error
Commit writes all the operations of this database to the underlying database
Database.CommitBatch
func (db *Database) CommitBatch() (database.Batch, error)
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. The returned batch should be written before future calls to this DB unless the batch will never be written.
Database.Compact
func (db *Database) Compact(start, limit []byte) error
Database.Delete
func (db *Database) Delete(key []byte) error
Database.Get
func (db *Database) Get(key []byte) ([]byte, error)
Database.GetDatabase
func (db *Database) GetDatabase() database.Database
GetDatabase returns the underlying database
Database.Has
func (db *Database) Has(key []byte) (bool, error)
Database.HealthCheck
func (db *Database) HealthCheck(ctx context.Context) (interface{}, error)
Database.Load
func (db *Database) Load(r io.Reader) error
Database.NewBatch
func (db *Database) NewBatch() database.Batch
Database.NewIterator
func (db *Database) NewIterator() database.Iterator
Database.NewIteratorWithPrefix
func (db *Database) NewIteratorWithPrefix(prefix []byte) database.Iterator
Database.NewIteratorWithStart
func (db *Database) NewIteratorWithStart(start []byte) database.Iterator
Database.NewIteratorWithStartAndPrefix
func (db *Database) NewIteratorWithStartAndPrefix(start, prefix []byte) database.Iterator
Database.Put
func (db *Database) Put(key, value []byte) error
Database.SetDatabase
func (db *Database) SetDatabase(newDB database.Database) error
SetDatabase changes the underlying database to the specified database
Database.Sync
func (db *Database) Sync() error
Sync implements the database.Syncer interface. It flushes all buffered writes to persistent storage by delegating to the underlying database.
Database.Unwrap
func (db *Database) Unwrap() database.Database
Unwrap returns the underlying database for interface assertions.