-
Notifications
You must be signed in to change notification settings - Fork 1
Fix Token Locks #130
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix Token Locks #130
Conversation
- Removed FileProviderLogDetailKey.metadata because it was intended for Realm data models which actually are unsafe to pass across concurrency domains and caused a crash while doing so. - Removed FileProviderLogDetailKey.ocId because it is the same as "item" which is intended for the primary key of file provider items. Signed-off-by: Iva Horn <iva.horn@icloud.com>
- It was specific to the SendableItemMetadata implementation before. - It actually belongs into the common requirements definition of ItemMetadata. Signed-off-by: Iva Horn <iva.horn@icloud.com>
- Lock tokens are available only once during the LOCK request. - During every follow up request like PROPFIND, they are not returned for any item. - The items in the client database are updated atomically with the remote state. - The remote state does not provide the lock token. - So, during any metadata update after locking an item, the locally stored lock token is lost because it is overwritten with the new empty value retrieved from the server. Signed-off-by: Iva Horn <iva.horn@icloud.com>
Signed-off-by: Iva Horn <iva.horn@icloud.com>
- When a file is either locked or unlocked because of a lock file, its metadata must be updated accordingly. Signed-off-by: Iva Horn <iva.horn@icloud.com>
Signed-off-by: Iva Horn <iva.horn@icloud.com>
Signed-off-by: Iva Horn <iva.horn@icloud.com>
Signed-off-by: Iva Horn <iva.horn@icloud.com>
Signed-off-by: Iva Horn <iva.horn@icloud.com>
Signed-off-by: Iva Horn <iva.horn@icloud.com>
Signed-off-by: Iva Horn <iva.horn@icloud.com>
…incorrect error. Signed-off-by: Iva Horn <iva.horn@icloud.com>
Signed-off-by: Iva Horn <iva.horn@icloud.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
A comprehensive fix for token-based file locking functionality, updating lock-related APIs, data structures, and logging systems.
- Removed obsolete lock properties and simplified lock data model
- Updated logging system to use standardized keys and improved formatting
- Enhanced lock file management with proper token handling and metadata updates
Reviewed Changes
Copilot reviewed 22 out of 22 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| Tests/NextcloudFileProviderKitTests/RemoteChangeObserverEtagOptimizationTests.swift | Consolidated multi-line assertion into single line |
| Tests/NextcloudFileProviderKitTests/ItemModifyTests.swift | Removed version-specific error handling for lock tests |
| Tests/Interface/MockRemoteItem.swift | Simplified lock properties and updated lock initialization |
| Sources/NextcloudFileProviderKit/Metadata/SendableItemMetadata.swift | Removed lockToken assignment and cleaned up comments |
| Sources/NextcloudFileProviderKit/Metadata/SendableItemMetadata+Array.swift | Updated logging keys from .ocId to .item |
| Sources/NextcloudFileProviderKit/Metadata/ItemMetadata.swift | Moved and improved documentation for isLockFileOfLocalOrigin |
| Sources/NextcloudFileProviderKit/Log/FileProviderLogDetailKey.swift | Consolidated logging keys and added Comparable conformance |
| Sources/NextcloudFileProviderKit/Log/FileProviderLogDetail.swift | Added null safety for lock editor field |
| Sources/NextcloudFileProviderKit/Log/FileProviderLog.swift | Enhanced logging with sorted keys and improved type handling |
| Sources/NextcloudFileProviderKit/Item/Item.swift | Updated lock capability logic and file system flags |
| Sources/NextcloudFileProviderKit/Item/Item+Modify.swift | Added lock token header support and improved logging |
| Sources/NextcloudFileProviderKit/Item/Item+LockFile.swift | Enhanced lock/unlock with metadata synchronization |
| Sources/NextcloudFileProviderKit/Item/Item+Fetch.swift | Standardized logging throughout fetch operations |
| Sources/NextcloudFileProviderKit/Extensions/NKFile+Extensions.swift | Updated lock property mappings to use individual fields |
| Sources/NextcloudFileProviderKit/Enumeration/RemoteChangeObserver.swift | Consolidated logging statements |
| Sources/NextcloudFileProviderKit/Enumeration/MaterialisedEnumerationObserver.swift | Updated logging keys for consistency |
| Sources/NextcloudFileProviderKit/Enumeration/Enumerator.swift | Improved error handling and logging standardization |
| Sources/NextcloudFileProviderKit/Enumeration/Enumerator+Trash.swift | Updated logging key usage |
| Sources/NextcloudFileProviderKit/Enumeration/Enumerator+SyncEngine.swift | Added guard clause and lock token preservation |
| Sources/NextcloudFileProviderKit/Database/FilesDatabaseManager.swift | Updated logging keys and improved method formatting |
| Sources/NextcloudFileProviderKit/Database/FilesDatabaseManager+KeepDownloaded.swift | Updated logging keys for consistency |
| Sources/NextcloudFileProviderKit/Database/FilesDatabaseManager+Directories.swift | Updated logging keys throughout directory operations |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Signed-off-by: Iva Horn <iva.horn@icloud.com>
Signed-off-by: Iva Horn <iva.horn@nextcloud.com>
Depends on this being integrated first:nextcloud/NextcloudKit#193
Done.