docs(tvix/nar-bridge): add more comments for DirectoriesUploader.
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
This commit is contained in:
parent
d3c44ab03d
commit
259269482c
1 changed files with 5 additions and 1 deletions
|
@ -9,6 +9,10 @@ import (
|
||||||
log "github.com/sirupsen/logrus"
|
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 {
|
type DirectoriesUploader struct {
|
||||||
ctx context.Context
|
ctx context.Context
|
||||||
directoryServiceClient castorev1pb.DirectoryServiceClient
|
directoryServiceClient castorev1pb.DirectoryServiceClient
|
||||||
|
@ -49,7 +53,7 @@ func (du *DirectoriesUploader) Put(directory *castorev1pb.Directory) ([]byte, er
|
||||||
return directoryDigest, nil
|
return directoryDigest, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Done is called whenever we're
|
// Done closes the stream and returns the response.
|
||||||
func (du *DirectoriesUploader) Done() (*castorev1pb.PutDirectoryResponse, error) {
|
func (du *DirectoriesUploader) Done() (*castorev1pb.PutDirectoryResponse, error) {
|
||||||
// only close once, and only if we opened.
|
// only close once, and only if we opened.
|
||||||
if du.directoryServicePutStream == nil {
|
if du.directoryServicePutStream == nil {
|
||||||
|
|
Loading…
Reference in a new issue