Developing node-mdb SimpleDB emulation - M/Gateway ...

0 downloads 146 Views 176KB Size Report
Node.js: – evented server-side Javascript (using V8). • GT. ... Rewriting M/DB in Javascript would make it more ...
Developing node-mdb SimpleDB emulation using Node.js and GT.M Rob Tweed M/Gateway Developments Ltd http://www.mgateway.com Twitter: @rtweed

Could you translate that title? • SimpleDB: – Amazon’s NoSQL cloud ?> \n'); response.write(xml); response.end();

}); Entire request/response SDB round-trip completed

Demo using Bolso • List Domains • Create Domain • Add an item (row) and some attributes (columns + cells)

Node.js Gotchas • Async programming is not immediately intuitive! • Loops – Calling functions that use call-backs inside a for..in loop will go horribly wrong!

• Understanding closures – How externally-defined variables can be used inside call-back functions

Example • BatchPutAttributes – Intuitively a for .. in loop around PutAttributes – Had to be serialised • Completion of one PutAttributes calls the next

– Copy state of SDB object and use for..in? • var SDBx = SDB; • SDBx is a pointer to SDB, not a clone of it!

Conclusions • • • •

node-mdb is now nearly complete Only BatchDeleteAttributes not implemented Other APIs emulate SimpleDB 100% Free Open Source – https://github.com/robtweed/node-mdb – Give it a try! – Use mdb.js for examples to build your own Node.js database applications

• Check out GT.M! • Follow me on Twitter at @rtweed • Slides: http://www.mgateway.com/node-mdb-pres.html