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

add node.deleted to indicate if a node is deleted #122

Merged
merged 5 commits into from May 23, 2018

Conversation

mafintosh
Copy link
Owner

Backwards compat. Should make it possible to delete with a value which is useful for resolving conflicts

@mafintosh
Copy link
Owner Author

/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
Copy link
Collaborator

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)?

Copy link
Collaborator

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?

Copy link
Owner Author

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

Copy link
Collaborator

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?

Copy link
Owner Author

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

@mafintosh
Copy link
Owner Author

@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
Copy link
Collaborator

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?

Copy link
Owner Author

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

Copy link
Collaborator

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 puts will still be invalid for the time being?

Copy link
Owner Author

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)

@mafintosh mafintosh merged commit ec9c968 into master May 23, 2018
@mafintosh mafintosh deleted the add-node-deleted-flag branch May 23, 2018 18:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants