ALL COVERED TOPICS

NoSQL Benchmarks NoSQL use cases NoSQL Videos NoSQL Hybrid Solutions NoSQL Presentations Big Data Hadoop MapReduce Pig Hive Flume Oozie Sqoop HDFS ZooKeeper Cascading Cascalog BigTable Cassandra HBase Hypertable Couchbase CouchDB MongoDB OrientDB RavenDB Jackrabbit Terrastore Amazon DynamoDB Redis Riak Project Voldemort Tokyo Cabinet Kyoto Cabinet memcached Amazon SimpleDB Datomic MemcacheDB M/DB GT.M Amazon Dynamo Dynomite Mnesia Yahoo! PNUTS/Sherpa Neo4j InfoGrid Sones GraphDB InfiniteGraph AllegroGraph MarkLogic Clustrix CouchDB Case Studies MongoDB Case Studies NoSQL at Adobe NoSQL at Facebook NoSQL at Twitter

NAVIGATE MAIN CATEGORIES

Close

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()/resume is 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