about summary refs log tree commit diff
path: root/tvix/nar-bridge/pkg/reader
diff options
context:
space:
mode:
authorFlorian Klink <flokli@flokli.de>2023-09-17T18·47+0300
committerflokli <flokli@flokli.de>2023-09-18T14·02+0000
commit0c031461c3732fd925668a22a042aa5f1b2764f3 (patch)
treeda678eb24f15169e5a4510fbb775f461ef808792 /tvix/nar-bridge/pkg/reader
parent136b12ddd7d4fa32c25e907a52a7f49a449601ed (diff)
fix(tvix/nar-bridge): chunk blobs r/6610
Instead of creating one big BlobChunk containing all data, and creating
way too large proto messages, chunk blobs up to a reasonable (1MiB)
chunk size, and send them to the server like that.

Change-Id: Ia45a53956a6d7c0599cc59ac516ba37e9fb1b30e
Reviewed-on: https://cl.tvl.fyi/c/depot/+/9357
Reviewed-by: Connor Brewster <cbrewster@hey.com>
Tested-by: BuildkiteCI
Diffstat (limited to 'tvix/nar-bridge/pkg/reader')
-rw-r--r--tvix/nar-bridge/pkg/reader/reader.go6
1 files changed, 3 insertions, 3 deletions
diff --git a/tvix/nar-bridge/pkg/reader/reader.go b/tvix/nar-bridge/pkg/reader/reader.go
index 04e1e6f2ae69..76e0b8b63e86 100644
--- a/tvix/nar-bridge/pkg/reader/reader.go
+++ b/tvix/nar-bridge/pkg/reader/reader.go
@@ -41,7 +41,7 @@ func New(r io.Reader) *Reader {
 func (r *Reader) Import(
 	ctx context.Context,
 	// callback function called with each regular file content
-	fileCb func(fileReader io.Reader) error,
+	blobCb func(fileReader io.Reader) error,
 	// callback function called with each finalized directory node
 	directoryCb func(directory *storev1pb.Directory) error,
 ) (*storev1pb.PathInfo, error) {
@@ -219,9 +219,9 @@ func (r *Reader) Import(
 				// wrap reader with a reader calculating the blake3 hash
 				fileReader := NewHasher(narReader, blake3.New(32, nil))
 
-				err := fileCb(fileReader)
+				err := blobCb(fileReader)
 				if err != nil {
-					return nil, fmt.Errorf("failure from fileCb: %w", err)
+					return nil, fmt.Errorf("failure from blobCb: %w", err)
 				}
 
 				// drive the file reader to the end, in case the CB function doesn't read