30 lines
487 B
Go
30 lines
487 B
Go
package models
|
|
|
|
import (
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
const (
|
|
BNODE_NODE = 1
|
|
BNODE_LEAF = 2
|
|
BTREE_PAGE_SIZE = 4096
|
|
BTREE_MAX_KEY_SIZE = 1000
|
|
BTREE_MAX_VAL_SIZE = 3000
|
|
)
|
|
|
|
type Node struct {
|
|
keys [][]byte
|
|
vals [][]byte
|
|
kids []*Node
|
|
}
|
|
|
|
func init() {
|
|
node1max := HEADER + 8 + 2 + 4 + BTREE_MAX_KEY_SIZE + BTREE_MAX_VAL_SIZE
|
|
assert(node1max <= BTREE_PAGE_SIZE)
|
|
}
|
|
func Encode(node *Node) []byte {
|
|
return nil
|
|
}
|
|
|
|
func Decode(page []byte) (*Node, error) {
|
|
return nil, nil
|
|
} |