aboutsummaryrefslogtreecommitdiff
path: root/db.go
diff options
context:
space:
mode:
authorBen Johnson <benbjohnson@yahoo.com>2014-03-01 09:13:59 -0700
committerBen Johnson <benbjohnson@yahoo.com>2014-03-01 09:13:59 -0700
commita1f43f4d60bf434baebf13b4810e5db4916baec5 (patch)
tree75850081fdb236f37c82d6e8fcd4cde5b81354d8 /db.go
parentMerge branch 'master' of https://github.com/boltdb/bolt (diff)
downloaddedo-a1f43f4d60bf434baebf13b4810e5db4916baec5.tar.gz
dedo-a1f43f4d60bf434baebf13b4810e5db4916baec5.tar.xz
Allow reads of unflushed nodes.
This commit allows cursors to read updated values from within the RWTransaction.
Diffstat (limited to 'db.go')
-rw-r--r--db.go5
1 files changed, 3 insertions, 2 deletions
diff --git a/db.go b/db.go
index 22da2e6..8403afc 100644
--- a/db.go
+++ b/db.go
@@ -304,7 +304,7 @@ func (db *DB) RWTransaction() (*RWTransaction, error) {
}
// Create a transaction associated with the database.
- t := &RWTransaction{nodes: make(map[pgid]*node)}
+ t := &RWTransaction{}
t.init(db)
db.rwtransaction = t
@@ -571,7 +571,8 @@ func (db *DB) Stat() (*Stat, error) {
// page retrieves a page reference from the mmap based on the current page size.
func (db *DB) page(id pgid) *page {
- return (*page)(unsafe.Pointer(&db.data[id*pgid(db.pageSize)]))
+ pos := id*pgid(db.pageSize)
+ return (*page)(unsafe.Pointer(&db.data[pos]))
}
// pageInBuffer retrieves a page reference from a given byte array based on the current page size.