lib/model: Integrate stat refs in folder (#5596)

This commit is contained in:
Simon Frei
2019-03-11 17:57:21 +01:00
committed by Audrius Butkevicius
parent 84fe285659
commit 289a02e994
3 changed files with 13 additions and 25 deletions

View File

@@ -25,6 +25,7 @@ import (
"github.com/syncthing/syncthing/lib/osutil"
"github.com/syncthing/syncthing/lib/protocol"
"github.com/syncthing/syncthing/lib/scanner"
"github.com/syncthing/syncthing/lib/stats"
"github.com/syncthing/syncthing/lib/sync"
"github.com/syncthing/syncthing/lib/watchaggregator"
)
@@ -37,6 +38,8 @@ var errWatchNotStarted = errors.New("not started")
type folder struct {
stateTracker
config.FolderConfiguration
*stats.FolderStatisticsReference
localFlags uint32
model *model
@@ -79,8 +82,9 @@ func newFolder(model *model, fset *db.FileSet, ignores *ignore.Matcher, cfg conf
ctx, cancel := context.WithCancel(context.Background())
return folder{
stateTracker: newStateTracker(cfg.ID),
FolderConfiguration: cfg,
stateTracker: newStateTracker(cfg.ID),
FolderConfiguration: cfg,
FolderStatisticsReference: stats.NewFolderStatisticsReference(model.db, cfg.ID),
model: model,
shortID: model.shortID,
@@ -532,7 +536,7 @@ func (f *folder) scanSubdirs(subDirs []string) error {
return err
}
f.model.folderStatRef(f.ID).ScanCompleted()
f.ScanCompleted()
f.setState(FolderIdle)
return nil
}