Implement a first version of the snapshots

This commit is contained in:
Kerollmops 2022-10-25 14:09:01 +02:00 committed by Clément Renault
parent c063f154fb
commit eec43ec953
No known key found for this signature in database
GPG key ID: 92ADA4E935E71FA4
5 changed files with 92 additions and 11 deletions

View file

@ -74,11 +74,16 @@ impl FileStore {
/// Returns the file corresponding to the requested uuid.
pub fn get_update(&self, uuid: Uuid) -> Result<StdFile> {
let path = self.path.join(uuid.to_string());
let path = self.get_update_path(uuid);
let file = StdFile::open(path)?;
Ok(file)
}
/// Returns the path that correspond to this uuid, the path could not exists.
pub fn get_update_path(&self, uuid: Uuid) -> PathBuf {
self.path.join(uuid.to_string())
}
/// Copies the content of the update file pointed to by `uuid` to the `dst` directory.
pub fn snapshot(&self, uuid: Uuid, dst: impl AsRef<Path>) -> Result<()> {
let src = self.path.join(uuid.to_string());