cmd/syncthing: Rename event LocalDiskUpdated -> LocalChangeDetected

I think this better reflects what it means. Also tweaks the verbose
format to be more like our other things and lightly refactors the code
to not have the boolean and include the folder in the event.

GitHub-Pull-Request: https://github.com/syncthing/syncthing/pull/3121
This commit is contained in:
Jakob Borg authored and Audrius Butkevicius committed 2016-05-19 07:01:43 +00:00
1 parent 86ca58e2a9
commit 1dbc310c9b
4 files changed
+23 -20

No files matched your search

+1 -1
View File
@@ -534,7 +534,7 @@ func syncthingMain(runtimeOptions RuntimeOptions) {
// Event subscription for the API; must start early to catch the early events. The LocalDiskUpdated
// event might overwhelm the event reciever in some situations so we will not subscribe to it here.
apiSub := events.NewBufferedSubscription(events.Default.Subscribe(events.AllEvents&^events.LocalDiskUpdated), 1000)
apiSub := events.NewBufferedSubscription(events.Default.Subscribe(events.AllEvents&^events.LocalChangeDetected), 1000)
if len(os.Getenv("GOMAXPROCS")) == 0 {
runtime.GOMAXPROCS(runtime.NumCPU())
+3 -2
View File
@@ -92,9 +92,10 @@ func (s *verboseService) formatEvent(ev events.Event) string {
data := ev.Data.(map[string]interface{})
return fmt.Sprintf("Folder %q is now %v", data["folder"], data["to"])
case events.LocalDiskUpdated:
case events.LocalChangeDetected:
data := ev.Data.(map[string]string)
return fmt.Sprintf("%s a %s: [ %s ]", data["action"], data["type"], data["path"])
// Local change detected in folder "foo": modified file /Users/jb/whatever
return fmt.Sprintf("Local change detected in folder %q: %s %s %s", data["folder"], data["action"], data["type"], data["path"])
case events.RemoteIndexUpdated:
data := ev.Data.(map[string]interface{})