pub fn default_root() -> path::Path {
use std::env;
let ipfs_path = env::var("IPFS_PATH").unwrap_or("./ipfs".to_string());
let mut root = dirs::home_dir();
root.push(ipfs_path);
root.to_path()
}
pub fn loc_config(root: path::Path, file: Option<ffi::OsString>) -> path::Path {
let file = file.unwrap_or("config".to_os_string());
let loc: path::PathBuf = vec![root, file].iter().collect();
loc.to_path()
}
pub fn loc_datastore(root: path::Path, sub_dir: Option<ffi::OsString>) -> path::Path {
let sub_dir = sub_dir.unwrap_or("datastore".to_os_string());
let loc: path::PathBuf = vec![root, file].iter().collect();
loc.to_path()
}
struct FileRepo {
config: Config,
}
impl FileRepo {
fn to_config() -> Result<Config> {
todo!()
}
BackupConfig(prefix string) (string, error)
SetConfig(*config.Config) error
SetConfigKey(key string, value interface{}) error
GetConfigKey(key string) (interface{}, error)
Datastore() Datastore
GetStorageUsage() (uint64, error)
Keystore() keystore.Keystore
FileManager() *filestore.FileManager
SetAPIAddr(addr ma.Multiaddr) error
SwarmKey() ([]byte, error)
close
}
type Datastore interface {
ds.Batching }