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
use libp2p::PeerId;
use std::path::{Path, PathBuf};
pub mod configuration;
pub mod database;
use configuration::Configuration;
use database::DataBase;
use state;
static STORAGE_PATH: state::Storage<String> = state::Storage::new();
pub struct Storage {}
impl Storage {
    
    
    pub fn init(path: String) {
        
        STORAGE_PATH.set(path);
        
        Configuration::init();
        
        DataBase::init();
    }
    
    
    
    
    
    
    pub fn get_path() -> String {
        STORAGE_PATH.get().clone()
    }
    
    pub fn get_account_path(account_id: PeerId) -> PathBuf {
        let storage_path_string = STORAGE_PATH.get().clone();
        let storage_path = Path::new(&storage_path_string);
        let account_storage_path = storage_path.join(account_id.to_base58());
        account_storage_path
    }
}