Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Enable persistent storage on Darwin in Server.h. (#14342)
There were two remaining issues in the Darwin KVS impl that needed to be fixed to get this to pass: 1) The errors returned did not match the API documentation, which caused some consumers to fail. The most important problem here was returning CHIP_ERROR_KEY_NOT_FOUND instead of CHIP_ERROR_PERSISTED_STORAGE_VALUE_NOT_FOUND from _Get, but I went ahead and aligned the other error cases (not initialized, buffer passed to _Get too small, deleting unknown key, failures to save to persistent storage) with the API documentation. 2) In _Put, if the item already existed the change of "value" was not being picked up by the NSManagedObject machinery, so updating the value of an already-existing key did not work. The fix for this is to use @dynamic instead of @synthesize for the properties of KeyValueItem (shamelessly copy/pasting from the documentation at https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/CoreData/LifeofaManagedObject.html), which I _think_ causes the getter/setter to be provided by the NSMnagedObject bits, which then know about the set we perform and know to update the data store. Fixes #12174
- Loading branch information