mirror of
https://github.com/meilisearch/meilisearch.git
synced 2025-07-27 08:41:00 +00:00
Introduce a function to copy and compact a database env
This commit is contained in:
@ -1,8 +1,10 @@
|
||||
use std::collections::hash_map::{HashMap, Entry};
|
||||
use std::fs::File;
|
||||
use std::path::Path;
|
||||
use std::sync::{Arc, RwLock};
|
||||
use std::{fs, thread};
|
||||
|
||||
use zlmdb::{Result as ZResult, CompactionOption};
|
||||
use zlmdb::types::{Str, Unit};
|
||||
use crossbeam_channel::Receiver;
|
||||
use log::{debug, error};
|
||||
@ -163,6 +165,10 @@ impl Database {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn copy_and_compact_to_path<P: AsRef<Path>>(&self, path: P) -> ZResult<File> {
|
||||
self.env.copy_to_path(path, CompactionOption::Enabled)
|
||||
}
|
||||
|
||||
pub fn indexes_names(&self) -> MResult<Vec<String>> {
|
||||
let indexes = self.indexes.read().unwrap();
|
||||
Ok(indexes.keys().cloned().collect())
|
||||
|
Reference in New Issue
Block a user