diff options
author | Ben Johnson <benbjohnson@yahoo.com> | 2014-01-21 14:37:55 -0700 |
---|---|---|
committer | Ben Johnson <benbjohnson@yahoo.com> | 2014-01-21 15:00:48 -0700 |
commit | bce3e667dff9d6ab51f4e37bc79ef961e36bfb31 (patch) | |
tree | 1ba0fc541a5d729590b9e43a0d9072fe7d027a05 /node.go | |
parent | Refactoring to RWCursor, RWTxn, and branch/leaf nodes and pages. (diff) | |
download | dedo-bce3e667dff9d6ab51f4e37bc79ef961e36bfb31.tar.gz dedo-bce3e667dff9d6ab51f4e37bc79ef961e36bfb31.tar.xz |
Intermediate commit.
Diffstat (limited to 'node.go')
-rw-r--r-- | node.go | 30 |
1 files changed, 30 insertions, 0 deletions
@@ -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] +} |