Start to use leveled log

This commit is contained in:
2022-02-24 12:14:52 +01:00
parent f18cc034bb
commit abcf02e488
43 changed files with 156 additions and 67 deletions

View File

@ -9,6 +9,7 @@ type __options__ struct {
bufferSize int
batchSize int
parallelWorkers int
noSingleton bool
}
type Options struct {
@ -27,6 +28,7 @@ func MakeOptions(setters []WithOption) Options {
bufferSize: 2,
batchSize: 5000,
parallelWorkers: 4,
noSingleton: false,
}
opt := Options{&o}
@ -79,6 +81,10 @@ func (opt Options) SortOnDisk() bool {
return opt.pointer.cacheOnDisk
}
func (opt Options) NoSingleton() bool {
return opt.pointer.noSingleton
}
func OptionSortOnDisk() WithOption {
f := WithOption(func(opt Options) {
opt.pointer.cacheOnDisk = true
@ -149,3 +155,19 @@ func OptionsBufferSize(size int) WithOption {
return f
}
func OptionsNoSingleton() WithOption {
f := WithOption(func(opt Options) {
opt.pointer.noSingleton = true
})
return f
}
func OptionsWithSingleton() WithOption {
f := WithOption(func(opt Options) {
opt.pointer.noSingleton = false
})
return f
}