c04041a001
This adds an additional nar-bridge-pathinfo command. It exposes a PathInfoService for a HTTP Binary Cache, ingesting data into a BlobService/DirectoryService as it goes through the NAR file. It does this whenever it receives a Get request for a specific output path, and waits returning with the PathInfo response until it ingested the data. It does not do any sort of caching - this means it re-downloads NAR files again whenever the PathInfo is requested again, so you most likely do not want to use this currently. It's one building component as soon as we have store composition (which we currently don't, so don't use this). It can be used as an alternative mechanism to ingest data (Blobs and Directories) of a given store path from a binary cache into tvix-store. ``` ❯ nix-build -A third_party.nixpkgs.hello /nix/store/mdi7lvrn2mx7rfzv3fdq3v5yw8swiks6-hello-2.12.1 ❯ nix hash to-sri --type sha1 mdi7lvrn2mx7rfzv3fdq3v5yw8swiks6 sha1-Rs/INeK+7IGbG/u7fHoVNm96Yqs= ❯ out=$(mg build //tvix/nar-bridge) $out/bin/nar-bridge-pathinfo --log-level debug & INFO[0000] Starting nar-bridge-pathinfosvc at [::]:8001 ❯ mg run //tvix:store -- daemon & [mg] building target //tvix:store [mg] running target //tvix:store 2023-10-03T16:21:57.433739Z INFO tvix_store: tvix-store listening on [::]:8000 at src/bin/tvix-store.rs:229 ❯ evans --host localhost --port 8001 -r repl […] tvix.store.v1.PathInfoService@localhost:8001> call Get ✔ by_output_hash by_output_hash (TYPE_BYTES) => Rs/INeK+7IGbG/u7fHoVNm96Yqs= { "narinfo": { "narSha256": "sXrPtjqhSoc2u0YfM1HVZThknkSYuRuHdtKCB6wkDFo=", "narSize": "226552", "referenceNames": [ "aw2fw9ag10wr9pf0qk4nk5sxi0q0bn56-glibc-2.37-8", "mdi7lvrn2mx7rfzv3fdq3v5yw8swiks6-hello-2.12.1" ], "signatures": [ { "data": "7guDbfaF2Q29HY0c5axhtuacfxN6uxuEqeUfncDiSvMSAWvfHVMppB89ILqV8FE58pEQ04tSbMnRhR3FGPV0AA==", "name": "cache.nixos.org-1" } ] }, "node": { "directory": { "digest": "xvo6BYbYaDw76IibLu5sr+VZoj9iM0ET2RUuYSYLwKE=", "name": "bWRpN2x2cm4ybXg3cmZ6djNmZHEzdjV5dzhzd2lrczYtaGVsbG8tMi4xMi4x", "size": 141 } }, "references": [ "ptgFMIhdl2nJxMDdlDkITyXuBFc=", "Rs/INeK+7IGbG/u7fHoVNm96Yqs=" ] } ``` Change-Id: I50167d0ac081c91adf5cf2733bbc4dc0993bd46e Reviewed-on: https://cl.tvl.fyi/c/depot/+/9539 Autosubmit: flokli <flokli@flokli.de> Tested-by: BuildkiteCI Reviewed-by: Connor Brewster <cbrewster@hey.com> Reviewed-by: Brian Olsen <me@griff.name>
37 lines
1.3 KiB
Modula-2
37 lines
1.3 KiB
Modula-2
module code.tvl.fyi/tvix/nar-bridge
|
|
|
|
require (
|
|
code.tvl.fyi/tvix/castore/protos v0.0.0-20230922125121-72355662d742
|
|
code.tvl.fyi/tvix/store/protos v0.0.0-20230922125121-4251671e09c1
|
|
github.com/alecthomas/kong v0.7.1
|
|
github.com/go-chi/chi v1.5.4
|
|
github.com/go-chi/chi/v5 v5.0.7
|
|
github.com/google/go-cmp v0.5.9
|
|
github.com/nix-community/go-nix v0.0.0-20230825195510-c72199eca18e
|
|
github.com/sirupsen/logrus v1.9.0
|
|
github.com/stretchr/testify v1.8.1
|
|
google.golang.org/grpc v1.51.0
|
|
google.golang.org/protobuf v1.28.1
|
|
lukechampine.com/blake3 v1.1.7
|
|
)
|
|
|
|
require (
|
|
github.com/davecgh/go-spew v1.1.1 // indirect
|
|
github.com/golang/protobuf v1.5.2 // indirect
|
|
github.com/klauspost/cpuid/v2 v2.0.9 // indirect
|
|
github.com/minio/sha256-simd v1.0.0 // indirect
|
|
github.com/mr-tron/base58 v1.2.0 // indirect
|
|
github.com/multiformats/go-multihash v0.2.1 // indirect
|
|
github.com/multiformats/go-varint v0.0.6 // indirect
|
|
github.com/pmezard/go-difflib v1.0.0 // indirect
|
|
github.com/spaolacci/murmur3 v1.1.0 // indirect
|
|
github.com/ulikunitz/xz v0.5.11 // indirect
|
|
golang.org/x/crypto v0.0.0-20220525230936-793ad666bf5e // indirect
|
|
golang.org/x/net v0.7.0 // indirect
|
|
golang.org/x/sys v0.5.0 // indirect
|
|
golang.org/x/text v0.7.0 // indirect
|
|
google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013 // indirect
|
|
gopkg.in/yaml.v3 v3.0.1 // indirect
|
|
)
|
|
|
|
go 1.19
|