From 42c25ed52821d8a6736b2155866e6704af7e334f Mon Sep 17 00:00:00 2001 From: HuangYi Date: Thu, 12 Jan 2023 14:13:39 +0800 Subject: [PATCH] add BottommostCompressionOptionsZstdDictTrainer option --- options.go | 42 +++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/options.go b/options.go index bd93c9f..2623ffe 100644 --- a/options.go +++ b/options.go @@ -714,27 +714,27 @@ func (opts *Options) SetBottommostCompressionOptionsMaxDictBufferBytes(value uin ) } -// // SetBottommostCompressionOptionsZstdDictTrainer uses/not use zstd trainer to generate dictionaries. -// // When this option is set to true, zstd_max_train_bytes of training data sampled from -// // max_dict_buffer_bytes buffered data will be passed to zstd dictionary trainer to generate a -// // dictionary of size max_dict_bytes. -// // -// // When this option is false, zstd's API ZDICT_finalizeDictionary() will be -// // called to generate dictionaries. zstd_max_train_bytes of training sampled -// // data will be passed to this API. Using this API should save CPU time on -// // dictionary training, but the compression ratio may not be as good as using -// // a dictionary trainer. -// // -// // Default: true -// func (opts *Options) SetBottommostCompressionOptionsZstdDictTrainer(enabled bool) { -// c := boolToChar(enabled) -// C.rocksdb_options_set_bottommost_compression_options_use_zstd_dict_trainer(opts.c, c, c) -// } - -// // GetBottommostCompressionOptionsZstdDictTrainer returns if zstd dict trainer is used or not. -// func (opts *Options) GetBottommostCompressionOptionsZstdDictTrainer() bool { -// return charToBool(C.rocksdb_options_get_bottommost_compression_options_use_zstd_dict_trainer(opts.c)) -// } +// SetBottommostCompressionOptionsZstdDictTrainer uses/not use zstd trainer to generate dictionaries. +// When this option is set to true, zstd_max_train_bytes of training data sampled from +// max_dict_buffer_bytes buffered data will be passed to zstd dictionary trainer to generate a +// dictionary of size max_dict_bytes. +// +// When this option is false, zstd's API ZDICT_finalizeDictionary() will be +// called to generate dictionaries. zstd_max_train_bytes of training sampled +// data will be passed to this API. Using this API should save CPU time on +// dictionary training, but the compression ratio may not be as good as using +// a dictionary trainer. +// +// Default: true +func (opts *Options) SetBottommostCompressionOptionsZstdDictTrainer(enabled bool) { + c := boolToChar(enabled) + C.rocksdb_options_set_bottommost_compression_options_use_zstd_dict_trainer(opts.c, c, c) +} + +// GetBottommostCompressionOptionsZstdDictTrainer returns if zstd dict trainer is used or not. +func (opts *Options) GetBottommostCompressionOptionsZstdDictTrainer() bool { + return charToBool(C.rocksdb_options_get_bottommost_compression_options_use_zstd_dict_trainer(opts.c)) +} // SetMinLevelToCompress sets the start level to use compression. func (opts *Options) SetMinLevelToCompress(value int) {