Call the underlying Env::copy_to_path method

This commit is contained in:
Kerollmops 2025-03-13 11:49:25 +01:00
parent 7e07cb9de1
commit 1af520077c
No known key found for this signature in database
GPG Key ID: F250A4C4E3AE5F5F

View File

@ -1,7 +1,6 @@
use std::borrow::Cow;
use std::collections::{BTreeMap, BTreeSet, HashMap, HashSet};
use std::fs::File;
use std::io::Seek;
use std::path::Path;
use heed::{types::*, WithoutTls};
@ -346,11 +345,7 @@ impl Index {
}
pub fn copy_to_path<P: AsRef<Path>>(&self, path: P, option: CompactionOption) -> Result<File> {
let mut file =
File::options().create(true).write(true).truncate(true).read(true).open(path)?;
self.copy_to_file(&mut file, option)?;
file.rewind()?;
Ok(file)
self.env.copy_to_path(path, option).map_err(Into::into)
}
/// Returns an `EnvClosingEvent` that can be used to wait for the closing event,