@@ -230,3 +230,41 @@ func folderIgnoresAlwaysReload(m *model, fcfg config.FolderConfiguration) {
|
||||
m.addAndStartFolderLockedWithIgnores(fcfg, fset, ignores)
|
||||
m.fmut.Unlock()
|
||||
}
|
||||
|
||||
func basicClusterConfig(local, remote protocol.DeviceID, folders ...string) protocol.ClusterConfig {
|
||||
var cc protocol.ClusterConfig
|
||||
for _, folder := range folders {
|
||||
cc.Folders = append(cc.Folders, protocol.Folder{
|
||||
ID: folder,
|
||||
Devices: []protocol.Device{
|
||||
{
|
||||
ID: local,
|
||||
},
|
||||
{
|
||||
ID: remote,
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
||||
return cc
|
||||
}
|
||||
|
||||
func localIndexUpdate(m *model, folder string, fs []protocol.FileInfo) {
|
||||
m.fmut.RLock()
|
||||
fset := m.folderFiles[folder]
|
||||
m.fmut.RUnlock()
|
||||
|
||||
fset.Update(protocol.LocalDeviceID, fs)
|
||||
seq := fset.Sequence(protocol.LocalDeviceID)
|
||||
filenames := make([]string, len(fs))
|
||||
for i, file := range fs {
|
||||
filenames[i] = file.Name
|
||||
}
|
||||
m.evLogger.Log(events.LocalIndexUpdated, map[string]interface{}{
|
||||
"folder": folder,
|
||||
"items": len(fs),
|
||||
"filenames": filenames,
|
||||
"sequence": seq,
|
||||
"version": seq, // legacy for sequence
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user