2022-12-03 12:40:36 +05:00
|
|
|
package zkv
|
|
|
|
|
2022-12-03 12:55:42 +05:00
|
|
|
import "github.com/klauspost/compress/zstd"
|
|
|
|
|
2022-12-03 12:40:36 +05:00
|
|
|
type Options struct {
|
2022-12-03 12:55:42 +05:00
|
|
|
// Maximum number of concurrent reads
|
2022-12-03 20:59:17 +05:00
|
|
|
MaxParallelReads int
|
2022-12-03 12:55:42 +05:00
|
|
|
|
|
|
|
// Compression level
|
|
|
|
CompressionLevel zstd.EncoderLevel
|
2022-12-03 20:59:17 +05:00
|
|
|
|
2022-12-09 20:05:30 +05:00
|
|
|
// Memory write buffer size in bytes
|
|
|
|
MemoryBufferSize int
|
|
|
|
|
2022-12-10 21:34:16 +05:00
|
|
|
// Disk write buffer size in bytes
|
2022-12-09 20:05:30 +05:00
|
|
|
DiskBufferSize int
|
2022-12-10 21:39:24 +05:00
|
|
|
|
|
|
|
// Use index file
|
|
|
|
UseIndexFile bool
|
2022-12-03 12:40:36 +05:00
|
|
|
}
|
|
|
|
|
2022-12-03 12:55:42 +05:00
|
|
|
func (o *Options) setDefaults() {
|
2022-12-03 12:40:36 +05:00
|
|
|
if o.MaxParallelReads == 0 {
|
|
|
|
o.MaxParallelReads = defaultOptions.MaxParallelReads
|
|
|
|
}
|
|
|
|
|
2022-12-03 12:55:42 +05:00
|
|
|
if o.CompressionLevel == 0 {
|
|
|
|
o.CompressionLevel = defaultOptions.CompressionLevel
|
|
|
|
}
|
2022-12-10 21:39:24 +05:00
|
|
|
|
|
|
|
if o.MemoryBufferSize == 0 {
|
|
|
|
o.MemoryBufferSize = defaultOptions.MemoryBufferSize
|
|
|
|
}
|
|
|
|
|
|
|
|
if o.DiskBufferSize == 0 {
|
|
|
|
o.DiskBufferSize = defaultOptions.DiskBufferSize
|
|
|
|
}
|
2022-12-03 12:40:36 +05:00
|
|
|
}
|