Skip to content

Commit

Permalink
Merge pull request #58 from fwiesel/handle_cache_miss
Browse files Browse the repository at this point in the history
Handle cache-miss in CachingHandler
  • Loading branch information
willscott committed Dec 21, 2022
2 parents ccfcb72 + 75bfc5a commit e04a5b5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,6 @@ type Handler interface {
type CachingHandler interface {
VerifierFor(path string, contents []fs.FileInfo) uint64

// fs.FileInfo needs to be sorted by Name()
// fs.FileInfo needs to be sorted by Name(), nil in case of a cache-miss
DataForVerifier(path string, verifier uint64) []fs.FileInfo
}
4 changes: 3 additions & 1 deletion nfs_onreaddir.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,9 @@ func getDirListingWithVerifier(userHandle Handler, fsHandle []byte, verifier uin
// see if the verifier has this dir cached:
if vh, ok := userHandle.(CachingHandler); verifier != 0 && ok {
entries := vh.DataForVerifier(path, verifier)
return entries, verifier, nil
if entries != nil {
return entries, verifier, nil
}
}
// load the entries.
contents, err := fs.ReadDir(path)
Expand Down

0 comments on commit e04a5b5

Please sign in to comment.