shithub: furgit

Download patch

ref: 0f67e6f5f29d765105a1c48017de37df12755417
parent: 5c4e61830242a3a25e332bf623adb2eb65037f2b
author: Runxi Yu <runxiyu@umich.edu>
date: Sun Mar 22 19:47:55 EDT 2026

objectstore/packed: Document refresh semantics

--- a/objectstore/packed/close.go
+++ b/objectstore/packed/close.go
@@ -3,6 +3,7 @@
 // Close releases mapped pack/index resources associated with the store.
 //
 // Store borrows its root, so Close does not close it.
+// Close releases cached pack/index mappings retained by the store.
 //
 // Repeated calls to Close are undefined behavior.
 func (store *Store) Close() error {
--- a/objectstore/packed/idx_lookup_candidates.go
+++ b/objectstore/packed/idx_lookup_candidates.go
@@ -22,7 +22,12 @@
 	candidateByPack map[string]packCandidate
 }
 
-// Refresh rescans objects/pack and atomically installs a fresh candidate list.
+// Refresh rescans objects/pack and atomically installs a fresh candidate list
+// for future lookups.
+//
+// Refresh does not invalidate existing readers. Cached pack/index mappings,
+// including ones for previously visible candidates, may be retained until
+// Close.
 func (store *Store) Refresh() error {
 	store.refreshMu.Lock()
 	defer store.refreshMu.Unlock()
--- a/objectstore/packed/store.go
+++ b/objectstore/packed/store.go
@@ -11,6 +11,8 @@
 )
 
 // Store reads Git objects from pack/index files under an objects/pack root.
+//
+// Store borrows its root. Cached pack/index mappings are retained until Close.
 type Store struct {
 	// root is the borrowed objects/pack capability used for all file access.
 	root *os.Root
--