From 2ef51f7df965dd8386db00d2b2b759fbe6d5f1c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Renault?= Date: Fri, 18 Oct 2019 12:52:45 +0200 Subject: [PATCH] Introduce a function to copy and compact a database env --- meilidb-core/examples/from_file.rs | 9 +++++++++ meilidb-core/src/database.rs | 6 ++++++ 2 files changed, 15 insertions(+) diff --git a/meilidb-core/examples/from_file.rs b/meilidb-core/examples/from_file.rs index e00ff94f0..981f294ff 100644 --- a/meilidb-core/examples/from_file.rs +++ b/meilidb-core/examples/from_file.rs @@ -33,6 +33,9 @@ struct IndexCommand { #[structopt(long)] update_group_size: Option, + + #[structopt(long, parse(from_os_str))] + compact_to_path: Option, } #[derive(Debug, StructOpt)] @@ -165,6 +168,12 @@ fn index_command(command: IndexCommand, database: Database) -> Result<(), Box>(&self, path: P) -> ZResult { + self.env.copy_to_path(path, CompactionOption::Enabled) + } + pub fn indexes_names(&self) -> MResult> { let indexes = self.indexes.read().unwrap(); Ok(indexes.keys().cloned().collect())