1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
use holochain_zome_types::cell::CellId;
use std::path::Path;
use std::path::PathBuf;
pub use holochain_sqlite::conn::DbSyncLevel;
pub use holochain_sqlite::conn::DbSyncStrategy;
pub use holochain_sqlite::db::*;
#[derive(Clone, Debug)]
pub struct DatabasePath(PathBuf);
impl From<CellId> for DatabasePath {
fn from(id: CellId) -> Self {
let database_path = PathBuf::new().join(format!("{}", id));
DatabasePath(database_path)
}
}
impl From<&Path> for DatabasePath {
fn from(path: &Path) -> Self {
DatabasePath(path.into())
}
}
impl AsRef<Path> for DatabasePath {
fn as_ref(&self) -> &Path {
self.0.as_path()
}
}