Giter VIP home page Giter VIP logo

Comments (9)

hackergrrl avatar hackergrrl commented on August 16, 2024

from osm-p2p-db.

hackergrrl avatar hackergrrl commented on August 16, 2024

Sorry, forgot github refuses to treat emails as markdown. :(

from osm-p2p-db.

gmaclennan avatar gmaclennan commented on August 16, 2024

How does the ordering work on log.createReadStream() after syncing? e.g.

  1. Machine 1 creates changesets A, B.
  2. Machine 1 syncs with machine 2
  3. Machine 1 creates changeset C, D
  4. Machine 2 creates changeset E, F
  5. Machine 1 and 2 sync.
  6. 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.

hackergrrl avatar hackergrrl commented on August 16, 2024

from osm-p2p-db.

gmaclennan avatar gmaclennan commented on August 16, 2024

Yes to which part? You can't guarantee that E, F would come after A, B in the above case?

from osm-p2p-db.

hackergrrl avatar hackergrrl commented on August 16, 2024

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.

gmaclennan avatar gmaclennan commented on August 16, 2024

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.

hackergrrl avatar hackergrrl commented on August 16, 2024

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.

gmaclennan avatar gmaclennan commented on August 16, 2024

Ok, thanks, I think returning the order changesets were written is fine for now.

from osm-p2p-db.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.