Skip to content
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

COPrimitiveCollection update issues #38

Open
ericwa opened this issue Jan 27, 2016 · 0 comments
Open

COPrimitiveCollection update issues #38

ericwa opened this issue Jan 27, 2016 · 0 comments
Assignees

Comments

@ericwa
Copy link
Member

ericwa commented Jan 27, 2016

Quentin says: (from 793a447#commitcomment-15704526 )

The current way of updating COPrimitiveCollection content has some logic holes, so this needs to be rewritten. I'll take a look at this soon.

For example, we probably want to pass an argument 'isDeserialization' to -setValue:forVariableStorageKey: so we can choose correctly between making a copy or updating the current collection content.

At deserialization time in -setValue:forVariableStorageKey:, we want to:

  • avoid copying a COPrimitiveCollection argument (just created by the deserialization code)
  • keep tombstones from the COPrimitiveCollection argument

If we have an existing collection, tombstones and live content must be replaced/overwritten by the ones from the collection passed in argument.

For a property update in -setValue:forVariableStorageKey:, when we replace a collection with another one, we want to:

  • copy the collection in argument or insert its content into our existing collection (to avoid any accidental sharing)
  • ignore tombstones (e.g. when we receive a COPrimitiveCollection in argument by doing an update like innerObject1.contents = innerObject2.contents)

This last point means that for COPrimitiveCollection, we cannot copy it but we must use -[COMutableSet setSet], -[COMutableArray setArray:]. Both methods will correctly ignore the tombstones. For any other collections, we could make a copy, but using -[NSMutableSet setSet] and -[NSMutableArray setArray:] works just fine and happens to make the code simpler.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants