rucksack_db/store/backend/
filesystem.rs

1use anyhow::Result;
2
3use crate::db::encrypted::EncryptedDB;
4use crate::store::manager::StoreManager;
5
6use super::backup;
7
8#[derive(Clone, Default)]
9pub struct FileSystemBackend {}
10
11impl FileSystemBackend {
12    pub fn new() -> FileSystemBackend {
13        FileSystemBackend {}
14    }
15}
16
17impl StoreManager for FileSystemBackend {
18    fn backup(&self, src_file: String, dest_dir: String, version: String) -> Result<String> {
19        backup::copy(src_file, dest_dir, version)
20    }
21
22    fn read(&self, path: String, pwd: String, salt: String) -> Result<EncryptedDB> {
23        EncryptedDB::from_file(path, pwd, salt)
24    }
25}