about summary refs log tree commit diff
diff options
context:
space:
mode:
authorFlorian Klink <flokli@flokli.de>2023-10-03T11·29+0300
committerflokli <flokli@flokli.de>2023-10-05T06·17+0000
commitd3c44ab03d14bc143e790426bede465feb871cd5 (patch)
tree0c8abf1595ec6f5aa127639f60c8f4a7a808ca01
parent49b427d7736b11ba05892126f63557146a642a67 (diff)
refactor(tvix/nar-bridge): rename writer package to exporter r/6696
Change-Id: I7cf6a3ed0dca4c450fadd9228dc0154ad6254f51
Reviewed-on: https://cl.tvl.fyi/c/depot/+/9530
Tested-by: BuildkiteCI
Reviewed-by: Connor Brewster <cbrewster@hey.com>
Autosubmit: flokli <flokli@flokli.de>
-rw-r--r--tvix/nar-bridge/pkg/exporter/export.go (renamed from tvix/nar-bridge/pkg/writer/writer.go)4
-rw-r--r--tvix/nar-bridge/pkg/exporter/export_test.go (renamed from tvix/nar-bridge/pkg/writer/writer_test.go)12
-rw-r--r--tvix/nar-bridge/pkg/exporter/pick_next_node_test.go (renamed from tvix/nar-bridge/pkg/writer/writer_pick_next_node_test.go)2
-rw-r--r--tvix/nar-bridge/pkg/server/nar_get.go4
4 files changed, 11 insertions, 11 deletions
diff --git a/tvix/nar-bridge/pkg/writer/writer.go b/tvix/nar-bridge/pkg/exporter/export.go
index fd154e061bf0..40ccc4b6380c 100644
--- a/tvix/nar-bridge/pkg/writer/writer.go
+++ b/tvix/nar-bridge/pkg/exporter/export.go
@@ -1,4 +1,4 @@
-package writer
+package exporter
 
 import (
 	"fmt"
@@ -13,7 +13,7 @@ import (
 type DirectoryLookupFn func([]byte) (*castorev1pb.Directory, error)
 type BlobLookupFn func([]byte) (io.ReadCloser, error)
 
-// Export will traverse a given pathInfo structure, and write the contents
+// Export will traverse a given PathInfo structure, and write the contents
 // in NAR format to the passed Writer.
 // It uses directoryLookupFn and blobLookupFn to resolve references.
 func Export(
diff --git a/tvix/nar-bridge/pkg/writer/writer_test.go b/tvix/nar-bridge/pkg/exporter/export_test.go
index 881045b173d5..ffee62f29183 100644
--- a/tvix/nar-bridge/pkg/writer/writer_test.go
+++ b/tvix/nar-bridge/pkg/exporter/export_test.go
@@ -1,4 +1,4 @@
-package writer_test
+package exporter_test
 
 import (
 	"bytes"
@@ -10,8 +10,8 @@ import (
 	"testing"
 
 	castorev1pb "code.tvl.fyi/tvix/castore/protos"
+	"code.tvl.fyi/tvix/nar-bridge/pkg/exporter"
 	"code.tvl.fyi/tvix/nar-bridge/pkg/importer"
-	"code.tvl.fyi/tvix/nar-bridge/pkg/writer"
 	storev1pb "code.tvl.fyi/tvix/store/protos"
 	"github.com/stretchr/testify/require"
 	"lukechampine.com/blake3"
@@ -49,7 +49,7 @@ func TestSymlink(t *testing.T) {
 
 	var buf bytes.Buffer
 
-	err := writer.Export(&buf, pathInfo, func([]byte) (*castorev1pb.Directory, error) {
+	err := exporter.Export(&buf, pathInfo, func([]byte) (*castorev1pb.Directory, error) {
 		panic("no directories expected")
 	}, func([]byte) (io.ReadCloser, error) {
 		panic("no files expected")
@@ -90,7 +90,7 @@ func TestRegular(t *testing.T) {
 
 	var buf bytes.Buffer
 
-	err := writer.Export(&buf, pathInfo, func([]byte) (*castorev1pb.Directory, error) {
+	err := exporter.Export(&buf, pathInfo, func([]byte) (*castorev1pb.Directory, error) {
 		panic("no directories expected")
 	}, func(blobRef []byte) (io.ReadCloser, error) {
 		if !bytes.Equal(blobRef, BLAKE3_DIGEST_0X01) {
@@ -134,7 +134,7 @@ func TestEmptyDirectory(t *testing.T) {
 
 	var buf bytes.Buffer
 
-	err := writer.Export(&buf, pathInfo, func(directoryRef []byte) (*castorev1pb.Directory, error) {
+	err := exporter.Export(&buf, pathInfo, func(directoryRef []byte) (*castorev1pb.Directory, error) {
 		if !bytes.Equal(directoryRef, emptyDirectoryDigest) {
 			panic("unexpected directoryRef")
 		}
@@ -196,7 +196,7 @@ func TestFull(t *testing.T) {
 
 	// done populating everything, now actually test the export :-)
 	var buf bytes.Buffer
-	err = writer.Export(
+	err = exporter.Export(
 		&buf,
 		pathInfo,
 		func(directoryDgst []byte) (*castorev1pb.Directory, error) {
diff --git a/tvix/nar-bridge/pkg/writer/writer_pick_next_node_test.go b/tvix/nar-bridge/pkg/exporter/pick_next_node_test.go
index d69adca89cb7..c80261ae6b6a 100644
--- a/tvix/nar-bridge/pkg/writer/writer_pick_next_node_test.go
+++ b/tvix/nar-bridge/pkg/exporter/pick_next_node_test.go
@@ -1,4 +1,4 @@
-package writer
+package exporter
 
 import (
 	"testing"
diff --git a/tvix/nar-bridge/pkg/server/nar_get.go b/tvix/nar-bridge/pkg/server/nar_get.go
index 7397992611fc..3ccb8d658d72 100644
--- a/tvix/nar-bridge/pkg/server/nar_get.go
+++ b/tvix/nar-bridge/pkg/server/nar_get.go
@@ -13,7 +13,7 @@ import (
 	"sync"
 
 	castorev1pb "code.tvl.fyi/tvix/castore/protos"
-	"code.tvl.fyi/tvix/nar-bridge/pkg/writer"
+	"code.tvl.fyi/tvix/nar-bridge/pkg/exporter"
 	storev1pb "code.tvl.fyi/tvix/store/protos"
 	"github.com/go-chi/chi/v5"
 	nixhash "github.com/nix-community/go-nix/pkg/hash"
@@ -94,7 +94,7 @@ func renderNar(
 	}
 
 	// render the NAR file
-	err := writer.Export(
+	err := exporter.Export(
 		w,
 		pathInfo,
 		func(directoryDigest []byte) (*castorev1pb.Directory, error) {