aboutsummaryrefslogtreecommitdiff
path: root/db.go
diff options
context:
space:
mode:
authorBen Johnson <benbjohnson@yahoo.com>2014-01-30 00:11:46 -0500
committerBen Johnson <benbjohnson@yahoo.com>2014-01-30 00:11:46 -0500
commit149d48fb9e3e8147cf0bce84a4e11164ac9cdbf3 (patch)
tree2616c762651a8e516e348c3741d502a1f68ffd16 /db.go
parentAdd freelist page type. (diff)
downloaddedo-149d48fb9e3e8147cf0bce84a4e11164ac9cdbf3.tar.gz
dedo-149d48fb9e3e8147cf0bce84a4e11164ac9cdbf3.tar.xz
Fix leaf/branch deserialization.
Diffstat (limited to 'db.go')
-rw-r--r--db.go13
1 files changed, 8 insertions, 5 deletions
diff --git a/db.go b/db.go
index a29b517..578a134 100644
--- a/db.go
+++ b/db.go
@@ -158,19 +158,19 @@ func (db *DB) init() error {
m.version = Version
m.pageSize = uint32(db.pageSize)
m.version = Version
- m.free = 3
- m.sys.root = 4
+ m.free = 2
+ m.sys.root = 3
}
// Write an empty freelist at page 3.
p := db.pageInBuffer(buf[:], pgid(2))
- p.id = pgid(3)
+ p.id = pgid(2)
p.flags = p_freelist
p.count = 0
// Write an empty leaf page at page 4.
p = db.pageInBuffer(buf[:], pgid(3))
- p.id = pgid(4)
+ p.id = pgid(3)
p.flags = p_leaf
p.count = 0
@@ -226,7 +226,10 @@ func (db *DB) RWTransaction() (*RWTransaction, error) {
}
// Create a transaction associated with the database.
- t := &RWTransaction{}
+ t := &RWTransaction{
+ branches: make(map[pgid]*branch),
+ leafs: make(map[pgid]*leaf),
+ }
t.init(db, db.meta())
return t, nil