Re:Now that people are considering NOSQL will more people co...
by wpietri on Wednesday August 31, 2011 @08:49PM
(#2948205)
Yes, these approaches provide proper transactions, but the approach is much simpler than you imagine.
Imagine you have a graph of objects in RAM. Say, a Set of Counters. Imagine you want to change the graph by incrementing a counter. To do this create an object, the UpdateCounterCommand, with one method: execute. You hand the command to the system, and it puts it in a queue. When it gets to the top, it serializes the command to disk and then executes it. Exactly one write command runs at a time.
For a real-world example, check out Prevayler. It provides all the ACID guarantees that a database does, but in a very small amount of code.
Imagine you have a graph of objects in RAM. Say, a Set of Counters. Imagine you want to change the graph by incrementing a counter. To do this create an object, the UpdateCounterCommand, with one method: execute. You hand the command to the system, and it puts it in a queue. When it gets to the top, it serializes the command to disk and then executes it. Exactly one write command runs at a time.
For a real-world example, check out Prevayler. It provides all the ACID guarantees that a database does, but in a very small amount of code.