Comments (9)
from osm-p2p-db.
Sorry, forgot github refuses to treat emails as markdown. :(
from osm-p2p-db.
How does the ordering work on log.createReadStream()
after syncing? e.g.
- Machine 1 creates changesets A, B.
- Machine 1 syncs with machine 2
- Machine 1 creates changeset C, D
- Machine 2 creates changeset E, F
- Machine 1 and 2 sync.
- What would
log.createReadStream()
on Machine 1 now return? would we always get A, B before C, D E and F? Would the order C, D and E, F always be guaranteed? I am guessing the ordering of the two pairs [C, D] with [E, F] is not guaranteed?
from osm-p2p-db.
from osm-p2p-db.
Yes to which part? You can't guarantee that E, F would come after A, B in the above case?
from osm-p2p-db.
Re ordering, you can only assume that parents appear earlier than children. So the CHANGES log on each machine should be:
Machine 1: A B C D E F
Machine 2: A B E F C D
(This is the in-order sequence. If opts.reverse
is provided, you'll be reading these in right-to-left instead.)
from osm-p2p-db.
Ok, good, that would be good enough for our needs. Now would the changeset ordering match up with the node/way/relation ordering? i.e. can we assume that for the elements referenced in a changeset, parents appear earlier than children?
from osm-p2p-db.
It's not required, no. As a consumer of osm-p2p-db
, I could write
var nodeA = { type: 'node', id: 'A', lon: 0, lat: 0 }
var nodeB = { type: 'node', id: 'B', lon: 1, lat: 1 }
var way = { type: 'way', id: 'C', refs: [ 'A', 'B'] }
var ops = {
{ type: 'put', doc: way },
{ type: 'put', doc: nodeA },
{ type: 'put', doc: nodeB }
}
osm.batch(ops)
And then, if you read back osm.log.getReadStream()
you would see them in the same order they were written. osm-p2p-db
is intentionally (I believe) very ignorant about semantics. This could be another good candidate for the osm-p2p-api
module we've been talking about.
If we wanted to try and ensure this, osm-p2p-server/api/put_changes.js
might be a good place to do the sorting.
from osm-p2p-db.
Ok, thanks, I think returning the order changesets were written is fine for now.
from osm-p2p-db.
Related Issues (20)
- Add ready() method HOT 1
- Close gracefully HOT 2
- edge cases with forks HOT 10
- ready() method does not wait for changeset index to catch up HOT 1
- Add osm.ready() to docs
- Joining ways to nodes fails for numeric ids
- Changeset is not stored on deleted elements
- deleting relations does not correctly update the join index
- How to index deleted points? HOT 1
- How to handle deletions of documents referenced by others in a distributed system? HOT 3
- Store version as well as id on way.nodes and relation.members
- Quantization of lon/lat coordinates HOT 1
- Add .close() method HOT 6
- deforking abstraction HOT 2
- Investigate indexing performance HOT 8
- Read up on bkd trees
- Way not returned when visible nodes are a subset of another way
- deterministic keys for osm data when importing HOT 2
- published version of osm-p2p-db contains benchmark outputs HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from osm-p2p-db.