about summary refs log tree commit diff
path: root/tvix/nar-bridge/pkg
diff options
context:
space:
mode:
authorFlorian Klink <flokli@flokli.de>2023-10-03T11·37+0300
committerflokli <flokli@flokli.de>2023-10-05T06·17+0000
commit259269482c9d98e800f44b9124cf33a9d43333db (patch)
treee38db9c49370f663dcc5cd1ebabac6b2e63c3058 /tvix/nar-bridge/pkg
parentd3c44ab03d14bc143e790426bede465feb871cd5 (diff)
docs(tvix/nar-bridge): add more comments for DirectoriesUploader. r/6697
Change-Id: I6684186f3120ea42036239baa82e0ca37d3e0e6c
Reviewed-on: https://cl.tvl.fyi/c/depot/+/9531
Reviewed-by: Connor Brewster <cbrewster@hey.com>
Autosubmit: flokli <flokli@flokli.de>
Tested-by: BuildkiteCI
Diffstat (limited to 'tvix/nar-bridge/pkg')
-rw-r--r--tvix/nar-bridge/pkg/server/directory_upload.go6
1 files changed, 5 insertions, 1 deletions
diff --git a/tvix/nar-bridge/pkg/server/directory_upload.go b/tvix/nar-bridge/pkg/server/directory_upload.go
index e4a98f907577..ad04d2e389bb 100644
--- a/tvix/nar-bridge/pkg/server/directory_upload.go
+++ b/tvix/nar-bridge/pkg/server/directory_upload.go
@@ -9,6 +9,10 @@ import (
 	log "github.com/sirupsen/logrus"
 )
 
+// DirectoriesUploader opens a Put stream when it receives the first Put() call,
+// and then uses the opened stream for subsequent Put() calls.
+// When the uploading is finished, a call to Done() will close the stream and
+// return the root digest returned from the directoryServiceClient.
 type DirectoriesUploader struct {
 	ctx                       context.Context
 	directoryServiceClient    castorev1pb.DirectoryServiceClient
@@ -49,7 +53,7 @@ func (du *DirectoriesUploader) Put(directory *castorev1pb.Directory) ([]byte, er
 	return directoryDigest, nil
 }
 
-// Done is called whenever we're
+// Done closes the stream and returns the response.
 func (du *DirectoriesUploader) Done() (*castorev1pb.PutDirectoryResponse, error) {
 	// only close once, and only if we opened.
 	if du.directoryServicePutStream == nil {