lib/model: Create folders via newFolder
GitHub-Pull-Request: https://github.com/syncthing/syncthing/pull/4329
This commit is contained in:
committed by
Audrius Butkevicius
parent
c7221b035d
commit
ddf6d64faa
@@ -9,10 +9,13 @@ package model
|
||||
import (
|
||||
"context"
|
||||
"time"
|
||||
|
||||
"github.com/syncthing/syncthing/lib/config"
|
||||
)
|
||||
|
||||
type folder struct {
|
||||
stateTracker
|
||||
config.FolderConfiguration
|
||||
|
||||
scan folderScanner
|
||||
model *Model
|
||||
@@ -21,9 +24,23 @@ type folder struct {
|
||||
initialScanFinished chan struct{}
|
||||
}
|
||||
|
||||
func (f *folder) IndexUpdated() {
|
||||
func newFolder(model *Model, cfg config.FolderConfiguration) folder {
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
|
||||
return folder{
|
||||
stateTracker: newStateTracker(cfg.ID),
|
||||
FolderConfiguration: cfg,
|
||||
|
||||
scan: newFolderScanner(cfg),
|
||||
ctx: ctx,
|
||||
cancel: cancel,
|
||||
model: model,
|
||||
initialScanFinished: make(chan struct{}),
|
||||
}
|
||||
}
|
||||
|
||||
func (f *folder) IndexUpdated() {
|
||||
}
|
||||
func (f *folder) DelayScan(next time.Duration) {
|
||||
f.scan.Delay(next)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user