From bce3e667dff9d6ab51f4e37bc79ef961e36bfb31 Mon Sep 17 00:00:00 2001 From: Ben Johnson Date: Tue, 21 Jan 2014 14:37:55 -0700 Subject: Intermediate commit. --- node.go | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 node.go (limited to 'node.go') diff --git a/node.go b/node.go new file mode 100644 index 0000000..7a64459 --- /dev/null +++ b/node.go @@ -0,0 +1,30 @@ +package bolt + +import ( + "unsafe" +) + +// node represents a node on a page. +type node struct { + flags uint16 + keySize uint16 +} + +// leafNode represents a node on a leaf page. +type leafNode struct { + node + dataSize uint32 + data uintptr // Pointer to the beginning of the data. +} + +// branchNode represents a node on a branch page. +type branchNode struct { + node + pgno uint32 + data uintptr // Pointer to the beginning of the data. +} + +// key returns a byte slice that of the key data. +func (n *leafNode) key() []byte { + return (*[MaxKeySize]byte)(unsafe.Pointer(&n.data))[:n.keySize] +} -- cgit v1.2.3