Skip to content
Permalink
Browse files

Review feedback.

  • Loading branch information...
stuhood committed Feb 14, 2019
1 parent d934b2b commit ca2819626d5afdbc70e02e9e72d8fca4e8803bb4
Showing with 12 additions and 8 deletions.
  1. +4 −2 src/rust/engine/fs/src/snapshot.rs
  2. +8 −6 src/rust/engine/fs/src/store.rs
@@ -86,8 +86,10 @@ impl Snapshot {
future::ok(path_stats).to_boxed()
})
.map(move |path_stats_per_directory| {
let path_stats =
Iterator::flatten(path_stats_per_directory.into_iter().map(|v| v.into_iter())).collect();
let mut path_stats =
Iterator::flatten(path_stats_per_directory.into_iter().map(|v| v.into_iter()))
.collect::<Vec<_>>();
path_stats.sort_by(|l, r| l.path().cmp(&r.path()));
Snapshot { digest, path_stats }
})
.to_boxed()
@@ -589,6 +589,9 @@ impl Store {
/// Given the Digest for a Directory, recursively walk the Directory, calling the given function
/// with the path so far, and the new Directory.
///
/// The recursive walk will proceed concurrently, so if order matters, a caller should sort the
/// output after the call.
///
pub fn walk<
T: Send + 'static,
F: Fn(
@@ -598,13 +601,14 @@ impl Store {
&bazel_protos::remote_execution::Directory,
) -> BoxFuture<T, String>
+ Send
+ Sync
+ 'static,
>(
&self,
digest: Digest,
f: F,
) -> BoxFuture<Vec<T>, String> {
let f = Arc::new(Mutex::new(f));
let f = Arc::new(f);
let accumulator = Arc::new(Mutex::new(Vec::new()));
self
.walk_helper(digest, PathBuf::new(), f, accumulator.clone())
@@ -625,23 +629,21 @@ impl Store {
&bazel_protos::remote_execution::Directory,
) -> BoxFuture<T, String>
+ Send
+ Sync
+ 'static,
>(
&self,
digest: Digest,
path_so_far: PathBuf,
f: Arc<Mutex<F>>,
f: Arc<F>,
accumulator: Arc<Mutex<Vec<T>>>,
) -> BoxFuture<(), String> {
let store = self.clone();
self
.load_directory(digest)
.and_then(move |maybe_directory| match maybe_directory {
Some(directory) => {
let result_for_directory = {
let f = f.lock();
f(&store, &path_so_far, digest, &directory)
};
let result_for_directory = f(&store, &path_so_far, digest, &directory);
result_for_directory
.and_then(move |r| {
{

0 comments on commit ca28196

Please sign in to comment.
You can’t perform that action at this time.