-
-
Notifications
You must be signed in to change notification settings - Fork 672
Description
The Snapshot type represents a set of files, which have particular contents.
In order to merge snapshots (e.g. "a snapshot containing a compiler binary" and "some source files to compile") for process execution, we need to be able to merge snapshots.
Exactly how we expose this in Python is an open question (#5502) but it's reasonable to assume we'll want an in-rust implementation of merging which we expose to the Python somehow. So, let's write a static function (and some tests!) in snapshot.rs.
Snapshots have two components, which will need handling separately:
-
Digest. This is the digest the Directory protocol buffer which represents the tree of files. Note that there are strict ordering requirements (alphabetical) for entries in this.
-
path_stats. This is a list of the entries in the Snapshot, ordered in the order that they were captured (i.e. grabbing a snapshot for
["foo", "bar"]
will have itspath_stats
in that order). There isn't necessarily an obviously correct ordering here, so we should probably preserve the ordering of the first snapshot passed, and insert additionalPathStats
in a stable order afterwards (deduplicating as we go).