aboutsummaryrefslogtreecommitdiff
path: root/bucket.go
diff options
context:
space:
mode:
authorBen Johnson <benbjohnson@yahoo.com>2015-10-21 09:30:33 -0600
committerBen Johnson <benbjohnson@yahoo.com>2015-10-21 09:30:33 -0600
commit12af751e869acdcc32325a8628b87f0405f9cee9 (patch)
treec2ad79574a3bac06e020a89acbbb0cde1a2cf78d /bucket.go
parentMerge pull request #442 from pmezard/mention-address-space-consumption (diff)
parentbucket: document buckets are valid only during the transaction (diff)
downloaddedo-12af751e869acdcc32325a8628b87f0405f9cee9.tar.gz
dedo-12af751e869acdcc32325a8628b87f0405f9cee9.tar.xz
Merge pull request #444 from pmezard/doc-bucket-lifetime
bucket: document buckets are valid only during the transaction
Diffstat (limited to 'bucket.go')
-rw-r--r--bucket.go3
1 files changed, 3 insertions, 0 deletions
diff --git a/bucket.go b/bucket.go
index 8c3edae..2925288 100644
--- a/bucket.go
+++ b/bucket.go
@@ -99,6 +99,7 @@ func (b *Bucket) Cursor() *Cursor {
// Bucket retrieves a nested bucket by name.
// Returns nil if the bucket does not exist.
+// The bucket instance is only valid for the lifetime of the transaction.
func (b *Bucket) Bucket(name []byte) *Bucket {
if b.buckets != nil {
if child := b.buckets[string(name)]; child != nil {
@@ -148,6 +149,7 @@ func (b *Bucket) openBucket(value []byte) *Bucket {
// CreateBucket creates a new bucket at the given key and returns the new bucket.
// Returns an error if the key already exists, if the bucket name is blank, or if the bucket name is too long.
+// The bucket instance is only valid for the lifetime of the transaction.
func (b *Bucket) CreateBucket(key []byte) (*Bucket, error) {
if b.tx.db == nil {
return nil, ErrTxClosed
@@ -192,6 +194,7 @@ func (b *Bucket) CreateBucket(key []byte) (*Bucket, error) {
// CreateBucketIfNotExists creates a new bucket if it doesn't already exist and returns a reference to it.
// Returns an error if the bucket name is blank, or if the bucket name is too long.
+// The bucket instance is only valid for the lifetime of the transaction.
func (b *Bucket) CreateBucketIfNotExists(key []byte) (*Bucket, error) {
child, err := b.CreateBucket(key)
if err == ErrBucketExists {