-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfig.go
88 lines (76 loc) · 1.85 KB
/
config.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
80
81
82
83
84
85
86
87
88
package streedb
import "time"
func NewDefaultConfig() *Config {
return &Config{
MaxLevels: 5,
DbPath: "/tmp/db",
Filesystem: FilesystemTypeMap[FILESYSTEM_TYPE_LOCAL],
LevelFilesystems: []string{"local", "local", "local", "local", "local"},
Wal: WalCfg{
MaxItems: 1024 * 32,
MaxElapsedTimeMs: time.Hour.Milliseconds() * 1000,
MaxSizeBytes: 32 * 32 * 32 * 1024,
},
Compaction: CompactionCfg{
Promoters: PromotersCfg{
TimeLimit: TimeLimitPromoterCfg{
GrowthFactor: 8,
MaxTimeMs: 7 * 24 * 3600 * 1000,
MinTimeMs: 1000 * 3600,
},
SizeLimit: SizeLimitPromoterCfg{
GrowthFactor: 16,
FirstBlockSizeBytes: 1024 * 1024 * 32,
MaxBlockSizeBytes: 1024 * 1024 * 1024 * 5,
},
ItemLimit: ItemLimitPromoterCfg{
GrowthFactor: 8,
MaxItems: 1024 * 32 * 32 * 32 * 32,
// Be careful with setting this value to something related to WAL max items
FirstBlockItemCount: 1024 * 32 * 32,
},
},
},
}
}
type Config struct {
MaxLevels int
DbPath string
Filesystem string
S3Config S3Config
LevelFilesystems []string
Compaction CompactionCfg
Wal WalCfg
}
type WalCfg struct {
MaxItems int
MaxElapsedTimeMs int64
MaxSizeBytes int
}
type CompactionCfg struct {
Promoters PromotersCfg
}
type PromotersCfg struct {
TimeLimit TimeLimitPromoterCfg
SizeLimit SizeLimitPromoterCfg
ItemLimit ItemLimitPromoterCfg
}
type SizeLimitPromoterCfg struct {
GrowthFactor int
FirstBlockSizeBytes int
MaxBlockSizeBytes int
}
type ItemLimitPromoterCfg struct {
GrowthFactor int
FirstBlockItemCount int
MaxItems int
}
type TimeLimitPromoterCfg struct {
GrowthFactor int
MaxTimeMs int64
MinTimeMs int64
}
type S3Config struct {
Region string
Bucket string
}