-
Notifications
You must be signed in to change notification settings - Fork 0
/
options.go
79 lines (60 loc) · 1.33 KB
/
options.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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
package bitcaskkvdb
import "os"
type Options struct {
//数据库数据目录
Dirpath string
//数据文件的阈值
DataFileSize int64
//每次写入都需持久化
SyncWrites bool
//累计写到了阈值进行持久化
BytesPerSync uint
//索引数据结构类型
IndexType IndexType
//索引池个数
IndexNum int64
//启动时是否使用MMap 加载数据
MMapOpen bool
//数据文件合并的阈值
DataFileMergeRatio float32
}
// Iterator配置项
type IteratorOptions struct {
//遍历前缀为指定值的Key,默认为空
Prefix []byte
//是否反向遍历,false=正向
Reverse bool
}
type WriteBatchOptions struct {
//单批次最大数据量
MaxBatchNum uint
//提交时 是否持久化
SyncWrites bool
}
type IndexType = int8
const (
//BTREE 索引
Btree IndexType = iota + 1
//ART 自适应基数树
ART
//BPlusTree B+树,将索引存储在磁盘上
BPlusTree
)
var DefaultOptions = Options{
Dirpath: os.TempDir(),
DataFileSize: 256 * 1024 * 1024,
SyncWrites: false,
IndexType: ART,
IndexNum: 10,
BytesPerSync: 0,
MMapOpen: true,
DataFileMergeRatio: 0.5,
}
var DefalutIteratorOptions = IteratorOptions{
Prefix: nil,
Reverse: false,
}
var DefalutWriteBatchOptions = WriteBatchOptions{
MaxBatchNum: 10000,
SyncWrites: true,
}