A Seneca.js data storage plugin
This module is a plugin for the Seneca framework. It provides a storage engine that uses multiple stores, called shards. The data is divided equally at time of creation, using an id built by the sharder module.
npm install seneca
npm install seneca-shard-store
cd test
mocha shard.test.js --seneca.log.print
This example uses two jsonfile-store.
var seneca = require('seneca')()
si.use(require('seneca-jsonfile-store'),{
map: {
'store1/-/-': '*'
},
folder: __dirname + '/db1'
})
si.use(require('seneca-jsonfile-store'),{
map: {
'store2/-/-': '*'
},
folder: __dirname + '/db2'
})
si.use(require('..'),{
shards: {
1: {
zone: 'store1',
append: true
},
2: {
zone: 'store2',
append: true
}
}
})
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.list$( {property: ...}, function(err,entity){ ... } )
entity.remove$( {id: ...}, function(err,entity){ ... } )
If you're using this module, and need help, you can:
- Post a github issue,
- Tweet to @senecajs,
- Ask on the Gitter.
The Senecajs org encourage open participation. If you feel you can help in any way, be it with documentation, examples, extra testing, or new features please get in touch.
This project was kindly sponsored by nearForm.
Copyright Matteo Collina and other contributors 2014-2016, Licensed under MIT.