aboutsummaryrefslogtreecommitdiff
path: root/freelist.go
diff options
context:
space:
mode:
Diffstat (limited to 'freelist.go')
-rw-r--r--freelist.go5
1 files changed, 5 insertions, 0 deletions
diff --git a/freelist.go b/freelist.go
index d0b1492..cb58a54 100644
--- a/freelist.go
+++ b/freelist.go
@@ -12,6 +12,11 @@ type freelist struct {
pending map[txid][]pgid
}
+// size returns the size of the page after serialization.
+func (f *freelist) size() int {
+ return pageHeaderSize + (int(unsafe.Sizeof(pgid(0))) * len(f.all()))
+}
+
// all returns a list of all free ids and all pending ids in one sorted list.
func (f *freelist) all() []pgid {
ids := make([]pgid, len(f.ids))