-
-
Notifications
You must be signed in to change notification settings - Fork 636
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for merging Snapshots #5746
Conversation
5577a5c
to
2293f7f
Compare
(for the record: the individual commits here aren't useful) |
2293f7f
to
dd07479
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great :) Thanks!
// TODO: This will not have been stored... we'll need to explicitly store it. | ||
return future::ok(EMPTY_DIGEST).to_boxed(); | ||
} else if dir_digests.len() == 1 { | ||
let mut dir_digests = dir_digests; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would possibly be a little clearer to make the argument mut
, rather than to mut
-ify it in the method body
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did this to avoid that... this localizes the awareness of the mutability to where it is actually relevant.
src/rust/engine/fs/src/snapshot.rs
Outdated
}; | ||
let merged_root_directory = store.load_directory(merged.digest).wait().unwrap().unwrap(); | ||
|
||
assert_eq!(merged.path_stats.len(), 3); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you compare the actual contents, rather than just the length? Ordering is well defined here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yea, good point.
src/rust/engine/fs/src/snapshot.rs
Outdated
.files | ||
.iter() | ||
.map(|filenode| filenode.name.clone()) | ||
.collect::<HashSet<_>>(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nodes in Directories have a canonical ordering (they should be sorted), so this should probably be a Vec
rather than a HashSet
src/rust/engine/fs/src/snapshot.rs
Outdated
}; | ||
|
||
match merged_res { | ||
Err(ref msg) if msg.contains("Snapshots contained duplicate path: ") => (), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe throw in a check that the error message contains the strong roland
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
Problem
As described in #5707: we need a way to merge
Snapshot
objects (although we have not yet decided how to expose them to@rule
s.)Solution
Add
Snapshot::merge
.Result
Fixes #5707.