feat(tvix/nar-bridge): support uploading NAR files

This ingests NAR files into the {Blob,Directory}Service, which are
already part of the AppState.

As we then need to correlate the root node to the uploaded PathInfo, we
need to keep a (short-lived) lookup table from NARHash to root node
around. We insert it into a `LruCache` after the NAR is uploaded, and
use `peek()` to do the lookup, which doesn't update the LRU list.

Change-Id: I48a4c6246bacf76559c5a4ccad2a0bc25c1b7900
Reviewed-on: https://cl.tvl.fyi/c/depot/+/11986
Tested-by: BuildkiteCI
Reviewed-by: Brian Olsen <me@griff.name>
This commit is contained in:
Florian Klink 2024-07-20 10:03:47 +02:00 committed by flokli
parent 861cc1f341
commit 5d906054da
5 changed files with 158 additions and 13 deletions

13
tvix/Cargo.lock generated
View file

@ -2246,9 +2246,12 @@ dependencies = [
"bytes",
"clap",
"data-encoding",
"futures",
"hex-literal",
"itertools 0.12.0",
"lru",
"nix-compat",
"parking_lot 0.12.3",
"prost",
"prost-build",
"rstest",
@ -2436,7 +2439,7 @@ dependencies = [
"hyper 0.14.28",
"itertools 0.12.0",
"md-5",
"parking_lot 0.12.2",
"parking_lot 0.12.3",
"percent-encoding",
"quick-xml",
"rand",
@ -2599,9 +2602,9 @@ dependencies = [
[[package]]
name = "parking_lot"
version = "0.12.2"
version = "0.12.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7e4af0ca4f6caed20e900d564c242b8e5d4903fdacf31d3daf527b66fe6f42fb"
checksum = "f1bf18183cf54e8d6059647fc3063646a1801cf30896933ec2311622cc4b9a27"
dependencies = [
"lock_api",
"parking_lot_core 0.9.9",
@ -4542,7 +4545,7 @@ dependencies = [
"lazy_static",
"libc",
"object_store",
"parking_lot 0.12.2",
"parking_lot 0.12.3",
"petgraph",
"pin-project-lite",
"prost",
@ -4727,7 +4730,7 @@ dependencies = [
"lazy_static",
"lru",
"nix-compat",
"parking_lot 0.12.2",
"parking_lot 0.12.3",
"pin-project-lite",
"prost",
"prost-build",