-
Notifications
You must be signed in to change notification settings - Fork 25
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
[WIP] Store an optional value on doc deletions. #46
base: master
Are you sure you want to change the base?
Conversation
6f69d95
to
b2ccd9d
Compare
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.
I feel pretty good about this approach. Any blockers on moving ahead with this?
index.js
Outdated
@@ -40,7 +40,8 @@ function DB (opts) { | |||
map: function (row, next) { | |||
if (!row.value) return null | |||
var v = row.value.v, d = row.value.d | |||
if (v && v.lat !== undefined && v.lon !== undefined) { | |||
var k = row.value.k | |||
if (k && v.lat !== undefined && v.lon !== undefined) { |
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.
I don't quite understand this change, can you explain the implications / reasons?
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.
Now that DELETEs can have a v
(value) as well as PUTs, checking for k
(key) is a more reliable way of differentiating between PUTs and DELETEs. I can wrap this in a helper function to be more explicit -- not a bad idea.
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.
Given this is is performance-critical code I think better use a comment rather than function, which would have a slight performance overhead.
One thing though, a delete could have lat and lon defined, that wouldn't affect here 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.
Good call re comment vs function.
One thing though, a delete could have lat and lon defined, that wouldn't affect here right?
Right. Deletions have a d
key, and insertions have a k
key. Since this new code checks for the presence of a k
, even deletions with values would be ignored.
b2ccd9d
to
abfa82d
Compare
This is ready for another look-over. Here's the gist:
|
eff96fa
to
25c5234
Compare
No description provided.