Skip to content

Commit e04a5b5

Browse files
authored
Merge pull request #58 from fwiesel/handle_cache_miss
Handle cache-miss in CachingHandler
2 parents ccfcb72 + 75bfc5a commit e04a5b5

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

handler.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,6 @@ type Handler interface {
3535
type CachingHandler interface {
3636
VerifierFor(path string, contents []fs.FileInfo) uint64
3737

38-
// fs.FileInfo needs to be sorted by Name()
38+
// fs.FileInfo needs to be sorted by Name(), nil in case of a cache-miss
3939
DataForVerifier(path string, verifier uint64) []fs.FileInfo
4040
}

nfs_onreaddir.go

+3-1
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,9 @@ func getDirListingWithVerifier(userHandle Handler, fsHandle []byte, verifier uin
139139
// see if the verifier has this dir cached:
140140
if vh, ok := userHandle.(CachingHandler); verifier != 0 && ok {
141141
entries := vh.DataForVerifier(path, verifier)
142-
return entries, verifier, nil
142+
if entries != nil {
143+
return entries, verifier, nil
144+
}
143145
}
144146
// load the entries.
145147
contents, err := fs.ReadDir(path)

0 commit comments

Comments
 (0)