added directory listing cache
This commit is contained in:
parent
a069baf48d
commit
4499e88245
5 changed files with 59 additions and 8 deletions
|
|
@ -28,6 +28,7 @@ type FS struct {
|
|||
dst string
|
||||
mdf *os.File
|
||||
jenc *json.Encoder
|
||||
dc *DirCache
|
||||
mm map[string]*Metadata
|
||||
prem map[string]func()
|
||||
cancel func()
|
||||
|
|
@ -56,6 +57,7 @@ func NewFS(src, dst, metadata string, log logr.Logger) (fs *FS, err error) {
|
|||
src: src,
|
||||
dst: dst,
|
||||
mdf: mdf,
|
||||
dc: NewDirCache(),
|
||||
mm: make(map[string]*Metadata),
|
||||
prem: make(map[string]func()),
|
||||
jenc: json.NewEncoder(mdf),
|
||||
|
|
@ -197,7 +199,7 @@ func (fs *FS) Open(name string) (f http.File, err error) {
|
|||
offline = true
|
||||
log.V(2).Info("dir offline mode", "path", dp)
|
||||
}
|
||||
return &Dir{f: sf}, err
|
||||
return &Dir{f: sf, dc: fs.dc}, err
|
||||
}
|
||||
md := fs.metadata(name, sfi.Size())
|
||||
return &File{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue