syncthing/lib
André Colomb e32a516b5f
lib/model: Forget pending folders no longer announced in ClusterConfig (fixes #5187) (#7205)
* lib/db: Add ExpirePendingFolders().

Use-case is to drop any no-longer-pending folders for a specific
device when parsing its ClusterConfig message where previously offered
folders are not mentioned any more.

The timestamp in ObservedFolder is stored with only second precision,
so round to seconds here as well.  This allows calling the function
within the same second of adding or updating entries.

* lib/model: Weed out pending folders when receiving ClusterConfig.

Filter the entries by timestamp, which must be newer than or equal to
the reception time of the ClusterConfig.  For just mentioned ones,
this assumption will hold as AddOrUpdatePendingFolder() updates the
timestamp.

* lib/model, gui: Notify when one or more pending folders expired.

Introduce new event type FolderOfferCancelled and use it to trigger a
complete refreshCluster() cycle.  Listing individual entries would be
much more code and probably just as much work to answer the API
request.

* lib/model: Add comment and rename ExpirePendingFolders().

* lib/events: Rename FolderOfferCancelled to ClusterPendingChanged.

* lib/model: Reuse ClusterPendingChanged event for cleanPending()

Changing the config does not necessarily mean that the
/resut/cluster/pending endpoints need to be refreshed, but only if
something was actually removed.  Detect this and indicate it through
the ClusterPendingChanged event, which is already hooked up to requery
respective endpoints within the GUI.

No more need for a separate refreshCluster() in reaction to
ConfigSaved event or calling refreshConfig().

* lib/model: Gofmt.

* lib/db: Warn instead of info log for failed removal.

* gui: Fix pending notifications not loading on GUI start.

* lib/db: Use short device ID in log message.

* lib/db: Return list of expired folder IDs after deleting them.

* lib/model: Refactor Pending...Changed events.

* lib/model: Adjust format of removed pending folders enumeration.

Use an array of objects with device / folder ID properties, matching
the other places where it's used.

* lib/db: Drop invalid entries in RemovePendingFoldersBeforeTime().

* lib/model: Gofmt.

My local gofmt did not complain here, strangely...

* gui: Handle PendingDevicesChanged event.

Even though it currently only holds one device at a time, wrap the
contents in an array under the "added" property name.

* lib/model: Fix null values in PendingFoldersChanged removed member.

* gui: Handle PendingFoldersChanged event.

* lib/model: Simplify construction of expiredPendingList.

* lib/model: Reduce code duplication in cleanPending().

Use goto and a label for the common parts of calling the DB removal
function and building the event data part.

* lib/events, gui: Mark ...Rejected events deprecated.

Extend comments explaining the conditions when the replacement event
types are emitted.

* lib/model: Wrap removed devices in array of objects as well.

* lib/db: Use iter.Value() instead of needless db.Get(iter.Key())

* lib/db: Add comment explaining RemovePendingFoldersBeforeTime().

* lib/model: Rename fields folderID and deviceID in event data.

* lib/db: Only list actually expired IDs as removed.

Skip entries where Delete() failed as well as invalid entries that got
removed automatically.

* lib/model: Gofmt
2021-01-25 10:58:10 +00:00
..
api lib: Apply config changes sequentially (ref #5298) (#7188) 2021-01-15 15:43:34 +01:00
assets lib/assets: Allow assets to remain uncompressed (#6661) 2020-05-25 08:51:27 +02:00
beacon lib/ur: Send unreported failures on shutdown (#7164) 2020-12-22 20:17:14 +01:00
build lib/api: Returns tags in version as list (#7190) 2020-12-10 12:22:09 +01:00
config lib: Apply config changes sequentially (ref #5298) (#7188) 2021-01-15 15:43:34 +01:00
connections lib: Apply config changes sequentially (ref #5298) (#7188) 2021-01-15 15:43:34 +01:00
db lib/model: Forget pending folders no longer announced in ClusterConfig (fixes #5187) (#7205) 2021-01-25 10:58:10 +00:00
dialer lib/dialer: Try dialing without reuse in parallel (fixes #6892) (#6893) 2020-08-18 13:11:12 +02:00
discover lib/ur: Send unreported failures on shutdown (#7164) 2020-12-22 20:17:14 +01:00
events lib/model: Forget pending folders no longer announced in ClusterConfig (fixes #5187) (#7205) 2021-01-25 10:58:10 +00:00
fs lib/fs: Avoid blocking new caseFs creation while waiting to drop cache (fixes #7273) (#7275) 2021-01-13 17:45:29 +01:00
ignore gui, lib/ignore: Handle editing ignores with error (fixes #5425) (#6757) 2020-06-18 11:04:00 +02:00
locations all: Handle errors opening db/creating file-set (ref #5907) (#7150) 2020-12-21 12:59:22 +01:00
logger all, lib/logger: Refactor SetDebug calls (#6054) 2019-10-04 13:03:34 +02:00
model lib/model: Forget pending folders no longer announced in ClusterConfig (fixes #5187) (#7205) 2021-01-25 10:58:10 +00:00
nat all: Refactor preparing configuration (#7127) 2020-11-20 14:21:54 +01:00
osutil lib/osutil: Consider sync() best effort (fixes #7117) 2020-11-14 09:23:27 +01:00
pmp lib/nat: Make service termination faster (#6777) 2020-06-22 09:01:57 +01:00
protocol lib/connections, lib/model: Track last connection duration (ref #7223) (#7242) 2021-01-05 17:45:07 +01:00
rand lib/rand: Various minor fixes (#6752) 2020-06-17 10:43:58 +02:00
rc test, lib/model: Various integration test updates & improvements (#6956) 2020-09-07 09:35:37 +02:00
relay lib/ur: Send unreported failures on shutdown (#7164) 2020-12-22 20:17:14 +01:00
scanner all: Implement suture v4-api (#6947) 2020-11-17 13:19:04 +01:00
sha256 Add indirection for large version vectors. (#6376) 2020-05-13 14:28:42 +02:00
signature all: Update license url to https (ref #3976) 2017-02-09 08:04:16 +01:00
stats lib/connections, lib/model: Track last connection duration (ref #7223) (#7242) 2021-01-05 17:45:07 +01:00
stun lib/stun: Don't notify about address changes if it's not useful (fixes #7144) (#7159) 2020-11-27 07:34:30 +01:00
svcutil lib/ur: Send unreported failures on shutdown (#7164) 2020-12-22 20:17:14 +01:00
sync lib/sync: Cleanly fail instead of panic in tests (#6088) 2019-10-16 10:11:11 +02:00
syncthing cmd/syncthing: Provide early startup for config service (ref #7188) (#7285) 2021-01-16 12:58:02 +01:00
testutils lib/connections, lib/model: Track last connection duration (ref #7223) (#7242) 2021-01-05 17:45:07 +01:00
tlsutil lib/tlsutil: Add O and OU to generated certificates (fixes #7108) (#7109) 2020-11-09 17:02:56 +01:00
upgrade all: Tweak error creation (#6391) 2020-03-03 22:40:00 +01:00
upnp lib/nat: Make service termination faster (#6777) 2020-06-22 09:01:57 +01:00
ur lib: Apply config changes sequentially (ref #5298) (#7188) 2021-01-15 15:43:34 +01:00
util lib/util: Remove duplicate error handling code (#7299) 2021-01-24 20:19:10 +01:00
versioner Created cleanup functionality for syncthing (#6884) 2020-08-24 12:14:30 +01:00
watchaggregator all: Refactor preparing configuration (#7127) 2020-11-20 14:21:54 +01:00
weakhash lib/weakhash: Fix speed reporting in benchmark (#6470) 2020-03-29 17:07:25 +02:00