aboutsummaryrefslogtreecommitdiff
path: root/tx.go
diff options
context:
space:
mode:
authorPatrick Mezard <patrick@mezard.eu>2015-10-21 10:55:50 +0200
committerPatrick Mezard <patrick@mezard.eu>2015-10-21 10:55:50 +0200
commite05e34c332d4c085119ec8fa881ed5351d1ba962 (patch)
treec2ad79574a3bac06e020a89acbbb0cde1a2cf78d /tx.go
parentMerge pull request #442 from pmezard/mention-address-space-consumption (diff)
downloaddedo-e05e34c332d4c085119ec8fa881ed5351d1ba962.tar.gz
dedo-e05e34c332d4c085119ec8fa881ed5351d1ba962.tar.xz
bucket: document buckets are valid only during the transaction
Issue #313
Diffstat (limited to '')
-rw-r--r--tx.go3
1 files changed, 3 insertions, 0 deletions
diff --git a/tx.go b/tx.go
index cb60149..fe6c287 100644
--- a/tx.go
+++ b/tx.go
@@ -87,18 +87,21 @@ func (tx *Tx) Stats() TxStats {
// Bucket retrieves a bucket by name.
// Returns nil if the bucket does not exist.
+// The bucket instance is only valid for the lifetime of the transaction.
func (tx *Tx) Bucket(name []byte) *Bucket {
return tx.root.Bucket(name)
}
// CreateBucket creates a new bucket.
// Returns an error if the bucket 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 (tx *Tx) CreateBucket(name []byte) (*Bucket, error) {
return tx.root.CreateBucket(name)
}
// CreateBucketIfNotExists creates a new bucket if it doesn't already exist.
// 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 (tx *Tx) CreateBucketIfNotExists(name []byte) (*Bucket, error) {
return tx.root.CreateBucketIfNotExists(name)
}