Commit graph

82 commits

Author SHA1 Message Date
Claudio Cambra
179a368f9f Add option to do a fast enumeration of changes which ignores new, unexplored folders
Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
2024-03-06 18:46:41 +08:00
Claudio Cambra
7ac5f38178 Cllean up function and method calls in File Provider Extension
Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
2024-02-06 11:45:44 +01:00
Claudio Cambra
3928573ff4 Run swift-format on swift code
Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
2024-02-06 11:45:44 +01:00
Claudio Cambra
e245ec0d2a
Set interpolated log strings in FileProvider logs to public
Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
2023-05-12 16:02:38 +08:00
Claudio Cambra
ebf96e3e81
Make NKError extension code more Swift-like, clean up
Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
2023-05-12 16:02:38 +08:00
Claudio Cambra
a7344ba3fd
Fix unused/unmodified variable definition warnings in FileProviderEnumerator
Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
2023-05-12 16:02:37 +08:00
Claudio Cambra
6169594864
Prevent multi-thread modification of the same array with serial array modification dispatch queue when enumerating items in FileProviderEnumerator
Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
2023-05-12 16:02:37 +08:00
Claudio Cambra
9c1a035e3c
Reintegrate sync engine into FileProviderEnumerator class
Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
2023-05-12 16:02:37 +08:00
Claudio Cambra
bd50f753fa
Simplify initial item enumeration, no need to fetch from database in FileProviderEnumerator
Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
2023-05-12 16:02:37 +08:00
Claudio Cambra
fe7ca12d9c
Perform slow metadata to FileProviderItem conversion concurrently in FileProviderEnumerator
Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
2023-05-12 16:02:36 +08:00
Claudio Cambra
9cc05457c0
Do not do specific enumeration of items working set in FileProviderEnumerator
Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
2023-05-12 13:29:57 +08:00
Claudio Cambra
35570a3160
Move remote sync functionality out of enumerator and into separate NextcloudSyncEngine class
Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
2023-05-12 13:29:56 +08:00
Claudio Cambra
1524fc01f0
Progressively enumerate items as we get them for working set
Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
2023-05-12 13:29:56 +08:00
Claudio Cambra
5154a57ac6
Move conversion from NSData to NSFileProviderPage to separate func
Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
2023-05-12 13:29:56 +08:00
Claudio Cambra
6202f3d70a
Split metadata parsing to complete enumerator into own function
Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
2023-05-12 13:29:56 +08:00
Claudio Cambra
8c729fb2f9
Simplify enumerateItems of working set by using fullRecursiveScan in FileProviderEnumerator
Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
2023-05-12 13:29:56 +08:00
Claudio Cambra
b369b5d515
Handle invalidation of enumerator during long recursive scans in FileProviderEnumerator
Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
2023-05-12 13:29:56 +08:00
Claudio Cambra
d0b4b6853c
Move deleted/updated conflict check to fullRecursiveScan in FileProviderEnumerator+RemoteSync
Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
2023-05-12 13:29:56 +08:00
Claudio Cambra
3c2c360a2e
Properly report and handle critical errors during recursive enumeration in FileProviderEnumerator
Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
2023-05-12 13:29:56 +08:00
Claudio Cambra
245129de99
Move remote sync stuff in FileProviderEnumerator to own file
Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
2023-05-12 13:29:55 +08:00
Claudio Cambra
b2d2f9586e
Properly report deleted metadatas in recursive directory delete in FileProviderEnumerator
Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
2023-05-12 13:29:55 +08:00
Claudio Cambra
a779fe76cb
Favour straight return in updateItemMetadatas rather than unnecessary completionHandler in NextcloudFilesDatabaseManager
Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
2023-05-12 13:29:55 +08:00
Claudio Cambra
0526079504
Fix renaming directories remotely fixing local sync state in file provider
Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
2023-05-12 13:29:55 +08:00
Claudio Cambra
29b495335b
Do not update etags for child folders acquired in a depth 1 readServerUrl in FileProviderEnumerator
Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
2023-05-12 13:29:55 +08:00
Claudio Cambra
872186248a
Remove redundant directory metadata tables in File Provider
Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
2023-05-12 13:29:55 +08:00
Claudio Cambra
3538ce9424
Change fullRecursiveScan function to enable more than just look for changes, also do proper full scan
Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
2023-05-12 13:29:55 +08:00
Claudio Cambra
97d2b354df
Ensure we are not marking items as both updated and deleted in FileProviderEnumerator
Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
2023-05-12 13:29:55 +08:00
Claudio Cambra
d3c3181c0d
Ensure we are logging error description itself and not NKError wrapper or any Error type
Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
2023-05-12 13:29:53 +08:00
Claudio Cambra
ccad81949a
Make enumeration of working set changes non-blocking in FileProviderEnumerator
Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
2023-05-12 13:28:46 +08:00
Claudio Cambra
60005d89bc
Ensure we are editing realm database on main thread in FileProviderEnumerator
Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
2023-05-12 13:28:46 +08:00
Claudio Cambra
52fe107ec5
Fix blocking main thread when enumerating working set items in FileProviderEnumerator
Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
2023-05-12 13:28:46 +08:00
Claudio Cambra
8661841c44
Remove unnecessary local file operations in FileProviderExt
Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
2023-05-12 13:28:46 +08:00
Claudio Cambra
89164d99ec
Make privacy level of interpolated strings in FileProviderEnumerator logging more granular
Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
2023-05-12 13:21:35 +08:00
Claudio Cambra
3082850e68
Ensure errors are always publicly displayed in unified logging of File Provider
Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
2023-05-12 13:21:34 +08:00
Claudio Cambra
75f18b8bd5
Use enumeration category and logger for FileProviderEnumerator
Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
2023-05-12 13:21:34 +08:00
Claudio Cambra
68044891f0
Properly respond to errors in working set enumerateItems in FileProviderEnumerator
Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
2023-05-12 13:21:33 +08:00
Claudio Cambra
134e373f1b
Do not delete "no longer existing files" when doing enumeration of items in FileProviderEnumerator
Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
2023-05-12 13:21:33 +08:00
Claudio Cambra
b9b408d606
Fix general error handling in FileProviderEnumerator
Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
2023-05-12 13:21:31 +08:00
Claudio Cambra
3873ad126d
Use NKError extension properties instead of magic numbers in FileProviderEnumerator
Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
2023-05-12 13:21:31 +08:00
Claudio Cambra
1ee6d1a1cc
Improve handling of no changes return in readFileOrFolder throughout FileProviderEnumerator
Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
2023-05-12 13:21:31 +08:00
Claudio Cambra
6ffbb5abf6
Properly handle stopping when finding matching etags in readServerUrl of FileProviderEnumerator
Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
2023-05-12 13:21:31 +08:00
Claudio Cambra
109258f3ce
Use NKError extension method in FileProviderEnumerator enumerate methods
Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
2023-05-12 13:21:30 +08:00
Claudio Cambra
6ef4f8a4f4
Implement better error handling in enumerator changes
Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
2023-05-12 13:21:30 +08:00
Claudio Cambra
1d1578447e
Move parentItemIdentifierMetadata helper method to the database manager
Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
2023-05-12 13:21:29 +08:00
Claudio Cambra
81fb05298c
Be efficient in working set enumeration by only enumerating for new items or changes folders that have been explored already
Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
2023-05-12 13:21:26 +08:00
Claudio Cambra
79d89c21c7
Ensure no metadatas get deleted when updating metadata for scanned directory in FileProviderEnumerator
Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
2023-05-12 13:21:26 +08:00
Claudio Cambra
d3f2094866
Remove workarounds no longer needed for Realm thread crashing
Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
2023-05-12 13:21:25 +08:00
Claudio Cambra
17fea88450
Replace full depth scanning of changes on every enumerate changes request with smarter recursive algorithm
Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
2023-05-12 13:21:25 +08:00
Claudio Cambra
7c8aab38d2
Fix erroneous deletion of metadata when updating serverUrl subject directory
Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
2023-05-12 13:21:25 +08:00
Claudio Cambra
3e269a958b
Fix crash on thread clash with Realm when enumerating changes
Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
2023-05-12 13:21:25 +08:00