diff options
Diffstat (limited to 'tvix/nar-bridge/pkg/http/server.go')
-rw-r--r-- | tvix/nar-bridge/pkg/http/server.go | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/tvix/nar-bridge/pkg/http/server.go b/tvix/nar-bridge/pkg/http/server.go index e8eb229ab41a..aa8037e2ba38 100644 --- a/tvix/nar-bridge/pkg/http/server.go +++ b/tvix/nar-bridge/pkg/http/server.go @@ -25,11 +25,17 @@ type Server struct { // When uploading NAR files to a HTTP binary cache, the .nar // files are uploaded before the .narinfo files. // We need *both* to be able to fully construct a PathInfo object. - // Keep a in-memory map of narhash(es) (in SRI) to sparse PathInfo. + // Keep a in-memory map of narhash(es) (in SRI) to (unnamed) root node and nar + // size. // This is necessary until we can ask a PathInfoService for a node with a given // narSha256. - narHashToPathInfoMu sync.Mutex - narHashToPathInfo map[string]*storev1pb.PathInfo + narDbMu sync.Mutex + narDb map[string]*narData +} + +type narData struct { + rootNode *castorev1pb.Node + narSize uint64 } func New( @@ -64,7 +70,7 @@ func New( directoryServiceClient: directoryServiceClient, blobServiceClient: blobServiceClient, pathInfoServiceClient: pathInfoServiceClient, - narHashToPathInfo: make(map[string]*storev1pb.PathInfo), + narDb: make(map[string]*narData), } registerNarPut(s) |