feat(tvix/build): add refscanning interface

This provides a generic interface to let the builder search for needles
 in the output, as described in the notes at `docs/src/build/index.md`.

Change-Id: Ic2c5bd563e9aa2e766c157f2b13cdb19aede12f8
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12531
Autosubmit: yuka <yuka@yuka.dev>
Tested-by: BuildkiteCI
Reviewed-by: flokli <flokli@flokli.de>
Reviewed-by: Brian Olsen <me@griff.name>
This commit is contained in:
Yureka 2024-09-27 21:48:26 +02:00 committed by clbot
parent b82cacb449
commit 07e0cb1b0a
3 changed files with 153 additions and 42 deletions

View file

@ -144,6 +144,12 @@ message BuildRequest {
bytes contents = 2;
}
// If this is an non-empty list, all paths in `outputs` are scanned for these.
// For Nix, `refscan_needles` would be populated with the nixbase32 hash parts of
// every input store path and output store path. The latter is necessary to scan
// for references between multi-output derivations.
repeated string refscan_needles = 10;
// TODO: allow describing something like "preferLocal", to influence composition?
}
@ -156,6 +162,14 @@ message Build {
// They are sorted by their names.
repeated tvix.castore.v1.Node outputs = 2;
message OutputNeedles {
// The numbers are indexing into `refscan_needles` originally specified in the BuildRequest.
repeated uint64 needles = 1;
}
// Contains the same number of elements as the `outputs` field.
repeated OutputNeedles outputs_needles = 3;
// TODO: where did this run, how long, logs,
}