-
Notifications
You must be signed in to change notification settings - Fork 43
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
Support arbitrary mappings of Entity to remote bucket name #204
Comments
@mikejohnstn just pushed a commit that brings back bucketOverrides mechanism (With a couple slight changes!). Few comments regarding the implementation: 1: UserInfo entry 2: Updating the start method All in all, i believe your original implementation (bucketOverrides attribute in Simperium) was the simplest, cleanest, and more flexible approach. So i've followed your original solution (with a couple differences in the SPWebsocketInterface side). Regarding the multiple entity mapping, agreed, a use case would be super helpful. I'll leave this ticket open so we can discuss that. Thank you! |
Re: use case, a simple one we ran into was for the radio project. Specifically: We wanted to be able to split up data for users among different blogs (your recordings for one blog should be distinct from another). Possible approaches:
The problem with the second approach is that we would also like users to be real blog users, so given that requirement we can't split by user. Another way to do it then, is to have one bucket, but have the blog to which it belongs be an attribute of the model. It's then up to the application to handle that division appropriately. I'm not sure if that will work for all use cases (to essentially have no split, but have the app handle it in their data model). There are some consequences to having a single bucket, bucket.all listeners must handle all data, etc. Sharded buckets may be easier to scale (up to a point since we cant have too many buckets either), depends on the data. Anyways there is nothing pressing that needs this currently, just recording some thoughts in case it comes up again. |
Off topic, but I noticed the remark about Is this an undocumented feature or did I just miss this? Regards, Patrick |
@prvnl yes! that's exactly how the spDisableSync attribute works. It's in the iOS docs (https://simperium.com/docs/ios/):
Cheers |
Thanks @jleandroperez, for the confirmation!! |
@prvnl no problem Patrick! |
We used to have this capability for unit tests, but it was factored out, and it probably wasn't a great implementation anyway.
Sometimes the Simperium bucket name may not match the local Entity name. In these cases it should be possible to maintain a mapping between the local and remote names:
UserInfo
entry to the Entity you want to map in the Core Data model (similar tospDisableSync
); and/orNSDictionary
to Simperium's start method with any mappings you want to override?Concrete example: if a remote bucket name is "Notes" and the local Entity name is "Note" we need to maintain a mapping between the two.
@fredrocious mentioned we may also need some kind of multi-mapping support (a single Entity's attributes mapped to remote attributes that are spread across more than one bucket). A use case here might help.
The text was updated successfully, but these errors were encountered: