A Seneca.js data storage plugin
seneca-riak is a Riak database plugin for the [Seneca][seneca] MVP toolkit.
If you're using this module, and need help, you can:
- Post a github issue,
- Tweet to @senecajs,
- Ask on the Gitter.
If you are new to Seneca in general, please take a look at senecajs.org. We have everything from tutorials to sample apps to help get you up and running quickly.
seneca-riak-store's source can be read in an annotated fashion by,
- Running
npm run annotate
- The annotated source can be found locally at ./doc/riak-store.html.
To install, simply use npm. Remember you will need to install Seneca.js separately.
npm install seneca
npm install seneca-riak-store
To run tests, simply use npm:
npm run test
var seneca = require('seneca')()
seneca.use('riak-store', {
nodes: ["host1:port1", "host2:port2"]]
})
seneca.ready(function () {
var apple = seneca.make$('fruit')
apple.name = 'Pink Lady'
apple.price = 0.99
apple.save$(function (err, apple) {
console.log("apple.id = " + apple.id)
})
})
You don't use this module directly. It provides an underlying data storage engine for the Seneca entity API:
var entity = seneca.make$('typename')
entity.someproperty = "something"
entity.anotherproperty = 100
entity.save$(function (err, entity) { ... })
entity.load$({id: ...}, function (err, entity) { ... })
entity.remove$({id: ...}, function (err, entity) { ... })
Due to Riak DB limitations some of the standard Seneca store operations are not available.
These are:
.list$({f1:v1, f2:v2, ...})
- list operation is not implemented it will throw error.remove$({all$: true})
- DB engine allow delete only for specified ids so this function is not available in this store.
With docker-machine and docker-compose installed run the following commands:
docker-compose build
docker-compose up
As with all seneca stores, you can access the native driver
using entity.native$(function (err, connectionPool) {...})
.
We encourage participation. If you feel you can help in any way, be it with examples, extra testing, or new features please get in touch.
Copyright Mircea Alexandru 2015, Licensed under MIT.
This project was sponsored by nearForm.