refactor(tvix/nar-bridge): pass root node to storev1pb.Export

Bumps the go module past cl/9604 and update the consumer side.

Change-Id: Id44245017f1dc2f8aac28051cdbb45b83bdc5be3
Reviewed-on: https://cl.tvl.fyi/c/depot/+/9650
Reviewed-by: Brian McGee <brian@bmcgee.ie>
Tested-by: BuildkiteCI
This commit is contained in:
Florian Klink 2023-10-11 11:21:57 +02:00 committed by flokli
parent 930edb69d7
commit ceb1674e9f
5 changed files with 6 additions and 6 deletions

View file

@ -6,5 +6,5 @@ pkgs.buildGoModule {
name = "nar-bridge"; name = "nar-bridge";
src = depot.third_party.gitignoreSource ./.; src = depot.third_party.gitignoreSource ./.;
vendorHash = "sha256-Lb0MOziF86JrnrA9SibHYQAaS7H054Nuf3l8tm/9Sf8="; vendorHash = "sha256-gieFaLB3vgoSqCARCe8PZeJE8H2YQ48Fj2h2DBzUXu8=";
} }

View file

@ -2,7 +2,7 @@ module code.tvl.fyi/tvix/nar-bridge
require ( require (
code.tvl.fyi/tvix/castore/protos v0.0.0-20231009220507-d6e0c5ab9bb7 code.tvl.fyi/tvix/castore/protos v0.0.0-20231009220507-d6e0c5ab9bb7
code.tvl.fyi/tvix/store/protos v0.0.0-20231010185549-e7ea67342035 code.tvl.fyi/tvix/store/protos v0.0.0-20231010202247-8ec3506856aa
github.com/alecthomas/kong v0.7.1 github.com/alecthomas/kong v0.7.1
github.com/go-chi/chi v1.5.4 github.com/go-chi/chi v1.5.4
github.com/go-chi/chi/v5 v5.0.7 github.com/go-chi/chi/v5 v5.0.7

View file

@ -1,7 +1,7 @@
code.tvl.fyi/tvix/castore/protos v0.0.0-20231009220507-d6e0c5ab9bb7 h1:gX2LWo/QHwGZK2QsDap9Lx1GrKLPX6mfgeNbGK3mwrU= code.tvl.fyi/tvix/castore/protos v0.0.0-20231009220507-d6e0c5ab9bb7 h1:gX2LWo/QHwGZK2QsDap9Lx1GrKLPX6mfgeNbGK3mwrU=
code.tvl.fyi/tvix/castore/protos v0.0.0-20231009220507-d6e0c5ab9bb7/go.mod h1:hj0y8RPthqn1QPj8u2jFe2vzH7NouUoclrwo1/CSbuc= code.tvl.fyi/tvix/castore/protos v0.0.0-20231009220507-d6e0c5ab9bb7/go.mod h1:hj0y8RPthqn1QPj8u2jFe2vzH7NouUoclrwo1/CSbuc=
code.tvl.fyi/tvix/store/protos v0.0.0-20231010185549-e7ea67342035 h1:/CjyjG/4PiByWnO6q26bLGjFPP96oZCMMX63UA9wkdc= code.tvl.fyi/tvix/store/protos v0.0.0-20231010202247-8ec3506856aa h1:FwMglyEtXebo5rXgtLkxs+y11UVxAekGboFotdbfHcg=
code.tvl.fyi/tvix/store/protos v0.0.0-20231010185549-e7ea67342035/go.mod h1:RmijF3bfElwtZpNkBtW66QEj/jldGNu+W2HlgZro7lw= code.tvl.fyi/tvix/store/protos v0.0.0-20231010202247-8ec3506856aa/go.mod h1:RmijF3bfElwtZpNkBtW66QEj/jldGNu+W2HlgZro7lw=
github.com/alecthomas/assert/v2 v2.1.0 h1:tbredtNcQnoSd3QBhQWI7QZ3XHOVkw1Moklp2ojoH/0= github.com/alecthomas/assert/v2 v2.1.0 h1:tbredtNcQnoSd3QBhQWI7QZ3XHOVkw1Moklp2ojoH/0=
github.com/alecthomas/kong v0.7.1 h1:azoTh0IOfwlAX3qN9sHWTxACE2oV8Bg2gAwBsMwDQY4= github.com/alecthomas/kong v0.7.1 h1:azoTh0IOfwlAX3qN9sHWTxACE2oV8Bg2gAwBsMwDQY4=
github.com/alecthomas/kong v0.7.1/go.mod h1:n1iCIO2xS46oE8ZfYCNDqdR0b0wZNrXAIAqro/2132U= github.com/alecthomas/kong v0.7.1/go.mod h1:n1iCIO2xS46oE8ZfYCNDqdR0b0wZNrXAIAqro/2132U=

View file

@ -95,7 +95,7 @@ func renderNar(
// render the NAR file // render the NAR file
err := storev1pb.Export( err := storev1pb.Export(
w, w,
pathInfo, pathInfo.Node,
func(directoryDigest []byte) (*castorev1pb.Directory, error) { func(directoryDigest []byte) (*castorev1pb.Directory, error) {
log.WithField("directory", base64.StdEncoding.EncodeToString(directoryDigest)).Debug("Get directory") log.WithField("directory", base64.StdEncoding.EncodeToString(directoryDigest)).Debug("Get directory")
directoryRefStr := hex.EncodeToString(directoryDigest) directoryRefStr := hex.EncodeToString(directoryDigest)

View file

@ -59,7 +59,7 @@ func TestRoundtrip(t *testing.T) {
var buf bytes.Buffer var buf bytes.Buffer
err = storev1pb.Export( err = storev1pb.Export(
&buf, &buf,
pathInfo, pathInfo.Node,
func(directoryDgst []byte) (*castorev1pb.Directory, error) { func(directoryDgst []byte) (*castorev1pb.Directory, error) {
d, found := directoriesMap[base64.StdEncoding.EncodeToString(directoryDgst)] d, found := directoriesMap[base64.StdEncoding.EncodeToString(directoryDgst)]
if !found { if !found {