aboutsummaryrefslogtreecommitdiff
path: root/node.go
blob: 7a644598834da0c58de44ada798190132c40172a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
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]
}