mirror of
https://github.com/meilisearch/meilisearch.git
synced 2024-11-22 18:17:39 +08:00
Use CompressionType::from_str rather than a custom function
This commit is contained in:
parent
4b819457c9
commit
433d9bbc6e
2
Cargo.lock
generated
2
Cargo.lock
generated
@ -1203,7 +1203,7 @@ checksum = "2839e79665f131bdb5782e51f2c6c9599c133c6098982a54c794358bf432529c"
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "oxidized-mtbl"
|
name = "oxidized-mtbl"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
source = "git+https://github.com/Kerollmops/oxidized-mtbl.git?rev=a2e13cb#a2e13cba5fb3ed606d2a18a43260c5487eb38746"
|
source = "git+https://github.com/Kerollmops/oxidized-mtbl.git?rev=45076a1#45076a16e91102d8153e63043fe0723abc4e1d18"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"byteorder",
|
"byteorder",
|
||||||
"crc32c",
|
"crc32c",
|
||||||
|
@ -21,7 +21,7 @@ linked-hash-map = "0.5.3"
|
|||||||
memmap = "0.7.0"
|
memmap = "0.7.0"
|
||||||
near-proximity = { git = "https://github.com/Kerollmops/plane-sweep-proximity", rev = "6608205" }
|
near-proximity = { git = "https://github.com/Kerollmops/plane-sweep-proximity", rev = "6608205" }
|
||||||
once_cell = "1.4.0"
|
once_cell = "1.4.0"
|
||||||
oxidized-mtbl = { git = "https://github.com/Kerollmops/oxidized-mtbl.git", rev = "a2e13cb" }
|
oxidized-mtbl = { git = "https://github.com/Kerollmops/oxidized-mtbl.git", rev = "45076a1" }
|
||||||
rayon = "1.3.1"
|
rayon = "1.3.1"
|
||||||
ringtail = "0.3.0"
|
ringtail = "0.3.0"
|
||||||
roaring = "0.6.1"
|
roaring = "0.6.1"
|
||||||
|
@ -100,24 +100,13 @@ struct IndexerOpt {
|
|||||||
///
|
///
|
||||||
/// Choosing a fast algorithm will make the indexing faster but may consume more memory.
|
/// Choosing a fast algorithm will make the indexing faster but may consume more memory.
|
||||||
#[structopt(long, default_value = "snappy", possible_values = &["snappy", "zlib", "lz4", "lz4hc", "zstd"])]
|
#[structopt(long, default_value = "snappy", possible_values = &["snappy", "zlib", "lz4", "lz4hc", "zstd"])]
|
||||||
chunk_compression_type: String,
|
chunk_compression_type: CompressionType,
|
||||||
|
|
||||||
/// The level of compression of the chosen algorithm.
|
/// The level of compression of the chosen algorithm.
|
||||||
#[structopt(long, requires = "chunk-compression-type")]
|
#[structopt(long, requires = "chunk-compression-type")]
|
||||||
chunk_compression_level: Option<u32>,
|
chunk_compression_level: Option<u32>,
|
||||||
}
|
}
|
||||||
|
|
||||||
fn compression_type_from_str(name: &str) -> CompressionType {
|
|
||||||
match name {
|
|
||||||
"snappy" => CompressionType::Snappy,
|
|
||||||
"zlib" => CompressionType::Zlib,
|
|
||||||
"lz4" => CompressionType::Lz4,
|
|
||||||
"lz4hc" => CompressionType::Lz4hc,
|
|
||||||
"zstd" => CompressionType::Zstd,
|
|
||||||
_ => panic!("invalid compression algorithm"),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fn format_count(n: usize) -> String {
|
fn format_count(n: usize) -> String {
|
||||||
human_format::Formatter::new().with_decimals(1).with_separator("").format(n as f64)
|
human_format::Formatter::new().with_decimals(1).with_separator("").format(n as f64)
|
||||||
}
|
}
|
||||||
@ -747,7 +736,7 @@ fn main() -> anyhow::Result<()> {
|
|||||||
let linked_hash_map_size = opt.indexer.linked_hash_map_size;
|
let linked_hash_map_size = opt.indexer.linked_hash_map_size;
|
||||||
let max_nb_chunks = opt.indexer.max_nb_chunks;
|
let max_nb_chunks = opt.indexer.max_nb_chunks;
|
||||||
let max_memory = opt.indexer.max_memory;
|
let max_memory = opt.indexer.max_memory;
|
||||||
let chunk_compression_type = compression_type_from_str(&opt.indexer.chunk_compression_type);
|
let chunk_compression_type = opt.indexer.chunk_compression_type;
|
||||||
let chunk_compression_level = opt.indexer.chunk_compression_level;
|
let chunk_compression_level = opt.indexer.chunk_compression_level;
|
||||||
let log_every_n = opt.indexer.log_every_n;
|
let log_every_n = opt.indexer.log_every_n;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user