gritzko / swarm

JavaScript replicated model (M of MVC) library
http://swarmdb.net/
MIT License
2.68k stars 97 forks source link

MongoStorage ? #43

Open temsa opened 9 years ago

temsa commented 9 years ago

ReadMe references https://github.com/gritzko/swarm/blob/master/lib/MongoStorage.js , yet it does not exist :(

BTW an ElasticsearchStorage using official client would be great too ! I may do it by myself if I really understand either the LevelDB one or the FileSystem one

gritzko commented 9 years ago

That would be a valuable contribution. Storage is the base class. Implementations override writeState, readState, writeOp, readOps. Former two methods deal with state snapshots. The latter two append ops to the log and read it, respectively. Storage is totally agnostic about CRDT/logic; it deals with plain key-value pairs. In MongoDB, we used arrays to keep the log. But (1) that was an ugly hack, (2) that code is not open source and (3) arrays are not actually necessary (key-value is OK as the order can be derived from the keys).

garethdown44 commented 9 years ago

Do you have any plans to make the Mongo Storage driver available?

gritzko commented 9 years ago

0.4 works differently. It is backed by an ordered key-value engine (everything levelup). So, it is possible to export data to MongoDB in real-time. @garethdown44, is such an option suitable for you? What is your scenario?