moved the database-go project to this repository
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
package models
|
||||
|
||||
import "encoding/binary"
|
||||
|
||||
const (
|
||||
BNODE_NODE = 1
|
||||
BNODE_LEAF = 2
|
||||
)
|
||||
|
||||
func (node BNode) btype() uint16 {
|
||||
return binary.LittleEndian.Uint16(node[0:2])
|
||||
}
|
||||
|
||||
|
||||
func (node BNode) nkeys() uint16 {
|
||||
return binary.LittleEndian.Uint16(node[2:4])
|
||||
}
|
||||
|
||||
|
||||
func (node BNode) setHeader(btype uint16, nkeys uint16) {
|
||||
binary.LittleEndian.PutUint16(node[0:2], btype)
|
||||
binary.LittleEndian.PutUint16(node[2:4], nkeys)
|
||||
}
|
||||
|
||||
func (node BNode) getPrt(ids uint16) uint64{
|
||||
assert(ids < node.nkeys())
|
||||
pos := HEADER + 8*ids
|
||||
return binary.LittleEndian.Uint64(node[pos:])
|
||||
}
|
||||
|
||||
func (node BNode) setPtr(idx uint16, val uint64) {
|
||||
}
|
||||
Reference in New Issue
Block a user