aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDimitri Sokolyuk <demon@dim13.org>2019-01-16 01:36:56 +0100
committerDimitri Sokolyuk <demon@dim13.org>2019-01-16 01:36:56 +0100
commit3743e23f4054d34a03f88105e79521154bc5c3d3 (patch)
tree7173f1220b432c22e91b11800ebb34cc982ac2d4
parentc82c48496bbe78f88396b8634a04fef1c6798476 (diff)
page
-rw-r--r--internal/hash/page.go21
1 files changed, 21 insertions, 0 deletions
diff --git a/internal/hash/page.go b/internal/hash/page.go
new file mode 100644
index 0000000..1044f95
--- /dev/null
+++ b/internal/hash/page.go
@@ -0,0 +1,21 @@
+package hash
+
+/*
+ * routines dealing with a data page
+ *
+ * page format:
+ * ┌───┬────────┬────────┬────────┐
+ * p │ n │ keyoff │ datoff │ keyoff │
+ * ├───┴────┬───┴───┬────┴──┬─────┤
+ * │ datoff │ free │ ptr │ ──> │
+ * ├────────┴───────┴───────┴─────┤
+ * │ F R E E A R E A │
+ * ├──────────────┬───────────────┤
+ * │ <──── ─ ─ ─ │ data │
+ * ├────────┬─────┴────┬──────────┤
+ * │ key │ data │ key │
+ * └────────┴──────────┴──────────┘
+ *
+ * Pointer to the free space is always: p[p[0] + 2]
+ * Amount of free space on the page is: p[p[0] + 1]
+ */