mirror of
https://github.com/LBRYFoundation/lbcwallet.git
synced 2025-08-23 17:47:29 +00:00
walletdb/bdb: update interface implementation godoc
Recently the Bucket and Tx interfaces were split into Read and ReadWrite versions. This commit updates the godoc for the bdb interface implementation to be consistent with this change.
This commit is contained in:
parent
b51c1adeee
commit
b688a6d891
1 changed files with 16 additions and 16 deletions
|
@ -86,7 +86,7 @@ func (tx *transaction) DeleteTopLevelBucket(key []byte) error {
|
||||||
// Commit commits all changes that have been made through the root bucket and
|
// Commit commits all changes that have been made through the root bucket and
|
||||||
// all of its sub-buckets to persistent storage.
|
// all of its sub-buckets to persistent storage.
|
||||||
//
|
//
|
||||||
// This function is part of the walletdb.Tx interface implementation.
|
// This function is part of the walletdb.ReadWriteTx interface implementation.
|
||||||
func (tx *transaction) Commit() error {
|
func (tx *transaction) Commit() error {
|
||||||
return convertErr(tx.boltTx.Commit())
|
return convertErr(tx.boltTx.Commit())
|
||||||
}
|
}
|
||||||
|
@ -94,7 +94,7 @@ func (tx *transaction) Commit() error {
|
||||||
// Rollback undoes all changes that have been made to the root bucket and all of
|
// Rollback undoes all changes that have been made to the root bucket and all of
|
||||||
// its sub-buckets.
|
// its sub-buckets.
|
||||||
//
|
//
|
||||||
// This function is part of the walletdb.Tx interface implementation.
|
// This function is part of the walletdb.ReadTx interface implementation.
|
||||||
func (tx *transaction) Rollback() error {
|
func (tx *transaction) Rollback() error {
|
||||||
return convertErr(tx.boltTx.Rollback())
|
return convertErr(tx.boltTx.Rollback())
|
||||||
}
|
}
|
||||||
|
@ -128,7 +128,7 @@ func (b *bucket) NestedReadBucket(key []byte) walletdb.ReadBucket {
|
||||||
// if the key is empty, or ErrIncompatibleValue if the key value is otherwise
|
// if the key is empty, or ErrIncompatibleValue if the key value is otherwise
|
||||||
// invalid.
|
// invalid.
|
||||||
//
|
//
|
||||||
// This function is part of the walletdb.Bucket interface implementation.
|
// This function is part of the walletdb.ReadWriteBucket interface implementation.
|
||||||
func (b *bucket) CreateBucket(key []byte) (walletdb.ReadWriteBucket, error) {
|
func (b *bucket) CreateBucket(key []byte) (walletdb.ReadWriteBucket, error) {
|
||||||
boltBucket, err := (*bbolt.Bucket)(b).CreateBucket(key)
|
boltBucket, err := (*bbolt.Bucket)(b).CreateBucket(key)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -141,7 +141,7 @@ func (b *bucket) CreateBucket(key []byte) (walletdb.ReadWriteBucket, error) {
|
||||||
// given key if it does not already exist. Returns ErrBucketNameRequired if the
|
// given key if it does not already exist. Returns ErrBucketNameRequired if the
|
||||||
// key is empty or ErrIncompatibleValue if the key value is otherwise invalid.
|
// key is empty or ErrIncompatibleValue if the key value is otherwise invalid.
|
||||||
//
|
//
|
||||||
// This function is part of the walletdb.Bucket interface implementation.
|
// This function is part of the walletdb.ReadWriteBucket interface implementation.
|
||||||
func (b *bucket) CreateBucketIfNotExists(key []byte) (walletdb.ReadWriteBucket, error) {
|
func (b *bucket) CreateBucketIfNotExists(key []byte) (walletdb.ReadWriteBucket, error) {
|
||||||
boltBucket, err := (*bbolt.Bucket)(b).CreateBucketIfNotExists(key)
|
boltBucket, err := (*bbolt.Bucket)(b).CreateBucketIfNotExists(key)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -154,7 +154,7 @@ func (b *bucket) CreateBucketIfNotExists(key []byte) (walletdb.ReadWriteBucket,
|
||||||
// ErrTxNotWritable if attempted against a read-only transaction and
|
// ErrTxNotWritable if attempted against a read-only transaction and
|
||||||
// ErrBucketNotFound if the specified bucket does not exist.
|
// ErrBucketNotFound if the specified bucket does not exist.
|
||||||
//
|
//
|
||||||
// This function is part of the walletdb.Bucket interface implementation.
|
// This function is part of the walletdb.ReadWriteBucket interface implementation.
|
||||||
func (b *bucket) DeleteNestedBucket(key []byte) error {
|
func (b *bucket) DeleteNestedBucket(key []byte) error {
|
||||||
return convertErr((*bbolt.Bucket)(b).DeleteBucket(key))
|
return convertErr((*bbolt.Bucket)(b).DeleteBucket(key))
|
||||||
}
|
}
|
||||||
|
@ -167,7 +167,7 @@ func (b *bucket) DeleteNestedBucket(key []byte) error {
|
||||||
// transaction. Attempting to access them after a transaction has ended will
|
// transaction. Attempting to access them after a transaction has ended will
|
||||||
// likely result in an access violation.
|
// likely result in an access violation.
|
||||||
//
|
//
|
||||||
// This function is part of the walletdb.Bucket interface implementation.
|
// This function is part of the walletdb.ReadBucket interface implementation.
|
||||||
func (b *bucket) ForEach(fn func(k, v []byte) error) error {
|
func (b *bucket) ForEach(fn func(k, v []byte) error) error {
|
||||||
return convertErr((*bbolt.Bucket)(b).ForEach(fn))
|
return convertErr((*bbolt.Bucket)(b).ForEach(fn))
|
||||||
}
|
}
|
||||||
|
@ -176,7 +176,7 @@ func (b *bucket) ForEach(fn func(k, v []byte) error) error {
|
||||||
// already exist are added and keys that already exist are overwritten. Returns
|
// already exist are added and keys that already exist are overwritten. Returns
|
||||||
// ErrTxNotWritable if attempted against a read-only transaction.
|
// ErrTxNotWritable if attempted against a read-only transaction.
|
||||||
//
|
//
|
||||||
// This function is part of the walletdb.Bucket interface implementation.
|
// This function is part of the walletdb.ReadWriteBucket interface implementation.
|
||||||
func (b *bucket) Put(key, value []byte) error {
|
func (b *bucket) Put(key, value []byte) error {
|
||||||
return convertErr((*bbolt.Bucket)(b).Put(key, value))
|
return convertErr((*bbolt.Bucket)(b).Put(key, value))
|
||||||
}
|
}
|
||||||
|
@ -188,7 +188,7 @@ func (b *bucket) Put(key, value []byte) error {
|
||||||
// transaction. Attempting to access it after a transaction has ended
|
// transaction. Attempting to access it after a transaction has ended
|
||||||
// will likely result in an access violation.
|
// will likely result in an access violation.
|
||||||
//
|
//
|
||||||
// This function is part of the walletdb.Bucket interface implementation.
|
// This function is part of the walletdb.ReadBucket interface implementation.
|
||||||
func (b *bucket) Get(key []byte) []byte {
|
func (b *bucket) Get(key []byte) []byte {
|
||||||
return (*bbolt.Bucket)(b).Get(key)
|
return (*bbolt.Bucket)(b).Get(key)
|
||||||
}
|
}
|
||||||
|
@ -197,7 +197,7 @@ func (b *bucket) Get(key []byte) []byte {
|
||||||
// not exist does not return an error. Returns ErrTxNotWritable if attempted
|
// not exist does not return an error. Returns ErrTxNotWritable if attempted
|
||||||
// against a read-only transaction.
|
// against a read-only transaction.
|
||||||
//
|
//
|
||||||
// This function is part of the walletdb.Bucket interface implementation.
|
// This function is part of the walletdb.ReadWriteBucket interface implementation.
|
||||||
func (b *bucket) Delete(key []byte) error {
|
func (b *bucket) Delete(key []byte) error {
|
||||||
return convertErr((*bbolt.Bucket)(b).Delete(key))
|
return convertErr((*bbolt.Bucket)(b).Delete(key))
|
||||||
}
|
}
|
||||||
|
@ -209,7 +209,7 @@ func (b *bucket) ReadCursor() walletdb.ReadCursor {
|
||||||
// ReadWriteCursor returns a new cursor, allowing for iteration over the bucket's
|
// ReadWriteCursor returns a new cursor, allowing for iteration over the bucket's
|
||||||
// key/value pairs and nested buckets in forward or backward order.
|
// key/value pairs and nested buckets in forward or backward order.
|
||||||
//
|
//
|
||||||
// This function is part of the walletdb.Bucket interface implementation.
|
// This function is part of the walletdb.ReadWriteBucket interface implementation.
|
||||||
func (b *bucket) ReadWriteCursor() walletdb.ReadWriteCursor {
|
func (b *bucket) ReadWriteCursor() walletdb.ReadWriteCursor {
|
||||||
return (*cursor)((*bbolt.Bucket)(b).Cursor())
|
return (*cursor)((*bbolt.Bucket)(b).Cursor())
|
||||||
}
|
}
|
||||||
|
@ -228,35 +228,35 @@ type cursor bbolt.Cursor
|
||||||
// transaction, or ErrIncompatibleValue if attempted when the cursor points to a
|
// transaction, or ErrIncompatibleValue if attempted when the cursor points to a
|
||||||
// nested bucket.
|
// nested bucket.
|
||||||
//
|
//
|
||||||
// This function is part of the walletdb.Cursor interface implementation.
|
// This function is part of the walletdb.ReadWriteCursor interface implementation.
|
||||||
func (c *cursor) Delete() error {
|
func (c *cursor) Delete() error {
|
||||||
return convertErr((*bbolt.Cursor)(c).Delete())
|
return convertErr((*bbolt.Cursor)(c).Delete())
|
||||||
}
|
}
|
||||||
|
|
||||||
// First positions the cursor at the first key/value pair and returns the pair.
|
// First positions the cursor at the first key/value pair and returns the pair.
|
||||||
//
|
//
|
||||||
// This function is part of the walletdb.Cursor interface implementation.
|
// This function is part of the walletdb.ReadCursor interface implementation.
|
||||||
func (c *cursor) First() (key, value []byte) {
|
func (c *cursor) First() (key, value []byte) {
|
||||||
return (*bbolt.Cursor)(c).First()
|
return (*bbolt.Cursor)(c).First()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Last positions the cursor at the last key/value pair and returns the pair.
|
// Last positions the cursor at the last key/value pair and returns the pair.
|
||||||
//
|
//
|
||||||
// This function is part of the walletdb.Cursor interface implementation.
|
// This function is part of the walletdb.ReadCursor interface implementation.
|
||||||
func (c *cursor) Last() (key, value []byte) {
|
func (c *cursor) Last() (key, value []byte) {
|
||||||
return (*bbolt.Cursor)(c).Last()
|
return (*bbolt.Cursor)(c).Last()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Next moves the cursor one key/value pair forward and returns the new pair.
|
// Next moves the cursor one key/value pair forward and returns the new pair.
|
||||||
//
|
//
|
||||||
// This function is part of the walletdb.Cursor interface implementation.
|
// This function is part of the walletdb.ReadCursor interface implementation.
|
||||||
func (c *cursor) Next() (key, value []byte) {
|
func (c *cursor) Next() (key, value []byte) {
|
||||||
return (*bbolt.Cursor)(c).Next()
|
return (*bbolt.Cursor)(c).Next()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Prev moves the cursor one key/value pair backward and returns the new pair.
|
// Prev moves the cursor one key/value pair backward and returns the new pair.
|
||||||
//
|
//
|
||||||
// This function is part of the walletdb.Cursor interface implementation.
|
// This function is part of the walletdb.ReadCursor interface implementation.
|
||||||
func (c *cursor) Prev() (key, value []byte) {
|
func (c *cursor) Prev() (key, value []byte) {
|
||||||
return (*bbolt.Cursor)(c).Prev()
|
return (*bbolt.Cursor)(c).Prev()
|
||||||
}
|
}
|
||||||
|
@ -264,7 +264,7 @@ func (c *cursor) Prev() (key, value []byte) {
|
||||||
// Seek positions the cursor at the passed seek key. If the key does not exist,
|
// Seek positions the cursor at the passed seek key. If the key does not exist,
|
||||||
// the cursor is moved to the next key after seek. Returns the new pair.
|
// the cursor is moved to the next key after seek. Returns the new pair.
|
||||||
//
|
//
|
||||||
// This function is part of the walletdb.Cursor interface implementation.
|
// This function is part of the walletdb.ReadCursor interface implementation.
|
||||||
func (c *cursor) Seek(seek []byte) (key, value []byte) {
|
func (c *cursor) Seek(seek []byte) (key, value []byte) {
|
||||||
return (*bbolt.Cursor)(c).Seek(seek)
|
return (*bbolt.Cursor)(c).Seek(seek)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue