refactor(tvix/store): generalize PathInfo constructors
Instead of enforcing NAR SHA256 all the time, we generalize the `PathInfo` constructor to take a `CAHash` argument which can drive whether we are having a flat, NAR or text scheme. With this, it is now possible to implement flat schemes in our evaluation builtins, e.g. `builtins.path`. Change-Id: I15bfee0ef4f0f428bfbd2f30c57c012cdcf6a976 Signed-off-by: Ryan Lahfa <tvl@lahfa.xyz> Reviewed-on: https://cl.tvl.fyi/c/depot/+/11286 Reviewed-by: flokli <flokli@flokli.de> Tested-by: BuildkiteCI
This commit is contained in:
parent
f2ca30774e
commit
14fe65a50b
3 changed files with 63 additions and 20 deletions
|
|
@ -119,6 +119,7 @@ mod import_builtins {
|
|||
|
||||
use super::*;
|
||||
|
||||
use nix_compat::nixhash::{CAHash, NixHash};
|
||||
use tvix_eval::generators::Gen;
|
||||
use tvix_eval::{generators::GenCo, ErrorKind, Value};
|
||||
|
||||
|
|
@ -138,8 +139,19 @@ mod import_builtins {
|
|||
Ok(state
|
||||
.tokio_handle
|
||||
.block_on(async {
|
||||
let (_, nar_sha256) = state
|
||||
.path_info_service
|
||||
.as_ref()
|
||||
.calculate_nar(&root_node)
|
||||
.await?;
|
||||
|
||||
state
|
||||
.register_node_in_path_info_service(name, &p, root_node)
|
||||
.register_node_in_path_info_service(
|
||||
name,
|
||||
&p,
|
||||
CAHash::Nar(NixHash::Sha256(nar_sha256)),
|
||||
root_node,
|
||||
)
|
||||
.await
|
||||
})
|
||||
.map_err(|err| ErrorKind::IO {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue