Stratifying asynchronous storage
More about Node.js, but everyone is playing out with Node and NoSQL databases these days. And I don’t think I’m the only one finding the callback programming model quite unreadable (eye hurting?):
Here,
waitfor()/resumeis one of the special constructs that StratifiedJS adds to the JavaScript language. You can find out more in the StratifiedJS docs, but in a nutshell, the above code executes this.async_get(), passing in a special callback function called ‘resume’, and blocks execution of the current stratum until async_get() calls back resume().While the stratum that called database.get() blocks and waits for database.async_get() to perform its work, the browser UI will stay responsive. At the same time, other parallel strata not waiting for database.get() will happily continue running.
Here is the ☞ StratifiedJS library/framework
Original title and link: Stratifying asynchronous storage (NoSQL databases © myNoSQL)
via: http://onilabs.com/blog/stratifying-asynchronous-storage