dominictarr / scuttlebutt

peer-to-peer replicatable data structure
Other
1.32k stars 66 forks source link

Use vector clock instead of monotonic timestamp #14

Open Raynos opened 12 years ago

Raynos commented 12 years ago

https://github.com/nko3/foojs/blob/master/vectorclock/vector_clock.js#L80

@mixu can you open source just the vectorclock as it's own module?

dominictarr commented 12 years ago

Actually, it could be very useful to make the ts injectable, so it would be monotonic, or vectors.

mono-ts gives you an ordering (good if you just want new values to clobber old/other), but vector clocks allows you to reason which updates are concurrent (made without knowledge of the other).

Using vector clocks means you can know whether a particular pair of updates was concurrent or not, meaning you could handle them specially - this would mean some sort of merge function.

dominictarr commented 12 years ago

yes @mixu please publish that! https://npm.im/vector-clock is available!

mixu commented 12 years ago

@Raynos @dominictarr just had my morning coffee, will have the module out on npm in ~ an hour.

Raynos commented 12 years ago

@mixu badassery!

mixu commented 12 years ago

and it's out https://npmjs.org/package/vectorclock