forked from hmarui66/blink-tree-go
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcommon.go
39 lines (27 loc) · 932 Bytes
/
common.go
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
31
32
33
34
35
36
37
38
39
package blink_tree
import (
"fmt"
"os"
)
type Uid uint64
const (
_FileOffsetBits = 64
BtLatchTable = 128 // number of latch manager slots
BtRO = 0x6f72 // ro
BtRW = 0x7772 // rw
BtMaxBits = 24 // maximum page size in bits
BtMinBits = 9 // minimum page size in bits
BtMinPage = 1 << BtMinBits // minimum page size
BtMaxPage = 1 << BtMaxBits // maximum page size
BtId = 6 // Define the length of the page and key pointers
ClockBit = uint32(0x8000) // the bit in pool->pin
AllocPage = 0 // allocation & lock manager hash table
RootPage = Uid(1) // root of the btree
LeafPage = 2 // first page of leaves
LatchPage = 3 // pages for lock manager
MinLvl = 2 // Number of levels to create in a new BTree
DECREMENT = ^uint32(0) // Used when decrementing uint32 using atomic.AddUint32.
)
func errPrintf(format string, a ...any) {
fmt.Fprintf(os.Stderr, format, a...)
}