mirror of
https://github.com/meilisearch/MeiliSearch
synced 2025-07-04 20:37:15 +02:00
write and load the user-id in the dumps
This commit is contained in:
parent
ba14ea1243
commit
87a8bf5e96
9 changed files with 51 additions and 13 deletions
17
meilisearch-lib/src/analytics.rs
Normal file
17
meilisearch-lib/src/analytics.rs
Normal file
|
@ -0,0 +1,17 @@
|
|||
use std::{fs, path::Path};
|
||||
|
||||
/// To load a dump we get the user id from the source directory;
|
||||
/// If there was a user-id, write it to the new destination if not ignore the error
|
||||
pub fn load_dump(src: &Path, dst: &Path) {
|
||||
if let Ok(user_id) = fs::read_to_string(src.join("user-id")) {
|
||||
let _ = fs::write(dst.join("user-id"), &user_id);
|
||||
}
|
||||
}
|
||||
|
||||
/// To load a dump we get the user id either from the source directory;
|
||||
/// If there was a user-id, write it to the new destination if not ignore the error
|
||||
pub fn write_dump(src: &Path, dst: &Path) {
|
||||
if let Ok(user_id) = fs::read_to_string(src) {
|
||||
let _ = fs::write(dst, &user_id);
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue