aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/dedo.go18
1 files changed, 11 insertions, 7 deletions
diff --git a/src/dedo.go b/src/dedo.go
index 580e6a6..7185a98 100644
--- a/src/dedo.go
+++ b/src/dedo.go
@@ -127,6 +127,15 @@ type bucket struct {
sequence uint64 /// monotonically incrementing, used by NextSequence()
}
+type roBucketT struct{
+ ref *bucket
+ snapshot *snapshotT /// the associated snapshot
+ buckets map[string]*roBucketT /// subbucket cache
+ page *page /// inline page reference
+ rootNode *node /// materialized node for the root page
+ nodes map[pgid]*node /// node cache
+}
+
/// Bucket represents a distinct collection of key/value pairs inside the
/// database. Keys aren't unique across different buckets.
type Bucket struct {
@@ -590,13 +599,8 @@ func newBucket(tx *transactionT) Bucket {
}
/// newBucket() returns a new bucket associated with a transaction.
-func newSnapshotBucket(snapshot *snapshotT) Bucket {
- return Bucket{tx: &transactionT{
- db: snapshot.db,
- meta: snapshot.meta,
- root: snapshot.root,
- pages: snapshot.pages,
- }}
+func newSnapshotBucket(snapshot *snapshotT) roBucketT {
+ return roBucketT{snapshot: snapshot}
}
/// Bucket.Cursor() creates a cursor associated with the bucket. The cursor is