blob: d272e93e4e88a3f597f3d9dfe69d50e70ad4d4ba (
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
|
package bolt
import (
"unsafe"
)
// bnode represents a node on a branch page.
type bnode struct {
flags uint16
keySize uint16
pgid pgid
data uintptr // Pointer to the beginning of the data.
}
// key returns a byte slice that of the key data.
func (n *bnode) key() []byte {
return (*[MaxKeySize]byte)(unsafe.Pointer(&n.data))[:n.keySize]
}
// bnodeSize returns the number of bytes required to store a key as a branch node.
func bnodeSize(key []byte) int {
return int(unsafe.Offsetof((*bnode)(nil)).data) + len(key)
}
|