async fn bring_up_dfs_action_handler(
    root: &Path,
    files: HashMap<&str, &str>,
) -> anyhow::Result<ActionHandler> {
    let fs = LocalFS::try_create(root.to_str().unwrap().to_string())?;

    let meta_addr = rand_local_addr();
    let mn = MetaNode::boot(0, meta_addr.clone()).await?;

    let dfs = Dfs::create(fs, mn.clone());

    for (key, content) in files.iter() {
        dfs.add((*key).into(), (*content).as_bytes()).await?;
        tracing::debug!("dfs added file: {} {:?}", *key, *content);
    }

    let ah = ActionHandler::create(Arc::new(dfs), mn);

    Ok(ah)
}
// Start an ActionHandler backed with a dfs.
// And feed files into dfs.
Start an ActionHandler backed with a dfs.
And feed files into dfs.
Start an ActionHandler backed with a dfs . And feed files into dfs .
async fn bring_up_dfs_action_handler(
    root: &Path,
    files: HashMap<&str, &str>,
) -> anyhow::Result<ActionHandler> {
    let fs = LocalFS::try_create(root.to_str().unwrap().to_string())?;
    let meta_addr = rand_local_addr();
    let mn = MetaNode::boot(0, meta_addr.clone()).await?;
    let dfs = Dfs::create(fs, mn.clone());
    for (key, content) in files.iter() {
        dfs.add((*key).into(), (*content).as_bytes()).await?;
        tracing::debug!("dfs added file: {} {:?}", *key, *content);
    }
    let ah = ActionHandler::create(Arc::new(dfs), mn);
    Ok(ah)
}
async fn bring_up_dfs_action_handler ( root : & Path , files : HashMap < & str , & str > , ) -> anyhow :: Result < ActionHandler > { let fs = LocalFS :: try_create ( root . to_str ( ) . unwrap ( ) . to_string ( ) ) ? ; let meta_addr = rand_local_addr ( ) ; let mn = MetaNode :: boot ( 0 , meta_addr . clone ( ) ) . await ? ; let dfs = Dfs :: create ( fs , mn . clone ( ) ) ; for ( key , content ) in files . iter ( ) { dfs . add ( ( * key ) . into ( ) , ( * content ) . as_bytes ( ) ) . await ? ; tracing :: debug ! ( " " key content ) ; } let ah = ActionHandler :: create ( Arc :: new ( dfs ) , mn ) ; Ok ( ah ) }
Start an ActionHandler backed with a dfs.
Start an ActionHandler backed with a dfs .
root
&Path
files
HashMap<&str, &str>
root
&Path
files
HashMap<&str, &str>