Asynchronously check for changes within remote change observer rather than enumerator, signal changes only when necessary#105
Merged
Conversation
Signed-off-by: Claudio Cambra <developer@claudiocambra.com>
… manager Signed-off-by: Claudio Cambra <developer@claudiocambra.com>
Signed-off-by: Claudio Cambra <developer@claudiocambra.com>
Signed-off-by: Claudio Cambra <developer@claudiocambra.com>
We will run clean up later after enumerating working set changes Signed-off-by: Claudio Cambra <developer@claudiocambra.com>
Signed-off-by: Claudio Cambra <developer@claudiocambra.com>
Signed-off-by: Claudio Cambra <developer@claudiocambra.com>
Signed-off-by: Claudio Cambra <developer@claudiocambra.com>
Signed-off-by: Claudio Cambra <developer@claudiocambra.com>
Signed-off-by: Claudio Cambra <developer@claudiocambra.com>
…king set Signed-off-by: Claudio Cambra <developer@claudiocambra.com>
…rver Signed-off-by: Claudio Cambra <developer@claudiocambra.com>
Signed-off-by: Claudio Cambra <developer@claudiocambra.com>
Signed-off-by: Claudio Cambra <developer@claudiocambra.com>
Signed-off-by: Claudio Cambra <developer@claudiocambra.com>
Signed-off-by: Claudio Cambra <developer@claudiocambra.com>
Signed-off-by: Claudio Cambra <developer@claudiocambra.com>
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR moves working set change detection out of Enumerator into RemoteChangeObserver, adds syncTime/deleted metadata flags, and updates tests to inject and validate against the database manager asynchronously.
- Add
syncTimeanddeletedproperties to item metadata and persist them in Realm. - Implement
pendingWorkingSetChangesinFilesDatabaseManagerand simplifyEnumeratorto use it. - Refactor
RemoteChangeObserverto perform async working-set checks on notifications; update tests to pass and verify via injecteddbManager.
Reviewed Changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| Sources/NextcloudFileProviderKit/Metadata/SendableItemMetadata.swift | Add syncTime and deleted fields and constructors. |
| Sources/NextcloudFileProviderKit/Metadata/RealmItemMetadata.swift | Persist new metadata fields. |
| Sources/NextcloudFileProviderKit/Metadata/ItemMetadata.swift | Extend protocol with new properties. |
| Sources/NextcloudFileProviderKit/Database/FilesDatabaseManager.swift | Mark deleted items instead of removing, add pendingWorkingSetChanges. |
| Sources/NextcloudFileProviderKit/Enumeration/RemoteChangeObserver.swift | Replace immediate notifications with async working-set checks. |
| Sources/NextcloudFileProviderKit/Enumeration/Enumerator.swift | Simplify change enumeration using DB-driven pending changes. |
| Tests/NextcloudFileProviderKitTests/RemoteChangeObserverTests.swift | Inject dbManager, update setup & assertions. |
| Tests/NextcloudFileProviderKitTests/FilesDatabaseManagerTests.swift | Adjust tests to validate deleted flag counts. |
| Tests/NextcloudFileProviderKitTests/EnumeratorTests.swift | Switch to using sync anchors and local DB queries. |
| Tests/Interface/MockChangeObserver.swift | Support new enumerateChanges(from:) signature. |
Comments suppressed due to low confidence (4)
Tests/NextcloudFileProviderKitTests/RemoteChangeObserverTests.swift:164
- Remove leftover
debugPrint(db)calls to reduce noise in test output.
debugPrint(db)
Tests/NextcloudFileProviderKitTests/RemoteChangeObserverTests.swift:337
- Remove leftover
debugPrint(db)calls to keep tests clean.
debugPrint(db)
Tests/NextcloudFileProviderKitTests/RemoteChangeObserverTests.swift:462
- Remove leftover
debugPrint(db)calls to reduce unnecessary output.
debugPrint(db)
Tests/NextcloudFileProviderKitTests/FilesDatabaseManagerTests.swift:1260
- Remove the
print(updatedIds)debug statement from the test; use assertions to verify behavior instead of printing.
print(updatedIds)
Signed-off-by: Claudio Cambra <developer@claudiocambra.com>
Signed-off-by: Claudio Cambra <developer@claudiocambra.com>
Signed-off-by: Claudio Cambra <developer@claudiocambra.com>
Signed-off-by: Claudio Cambra <developer@claudiocambra.com>
Signed-off-by: Claudio Cambra <developer@claudiocambra.com>
…d folders Signed-off-by: Claudio Cambra <developer@claudiocambra.com>
Signed-off-by: Claudio Cambra <developer@claudiocambra.com>
Signed-off-by: Claudio Cambra <developer@claudiocambra.com>
Signed-off-by: Claudio Cambra <developer@claudiocambra.com>
Signed-off-by: Claudio Cambra <developer@claudiocambra.com>
Signed-off-by: Claudio Cambra <developer@claudiocambra.com>
Signed-off-by: Claudio Cambra <developer@claudiocambra.com>
Signed-off-by: Claudio Cambra <developer@claudiocambra.com>
Signed-off-by: Claudio Cambra <developer@claudiocambra.com>
Signed-off-by: Claudio Cambra <developer@claudiocambra.com>
Signed-off-by: Claudio Cambra <developer@claudiocambra.com>
Signed-off-by: Claudio Cambra <developer@claudiocambra.com>
…vation change check Signed-off-by: Claudio Cambra <developer@claudiocambra.com>
Signed-off-by: Claudio Cambra <developer@claudiocambra.com>
Signed-off-by: Claudio Cambra <developer@claudiocambra.com>
Signed-off-by: Claudio Cambra <developer@claudiocambra.com>
Signed-off-by: Claudio Cambra <developer@claudiocambra.com>
…rialised Signed-off-by: Claudio Cambra <developer@claudiocambra.com>
Signed-off-by: Claudio Cambra <developer@claudiocambra.com>
Signed-off-by: Claudio Cambra <developer@claudiocambra.com>
963be0d to
67de21f
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.