refactor(tvix/derivation): use BTreeSet for derivation outputs
When constructing derivations inside builtins.derivationStrict, we'd have to very frequently check whether certain outputs have already been inserted into the derivation inputs. Using a set type is much easier, especially as this has to be ordered and the source data that is being inserted also comes from a set, which might let us pass this more efficiently in the future. Note that the validate function no longer checks the order of the entries, as that is now guaranteed by the type. Change-Id: I2fbb984facba3e668075f6f8df8992092368c63d Reviewed-on: https://cl.tvl.fyi/c/depot/+/7826 Tested-by: BuildkiteCI Reviewed-by: flokli <flokli@flokli.de>
This commit is contained in:
parent
9a500c3e9b
commit
a35dadf9f0
4 changed files with 13 additions and 16 deletions
|
|
@ -1,5 +1,6 @@
|
|||
use crate::output::Output;
|
||||
use crate::string_escape::escape_string;
|
||||
use std::collections::BTreeSet;
|
||||
use std::{collections::BTreeMap, fmt, fmt::Write};
|
||||
|
||||
pub const DERIVATION_PREFIX: &str = "Derive";
|
||||
|
|
@ -84,7 +85,7 @@ pub fn write_outputs(
|
|||
|
||||
pub fn write_input_derivations(
|
||||
writer: &mut impl Write,
|
||||
input_derivations: &BTreeMap<String, Vec<String>>,
|
||||
input_derivations: &BTreeMap<String, BTreeSet<String>>,
|
||||
) -> Result<(), fmt::Error> {
|
||||
writer.write_char(COMMA)?;
|
||||
writer.write_char(BRACKET_OPEN)?;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue