-
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
Store deleted documents in the kdb index. #43
Conversation
index.js
Outdated
@@ -43,7 +43,8 @@ function DB (opts) { | |||
if (v && v.lat !== undefined && v.lon !== undefined) { | |||
next(null, { type: 'put', point: ptf(v) }) | |||
} else if (d && Array.isArray(row.value.points)) { | |||
next(null, { type: 'del', points: row.value.points.map(ptf) }) | |||
var pt = row.value.points.map(ptf)[0] |
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.
We need an index record for each point in row.value.points
. This property is set in the delete code and is an array of the lat/lon of each parent. Each of those records should be updated to point to the deleted record, i.e. we need two put
s
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, you are 100% right; good catch.
index.js
Outdated
} else if (doc && doc.value && doc.value.d && doc.value.points) { | ||
var pt = doc.value.points[0] | ||
pt.deleted = true | ||
addDoc(doc.value.d, link, pt) |
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 what this block is doing, can you explain?
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'm marking deleted documents as such, but (below) filtering them out. This means no API changes or change in behaviour, but the new logic is in place. This is to make the breaking change PR smaller and a bit easier to reason about.
This is a prerequisite for the larger goal of exposing deletions through the osm-p2p-db API.