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

[Feature] Deleting top-level keys #325

Open
joaomlneto opened this issue Feb 28, 2018 · 4 comments
Open

[Feature] Deleting top-level keys #325

joaomlneto opened this issue Feb 28, 2018 · 4 comments

Comments

@joaomlneto
Copy link
Contributor

Hi!
Is it possible to delete top-level keys (i.e. from a bucket)?
If so, this doesn't seem to be exported through any of the APIs (Java/TypeScript).

@marc-shapiro
Copy link

marc-shapiro commented Feb 28, 2018 via email

@preguica
Copy link

preguica commented Feb 28, 2018 via email

@joaomlneto
Copy link
Contributor Author

Hi Marc & Nuno! Thanks! :)

I guess Roger asked about the possibility (LightKone/antidote-rest-server#11); probably without any specific use-case in mind (more in terms of testing).

My understanding is that the reset operation will only revert the value of the object back to its zero-value, but won't change the type of the object (i.e. the beatles key which represents the set of members of the band cannot be changed later into representing a counter of how many beatles we find in our music store).

A few questions:

  • Why are the semantics for keys in a bucket different from keys in a map?
  • What are the limitations in providing a setKeyType(CRDT_TYPE) sort of operation? Probably due to nasty effects when having concurrent operations (e.g. counter.increment() || set.add("ringo")?
    • What if instead of mapping (key)-->(object) we map (key, crdtType)-->(object)?
      • This allows multiple CRDT object types per key
      • Operations on different CRDTs won't conflict (as they are applied to different objects)

I mean, it's just a suggestion. One that probably makes Antidote more complex without any real use-case backing it.
Was just wondering if my thinking was OK, or there's something I'm not considering.

@joaomlneto joaomlneto changed the title Deleting top-level keys [Feature] Deleting top-level keys Mar 1, 2018
@bieniusa
Copy link
Contributor

bieniusa commented Mar 2, 2018

Hey,

the semantics of keys in buckets and maps are mainly different because the map has been designed much later and with more insight. I agree that we should try to align the semantics of both 👍

Personally, I am not in favour of offering a "delete" operation where the semantics differ from a reset. I think it would mess up the semantics of concurrent modification and deletion.
We should discuss whether a key is always mapped to a specific type (in which case your setKeyType(...) operation would be very useful), or if we can have the same key with different type (which has the better concurrency semantics, but might be confusing for the programmer?).

We have discussed both in the past, but didn't come to a conclusion.

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

5 participants