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
add node.deleted to indicate if a node is deleted #122
Conversation
/cc @andrewosh |
lib/iterator.js
Outdated
@@ -204,7 +204,8 @@ function byKey (a, b, reverse) { | |||
|
|||
function allDeletes (nodes) { | |||
for (var i = 0; i < nodes.length; i++) { | |||
if (nodes[i].value !== null) return false | |||
if (nodes[i].value === null || nodes[i].deleted) continue |
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.
So we're saying that null
is still going to represent a deletion (as in, even with this addition one wouldn't be able to have meaningful null
values)?
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.
Definitely necessary for backwards-compat, but is that a desirable limitation once this change is ancient history?
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.
No I'd like to get rid of that of check later on. Should we just drop support for null === deleted
in 3.0.0 stable? I'm okay doing that
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.
Yeah especially since 3.0.0 is considered an "LTS" release right?
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.
yes, i'll update that
@andrewosh updated. wdyt? |
@@ -44,6 +44,9 @@ PutRequest.prototype._finalize = function () { | |||
clock: this._clock | |||
} | |||
|
|||
// TODO: allow to set this flag explicitly | |||
if (node.value === null) node.deleted = true |
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.
Still want this one in there?
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.
Ah yea for now I need to keep it as that's how deletes are implemented internally (simply as db.put(key, null)
). We can rewrite that at some point though
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.
K. So this PR will just cover the get
side of things, and null put
s will still be invalid for the time being?
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.
Yea they'll turn into a delete (but we'll fix that asap)
862adf6
to
2f7173c
Compare
Backwards compat. Should make it possible to delete with a value which is useful for resolving conflicts