atomicdb

0.1.8 • Public • Published

atomicdb

A comprehensive database engine that works with arbitrary storage solutions and runs guaranteed atomic operations with additional support for encryption and compression

NPM

N/B: The code/examples in this file are in coffee-script. Javascript examples are coming soon.

Installation (NodeJS)

npm install atomicdb --save

Usage (NodeJS)

{
  Atomicdb
} = require 'atomicdb'
 
db = new Atomicdb

Installation (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 options

options is a object containing the following keys -

  • name A name for the database. Must be unique on your host/domain.

  • storageEngine A storageEngine. Compatible with window.localStorage, window.sessionStorage. You can set your own. A custom storageEngine has to be roughly compatible with the window.localStorage specs. Basically, it needs to implement the functions in window.localStorage such as getItem, setItem, etc. For in-memory operation, we suggest you use memorystorage module by stijndewitt

  • serializationEngine A 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 the stringify and parse methods, you are golden.

  • commitDelay Guarantees that there will be at least commitDelay miliseconds 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.

  • uniqueKey Every 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 _id as in mongodb.

Example:

db = new Atomicdb {
  name: 'test-db'
  storageEngine: localStorage
  serializationEngine: JSON
  commitDelay: 'none'
  uniqueKey: '_id'
}

Package Sidebar

Install

npm i atomicdb

Weekly Downloads

10

Version

0.1.8

License

MIT

Last publish

Collaborators

  • ishafayet