mirror of
https://github.com/meilisearch/MeiliSearch
synced 2024-12-24 13:40:31 +01:00
use faux in the file-store
This commit is contained in:
parent
9ff0fe952e
commit
4846a7c501
@ -31,20 +31,23 @@ impl DerefMut for File {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// #[cfg_attr(test, faux::create)]
|
#[cfg_attr(test, faux::create)]
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Clone, Debug)]
|
||||||
pub struct FileStore {
|
pub struct FileStore {
|
||||||
path: PathBuf,
|
path: PathBuf,
|
||||||
}
|
}
|
||||||
|
|
||||||
// #[cfg_attr(test, faux::methods)]
|
#[cfg(not(test))]
|
||||||
impl FileStore {
|
impl FileStore {
|
||||||
pub fn new(path: impl AsRef<Path>) -> Result<FileStore> {
|
pub fn new(path: impl AsRef<Path>) -> Result<FileStore> {
|
||||||
let path = path.as_ref().join(UPDATE_FILES_PATH);
|
let path = path.as_ref().join(UPDATE_FILES_PATH);
|
||||||
std::fs::create_dir_all(&path)?;
|
std::fs::create_dir_all(&path)?;
|
||||||
Ok(FileStore { path })
|
Ok(FileStore { path })
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg_attr(test, faux::methods)]
|
||||||
|
impl FileStore {
|
||||||
/// Creates a new temporary update file.
|
/// Creates a new temporary update file.
|
||||||
/// A call to `persist` is needed to persist the file in the database.
|
/// A call to `persist` is needed to persist the file in the database.
|
||||||
pub fn new_update(&self) -> Result<(Uuid, File)> {
|
pub fn new_update(&self) -> Result<(Uuid, File)> {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user