crafity-storage

Generic storage provider. Single interface or abstraction for different databases.

Crafity Storage

var storage = require('crafity-storage');
// TODO ...

Details to come...

var EventEmitter = require('events').EventEmitter;

Creates a new database in the underlying data store

  • @param {Function} [callback] The function to call when the database is created
  • @throws {Error} Not implemented error

Drops an existing database from the underlying data store

  • @param {Function} [callback] The function to call when the database is dropped
  • @throws {Error} Not implemented error

Create a new database by dropping and creating a new database

  • @param callback The callback to call when the DB is recreated
  • @throws {Error} Not implemented error

Check if the provider is connected to the underlying data store.

Connect to the underlying data store.

  • @param {Function} [callback] The function to call when connected
  • @throws {Error} Not implemented error

Disconnect from the underlying data store

  • @param {Function} [callback] The function to call when disconnected
  • @throws {Error} Not implemented error

Dispose all the underlying resources (e.g. statefull connections)

  • @param {Function} [callback] The function to call when resources are disposed
  • @throws {Error} Not implemented error

Save data to the underlying data store

  • @param {Object} data The data to save
  • @param {Function} [callback] The function to call when the data is saved
  • @throws {Error} Not implemented error

Save many item to the underlying data store at the same time

  • @param {Array} data The data to store
  • @param {Function} [callback] The function to call when the data is saved
  • @throws {Error} Not implemented error

Remove data from the underlying data store

  • @param {Object} data The data to remove
  • @param {Function} [callback] The function to call when the data is removed
  • @throws {Error} Not implemented error

Remove many items from the underlying data store

  • @param {Array} data The data to remove
  • @param {Function} [callback] The function to call when the data is removed
  • @throws {Error} Not implemented error

Find data by key from the underlying data store

  • @param {Object} key The key of the data to fetch
  • @param {Function} [callback] The function to call when the data is fetched
  • @throws {Error} Not implemented error

Find data using a key from the underlying data store

  • @param {String|Number} key The key of the data to fetched
  • @param {Function} [callback] The function to call when the data is fetched
  • @throws {Error} Not implemented error

Find data by id in the underlying data store

  • @param {String} id The Id of the data to fetched
  • @param {String} [rev] The Id of the data to fetched
  • @param {Function} [callback] The function to call when the data is fetched
  • @throws {Error} Not implemented error

Find all the data from the underlying data store

  • @param {Function} [callback] The function to call when the data is fetched
  • @throws {Error} Not implemented error