From c93ba7ca3ec3d3970c8919a6d31845efda71ec27 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Sun, 9 Feb 2025 18:16:29 -0300 Subject: src/dedo.go: Introduce roBucketT type --- src/dedo.go | 18 +++++++++++------- 1 file 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 -- cgit v1.2.3