Skip to content

Commit

Permalink
Completeness checking store should not check if directory digests exi…
Browse files Browse the repository at this point in the history
…st (#748)

REv2 does not require clients to upload directory digests. Instead
they are only required to upload the tree root which has all the
directories in it.

closes #747
  • Loading branch information
allada committed Mar 15, 2024
1 parent 3da42f2 commit e979e31
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 11 deletions.
15 changes: 5 additions & 10 deletions nativelink-store/src/completeness_checking_store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,16 +89,11 @@ async fn check_output_directories(
let tree = get_and_decode_digest::<ProtoTree>(cas_store, &tree_digest).await?;
// TODO(allada) When `try_collect()` is stable we can use it instead.
// https://github.com/rust-lang/rust/issues/94047
let mut digest_iter = tree.children.into_iter().chain(tree.root).flat_map(|dir| {
dir.files
.into_iter()
.filter_map(|f| f.digest.map(DigestInfo::try_from))
.chain(
dir.directories
.into_iter()
.filter_map(|d| d.digest.map(DigestInfo::try_from)),
)
});
let mut digest_iter = tree
.children
.into_iter()
.chain(tree.root)
.flat_map(|dir| dir.files.into_iter().filter_map(|f| f.digest.map(DigestInfo::try_from)));

let mut digest_infos = Vec::with_capacity(digest_iter.size_hint().1.unwrap_or(0));
digest_iter
Expand Down
2 changes: 1 addition & 1 deletion nativelink-store/tests/completeness_checking_store_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ mod completeness_checking_store_tests {
let pinned_cas: Pin<&dyn Store> = Pin::new(cas_store.as_ref());

pinned_cas.update_oneshot(ROOT_FILE, "".into()).await?;
pinned_cas.update_oneshot(ROOT_DIRECTORY, "".into()).await?;
// Note: Explicitly not uploading `ROOT_DIRECTORY`. See: TraceMachina/nativelink#747.
pinned_cas.update_oneshot(CHILD_FILE, "".into()).await?;
pinned_cas.update_oneshot(OUTPUT_FILE, "".into()).await?;
pinned_cas.update_oneshot(STDOUT, "".into()).await?;
Expand Down

0 comments on commit e979e31

Please sign in to comment.