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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#![allow(clippy::module_inception)]
pub mod fnode;
mod fs;
pub use self::fnode::{DirEntry, FileType, Fnode, FnodeRef, Metadata, Version};
pub use self::fs::{Fs, ShutterRef};
use base::crypto::{Cipher, Cost, Crypto};
use content::StoreRef;
use trans::TxMgrRef;
use volume::VolumeRef;
const DEFAULT_VERSION_LIMIT: u8 = 1;
#[derive(Debug, Clone, Copy, Deserialize, Serialize)]
pub struct Options {
pub version_limit: u8,
pub dedup_chunk: bool,
}
impl Default for Options {
fn default() -> Self {
Options {
version_limit: DEFAULT_VERSION_LIMIT,
dedup_chunk: false,
}
}
}
#[derive(Debug, Clone, Deserialize, Serialize)]
pub struct Config {
pub cost: Cost,
pub cipher: Cipher,
pub compress: bool,
pub opts: Options,
}
impl Default for Config {
fn default() -> Self {
Config {
cost: Cost::default(),
cipher: if Crypto::is_aes_hardware_available() {
Cipher::Aes
} else {
Cipher::Xchacha
},
compress: false,
opts: Options::default(),
}
}
}
#[derive(Debug, Clone)]
pub struct Handle {
pub fnode: FnodeRef,
pub store: StoreRef,
pub txmgr: TxMgrRef,
pub vol: VolumeRef,
pub shutter: ShutterRef,
}