atomicdb v0.1.8
atomicdb
A comprehensive database engine that works with arbitrary storage solutions and runs guaranteed atomic operations with additional support for encryption and compression
N/B: The code/examples in this file are in coffee-script. Javascript examples are coming soon.
Installation (NodeJS)
npm install atomicdb --saveUsage (NodeJS)
{
Atomicdb
} = require 'atomicdb'
db = new AtomicdbInstallation (Browser)
Download the latest build and put it in your application.
<script type="text/javascript" src="atomicdb-0.1.8.js"></script>Features
- constructor
new Atomicdb(Create a new Instance)
constructor
new Atomicdb options
options is a object containing the following keys -
nameA name for the database. Must be unique on your host/domain.storageEngineA storageEngine. Compatible withwindow.localStorage,window.sessionStorage. You can set your own. A custom storageEngine has to be roughly compatible with thewindow.localStoragespecs. Basically, it needs to implement the functions inwindow.localStoragesuch asgetItem,setItem, etc. For in-memory operation, we suggest you use memorystorage module by stijndewittserializationEngineA way to serialize object to string and back. JSON.stringify and JSON.parse is a good example. You can of course set your own. As long as it has thestringifyandparsemethods, you are golden.commitDelayGuarantees that there will be at leastcommitDelaymiliseconds delay between two subsequent commits. Useful if you have a big database or very frequent database changes. By default it is set to'none'which commits synchronously.uniqueKeyEvery document in atomicdb has a unique identifier key that can not be altered by the user/developer. You can specify the name of the unique key. It defaults to_idas in mongodb.
Example:
db = new Atomicdb {
name: 'test-db'
storageEngine: localStorage
serializationEngine: JSON
commitDelay: 'none'
uniqueKey: '_id'
}