blob: 90a01c78ba8ed64c46b83a3f723f9506661a4e35 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
package bolt
var (
InvalidBucketError = &Error{"invalid bucket", nil}
)
type bucketid uint32
type Bucket struct {
*bucket
name string
transaction *Transaction
cursors []*Cursor
}
type bucket struct {
id bucketid
flags uint32
root pgid
}
// Get retrieves the value for a key in the bucket.
func (b *Bucket) Get(key []byte) []byte {
return b.cursor().Get(key)
}
// Cursor creates a new cursor for this bucket.
func (b *Bucket) Cursor() *Cursor {
c := b.cursor()
b.cursors = append(b.cursors, c)
return c
}
// cursor creates a new untracked cursor for this bucket.
func (b *Bucket) cursor() *Cursor {
return &Cursor{
bucket: b,
stack: make([]elem, 0),
}
}
|