pub fn ensure_local_has_recursive_directory(&self, dir_digest: Digest) -> BoxFuture<(), String> {
    let store = self.clone();
    self
      .load_directory(dir_digest)
      .and_then(move |directory_opt| {
        directory_opt.ok_or_else(|| format!("Could not read dir with digest {:?}", dir_digest))
      })
      .and_then(move |directory| {
        // Traverse the files within directory
        let file_futures = directory
          .get_files()
          .iter()
          .map(|file_node| {
            let file_digest = try_future!(file_node.get_digest().into());
            store.load_bytes_with(EntryType::File, file_digest, |_| Ok(()), |_| Ok(()))
          })
          .collect::<Vec<_>>();

        // Recursively call with sub-directories
        let directory_futures = directory
          .get_directories()
          .iter()
          .map(move |child_dir| {
            let child_digest = try_future!(child_dir.get_digest().into());
            store.ensure_local_has_recursive_directory(child_digest)
          })
          .collect::<Vec<_>>();
        future::join_all(file_futures)
          .join(future::join_all(directory_futures))
          .map(|_| ())
      })
      .to_boxed()
  }
///
/// Download a directory from Remote ByteStore recursively to the local one. Called only with the
/// Digest of a Directory.
///
Download a directory from Remote ByteStore recursively to the local one. Called only with the
Digest of a Directory.
Download a directory from Remote ByteStore recursively to the local one . Called only with the Digest of a Directory .
pub fn ensure_local_has_recursive_directory(&self, dir_digest: Digest) -> BoxFuture<(), String> {
    let store = self.clone();
    self
      .load_directory(dir_digest)
      .and_then(move |directory_opt| {
        directory_opt.ok_or_else(|| format!("Could not read dir with digest {:?}", dir_digest))
      })
      .and_then(move |directory| {
        // Traverse the files within directory
        let file_futures = directory
          .get_files()
          .iter()
          .map(|file_node| {
            let file_digest = try_future!(file_node.get_digest().into());
            store.load_bytes_with(EntryType::File, file_digest, |_| Ok(()), |_| Ok(()))
          })
          .collect::<Vec<_>>();
        // Recursively call with sub-directories
        let directory_futures = directory
          .get_directories()
          .iter()
          .map(move |child_dir| {
            let child_digest = try_future!(child_dir.get_digest().into());
            store.ensure_local_has_recursive_directory(child_digest)
          })
          .collect::<Vec<_>>();
        future::join_all(file_futures)
          .join(future::join_all(directory_futures))
          .map(|_| ())
      })
      .to_boxed()
  }
pub fn ensure_local_has_recursive_directory ( & self , dir_digest : Digest ) -> BoxFuture < ( ) , String > { let store = self . clone ( ) ; self . load_directory ( dir_digest ) . and_then ( move | directory_opt | { directory_opt . ok_or_else ( | | format ! ( " " dir_digest ) ) } ) . and_then ( move | directory | { // Traverse the files within directory let file_futures = directory . get_files ( ) . iter ( ) . map ( | file_node | { let file_digest = try_future ! ( file_node get_digest ( ) into ( ) ) ; store . load_bytes_with ( EntryType :: File , file_digest , | _ | Ok ( ( ) ) , | _ | Ok ( ( ) ) ) } ) . collect :: < Vec < _ > > ( ) ; // Recursively call with sub-directories let directory_futures = directory . get_directories ( ) . iter ( ) . map ( move | child_dir | { let child_digest = try_future ! ( child_dir get_digest ( ) into ( ) ) ; store . ensure_local_has_recursive_directory ( child_digest ) } ) . collect :: < Vec < _ > > ( ) ; future :: join_all ( file_futures ) . join ( future :: join_all ( directory_futures ) ) . map ( | _ | ( ) ) } ) . to_boxed ( ) }
Download a directory from Remote ByteStore recursively to the local one.
Download a directory from Remote ByteStore recursively to the local one .
&self
dir_digest
Digest
&self
dir_digest
Digest