aboutsummaryrefslogtreecommitdiff
path: root/meta.go
diff options
context:
space:
mode:
authorBen Johnson <benbjohnson@yahoo.com>2014-01-30 19:26:10 -0800
committerBen Johnson <benbjohnson@yahoo.com>2014-01-30 19:26:10 -0800
commitd05191d164dbab56adbb3a17a62f66a62695c6d3 (patch)
tree3f270655af94ff2dbbce62f6065d4f1c24030c71 /meta.go
parentMerge pull request #2 from benbjohnson/master (diff)
parentAdd RWTransaction.write(). (diff)
downloaddedo-d05191d164dbab56adbb3a17a62f66a62695c6d3.tar.gz
dedo-d05191d164dbab56adbb3a17a62f66a62695c6d3.tar.xz
Merge pull request #3 from benbjohnson/spill
Spill to dirty pages, write to disk
Diffstat (limited to 'meta.go')
-rw-r--r--meta.go14
1 files changed, 13 insertions, 1 deletions
diff --git a/meta.go b/meta.go
index f3bc4b6..659bfa7 100644
--- a/meta.go
+++ b/meta.go
@@ -14,8 +14,8 @@ type meta struct {
pageSize uint32
pgid pgid
free pgid
+ sys pgid
txnid txnid
- sys bucket
}
// validate checks the marker bytes and version of the meta page to ensure it matches this binary.
@@ -30,8 +30,20 @@ func (m *meta) validate() error {
// copy copies one meta object to another.
func (m *meta) copy(dest *meta) {
+ dest.magic = m.magic
+ dest.version = m.version
dest.pageSize = m.pageSize
dest.pgid = m.pgid
+ dest.free = m.free
dest.txnid = m.txnid
dest.sys = m.sys
}
+
+// write writes the meta onto a page.
+func (m *meta) write(p *page) {
+ // Page id is either going to be 0 or 1 which we can determine by the Txn ID.
+ p.id = pgid(m.txnid % 2)
+ p.flags |= p_meta
+
+ m.copy(p.meta())
+}