MCPcopy
hub / github.com/syncthing/syncthing / RemoveAllExcept

Method RemoveAllExcept

lib/model/indexhandler.go:585–602  ·  view source on GitHub ↗

RemoveAllExcept stops all running index handlers and removes those pending to be started, except mentioned ones. It is a noop if the folder isn't known.

(except map[string]remoteFolderState)

Source from the content-addressed store, hash-verified

583// except mentioned ones.
584// It is a noop if the folder isn't known.
585func (r *indexHandlerRegistry) RemoveAllExcept(except map[string]remoteFolderState) {
586 r.mut.Lock()
587 defer r.mut.Unlock()
588
589 r.indexHandlers.Each(func(folder string, is *indexHandler) error {
590 if _, ok := except[folder]; !ok {
591 r.indexHandlers.RemoveAndWait(folder, 0)
592 l.Debugf("Removed index handler for device %v and folder %v (removeAllExcept)", r.conn.DeviceID().Short(), folder)
593 }
594 return nil
595 })
596 for folder := range r.startInfos {
597 if _, ok := except[folder]; !ok {
598 delete(r.startInfos, folder)
599 l.Debugf("Removed pending index handler for device %v and folder %v (removeAllExcept)", r.conn.DeviceID().Short(), folder)
600 }
601 }
602}
603
604// RegisterFolderState must be called whenever something about the folder
605// changes. The exception being if the folder is removed entirely, then call

Callers 1

ccHandleFoldersMethod · 0.80

Calls 6

UnlockMethod · 0.80
EachMethod · 0.80
RemoveAndWaitMethod · 0.80
DebugfMethod · 0.80
ShortMethod · 0.80
DeviceIDMethod · 0.65

Tested by

no test coverage detected