Refactor / cleanup

This commit is contained in:
Jakob Borg
2014-12-30 09:35:21 +01:00
parent 2496185629
commit 5143c09bcf
6 changed files with 62 additions and 77 deletions

View File

@@ -80,7 +80,7 @@ type service interface {
Serve()
Stop()
Jobs() ([]string, []string) // In progress, Queued
Bump(string)
BringToFront(string)
}
type Model struct {
@@ -191,6 +191,7 @@ func (m *Model) StartFolderRW(folder string) {
copiers: cfg.Copiers,
pullers: cfg.Pullers,
finishers: cfg.Finishers,
queue: newJobQueue(),
}
m.folderRunners[folder] = p
m.fmut.Unlock()
@@ -1390,13 +1391,13 @@ func (m *Model) availability(folder, file string) []protocol.DeviceID {
}
// Bump the given files priority in the job queue
func (m *Model) Bump(folder, file string) {
func (m *Model) BringToFront(folder, file string) {
m.pmut.RLock()
defer m.pmut.RUnlock()
runner, ok := m.folderRunners[folder]
if ok {
runner.Bump(file)
runner.BringToFront(file)
}
}