about summary refs log tree commit diff
path: root/tvix/nar-bridge/pkg/server/nar_get.go
diff options
context:
space:
mode:
authorFlorian Klink <flokli@flokli.de>2023-09-22T13·38+0300
committerflokli <flokli@flokli.de>2023-09-22T17·41+0000
commit732dc68727caa09c2e430fa6822b40ed9b6153f7 (patch)
tree5b961c859a00eb688b3f25ffb9858777b101e81a /tvix/nar-bridge/pkg/server/nar_get.go
parente13c86d91647bfb0909a7a5eedb9b6d69901dbdd (diff)
refactor(tvix/nar-bridge): update to new separated protos r/6633
Change-Id: I5eaadc837a4d3a7f635574437127a22de88f556b
Reviewed-on: https://cl.tvl.fyi/c/depot/+/9407
Tested-by: BuildkiteCI
Reviewed-by: Connor Brewster <cbrewster@hey.com>
Autosubmit: flokli <flokli@flokli.de>
Diffstat (limited to 'tvix/nar-bridge/pkg/server/nar_get.go')
-rw-r--r--tvix/nar-bridge/pkg/server/nar_get.go15
1 files changed, 8 insertions, 7 deletions
diff --git a/tvix/nar-bridge/pkg/server/nar_get.go b/tvix/nar-bridge/pkg/server/nar_get.go
index d31fa1fbeeab..7397992611fc 100644
--- a/tvix/nar-bridge/pkg/server/nar_get.go
+++ b/tvix/nar-bridge/pkg/server/nar_get.go
@@ -12,6 +12,7 @@ import (
 	"net/http"
 	"sync"
 
+	castorev1pb "code.tvl.fyi/tvix/castore/protos"
 	"code.tvl.fyi/tvix/nar-bridge/pkg/writer"
 	storev1pb "code.tvl.fyi/tvix/store/protos"
 	"github.com/go-chi/chi/v5"
@@ -27,8 +28,8 @@ const (
 func renderNar(
 	ctx context.Context,
 	log *log.Entry,
-	directoryServiceClient storev1pb.DirectoryServiceClient,
-	blobServiceClient storev1pb.BlobServiceClient,
+	directoryServiceClient castorev1pb.DirectoryServiceClient,
+	blobServiceClient castorev1pb.BlobServiceClient,
 	narHashToPathInfoMu *sync.Mutex,
 	narHashToPathInfo map[string]*storev1pb.PathInfo,
 	w io.Writer,
@@ -50,15 +51,15 @@ func renderNar(
 		return nil
 	}
 
-	directories := make(map[string]*storev1pb.Directory)
+	directories := make(map[string]*castorev1pb.Directory)
 
 	// If the root node is a directory, ask the directory service for all directories
 	if pathInfoDirectory := pathInfo.GetNode().GetDirectory(); pathInfoDirectory != nil {
 		rootDirectoryDigest := pathInfoDirectory.GetDigest()
 		log = log.WithField("root_directory", base64.StdEncoding.EncodeToString(rootDirectoryDigest))
 
-		directoryStream, err := directoryServiceClient.Get(ctx, &storev1pb.GetDirectoryRequest{
-			ByWhat: &storev1pb.GetDirectoryRequest_Digest{
+		directoryStream, err := directoryServiceClient.Get(ctx, &castorev1pb.GetDirectoryRequest{
+			ByWhat: &castorev1pb.GetDirectoryRequest_Digest{
 				Digest: rootDirectoryDigest,
 			},
 			Recursive: true,
@@ -96,7 +97,7 @@ func renderNar(
 	err := writer.Export(
 		w,
 		pathInfo,
-		func(directoryDigest []byte) (*storev1pb.Directory, error) {
+		func(directoryDigest []byte) (*castorev1pb.Directory, error) {
 			log.WithField("directory", base64.StdEncoding.EncodeToString(directoryDigest)).Debug("Get directory")
 			directoryRefStr := hex.EncodeToString(directoryDigest)
 			directory, found := directories[directoryRefStr]
@@ -112,7 +113,7 @@ func renderNar(
 		},
 		func(blobDigest []byte) (io.ReadCloser, error) {
 			log.WithField("blob", base64.StdEncoding.EncodeToString(blobDigest)).Debug("Get blob")
-			resp, err := blobServiceClient.Read(ctx, &storev1pb.ReadBlobRequest{
+			resp, err := blobServiceClient.Read(ctx, &castorev1pb.ReadBlobRequest{
 				Digest: blobDigest,
 			})
 			if err != nil {