|
|
|
|
@ -455,13 +455,20 @@ func (f *DBFS) Get(ctx context.Context, path *fs.URI, opts ...fs.Option) (fs.Fil
|
|
|
|
|
return nil, fs.ErrOwnerOnly
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// first, try to load from cache
|
|
|
|
|
summary, ok := f.cache.Get(fmt.Sprintf("%s%d", folderSummaryCachePrefix, target.ID()))
|
|
|
|
|
if ok {
|
|
|
|
|
summaryTyped := summary.(fs.FolderSummary)
|
|
|
|
|
target.FileFolderSummary = &summaryTyped
|
|
|
|
|
} else {
|
|
|
|
|
// cache miss, walk the folder to get the summary
|
|
|
|
|
loadFolderSummaryDone := false
|
|
|
|
|
|
|
|
|
|
// first, try to load from cache if cache is not bypassed
|
|
|
|
|
if !o.bypassFolderSummaryCache {
|
|
|
|
|
summary, ok := f.cache.Get(fmt.Sprintf("%s%d", folderSummaryCachePrefix, target.ID()))
|
|
|
|
|
if ok {
|
|
|
|
|
summaryTyped := summary.(fs.FolderSummary)
|
|
|
|
|
target.FileFolderSummary = &summaryTyped
|
|
|
|
|
loadFolderSummaryDone = true
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if !loadFolderSummaryDone {
|
|
|
|
|
// cache miss or bypass, walk the folder to get the summary
|
|
|
|
|
newSummary := &fs.FolderSummary{Completed: true}
|
|
|
|
|
if f.user.Edges.Group == nil {
|
|
|
|
|
return nil, fmt.Errorf("user group not loaded")
|
|
|
|
|
|