-
-
Notifications
You must be signed in to change notification settings - Fork 643
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
Provide in V2 a builtin rule to go from Digest -> Snapshot #7716
Comments
A quick guided tour of what I imagine this would look like:
&rule_graph::Rule::Intrinsic(Intrinsic { product, input }) if product == context.core.types.snapshot && input == context.core.types.directory_digest => {...} where the ... will actually look like: Copy and paste the code from one of the other branches which uses a directory_digest (e.g. the one that produces files_content), and then call self
.select_product(&context, context.core.types.directory_digest, "intrinsic")
.and_then(|directory_digest_val| lift_digest(&directory_digest_val).map_err(|str| throw(&str)))
.and_then(|digest| Snapshot::from_digest(context.core.store(), digest).map_err(|str| throw(&str)))
.map(move |snapshot| Snapshot::store_snapshot(&core, &snapshot))
.to_boxed() probably with some extra clones and map_errs around. |
We often work with
Digest
s in V2, because they are more lightweight than snapshots.However, there are certain times that we need to be able to get the
.files
from a Digest so that we can for example inspect whether each folder has an__init__.py
in it, as done in #7696.Currently, the only way to go from a Digest to somehow getting the folder's paths is to use the builtin Rust rule
Digest -> FilesContent
, which unnecessarily materializes the file content.--
Alternatively, we could provide a way to go from
MergedDirectories->Snapshot
, in addition toMergedDirectories->Digest
.The text was updated successfully, but these errors were encountered: