Documentation ¶
Index ¶
- func NewLevelDBIterator(iter iterator.Iterator, options *opts.Options) honuiter.Iterator
- type LevelDBEngine
- func (db *LevelDBEngine) Begin(readonly bool) (engine.Transaction, error)
- func (db *LevelDBEngine) Close() error
- func (db *LevelDBEngine) DB() *leveldb.DB
- func (db *LevelDBEngine) Delete(key []byte, options *opts.Options) (err error)
- func (db *LevelDBEngine) Engine() string
- func (db *LevelDBEngine) Get(key []byte, options *opts.Options) (value []byte, err error)
- func (db *LevelDBEngine) Has(key []byte, options *opts.Options) (bool, error)
- func (db *LevelDBEngine) Iter(prefix []byte, options *opts.Options) (i iterator.Iterator, err error)
- func (db *LevelDBEngine) Put(key, value []byte, options *opts.Options) (err error)
- type Transaction
- func (tx *Transaction) Delete(key []byte, options *opts.Options) (err error)
- func (tx *Transaction) Finish() error
- func (tx *Transaction) Get(key []byte, options *opts.Options) (value []byte, err error)
- func (tx *Transaction) Has(key []byte, options *opts.Options) (bool, error)
- func (tx *Transaction) Put(key, value []byte, options *opts.Options) (err error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type LevelDBEngine ¶
LevelDBEngine implements Engine and Store
func Open ¶
func Open(path string, conf config.Config) (_ *LevelDBEngine, err error)
Open a leveldb engine as the backend to the Honu database.
func (*LevelDBEngine) Begin ¶ added in v0.2.2
func (db *LevelDBEngine) Begin(readonly bool) (engine.Transaction, error)
Begin a multi-operation transaction (used primarily for Put and Delete)
func (*LevelDBEngine) Close ¶
func (db *LevelDBEngine) Close() error
Close the database and flush all remaining writes to disk. LevelDB requires a close for graceful shutdown to ensure there is no data loss.
func (*LevelDBEngine) DB ¶ added in v0.2.8
func (db *LevelDBEngine) DB() *leveldb.DB
Returns the underlying database object for direct access by the caller, to enable backups, etc.
func (*LevelDBEngine) Delete ¶
func (db *LevelDBEngine) Delete(key []byte, options *opts.Options) (err error)
Delete the object represented by the key, removing it from the database entirely. This is the Store Delete method which can be used directly without a transaction. It is a unary operation that will lock the database to synchronize it with respect to other transactions. Note that normal Honu deletes Put a tombstone rather than directly deleting data from the database.
func (*LevelDBEngine) Engine ¶
func (db *LevelDBEngine) Engine() string
Returns the name of the engine type.
func (*LevelDBEngine) Get ¶
Get the latest version of the object stored by the key. This is the Store Get method which can be used directly without a transaction. It is a unary operation that will read lock the database.
func (*LevelDBEngine) Put ¶
func (db *LevelDBEngine) Put(key, value []byte, options *opts.Options) (err error)
Put a new value to the specified key and update the version. This is the Store Put method which can be used directly without a transaction. It is a unary operation that will lock the database to synchronize it with respect to other transactions.
type Transaction ¶ added in v0.2.2
type Transaction struct {
// contains filtered or unexported fields
}
Transaction implements Transaction
func (*Transaction) Delete ¶ added in v0.2.2
func (tx *Transaction) Delete(key []byte, options *opts.Options) (err error)
Delete the object represented by the key, removing it from the database entirely. This is the Transaction Delete method which is used by Honu to clean up and vacuum the database or to reset an object back to the first version. Note that normal Honu deletes Put a tombstone rather than directly deleting data from the database.
func (*Transaction) Finish ¶ added in v0.2.2
func (tx *Transaction) Finish() error
Finish a multi-operation transaction
func (*Transaction) Get ¶ added in v0.2.2
Get the latest version of the object stored by the key. This is the Transaction Get method which can be used in either readonly or write modes. This is the preferred mechanism to access the underlying engine.
func (*Transaction) Put ¶ added in v0.2.2
func (tx *Transaction) Put(key, value []byte, options *opts.Options) (err error)
Put a new value to the specified key. This is the Transaction Put method which is used by Honu to ensure consistency across version updates and can only be used in a write transaction.