kappa-core
Advanced tools
Comparing version 2.5.0 to 2.6.0
@@ -17,6 +17,10 @@ var hypercore = require('hypercore') | ||
// TODO: support versions + checking to rebuild them | ||
Kappa.prototype.use = function (name, view) { | ||
Kappa.prototype.use = function (name, version, view) { | ||
if (typeof version !== 'number') { | ||
view = version | ||
version = undefined | ||
} | ||
var idx = indexer({ | ||
log: this._logs, | ||
version: version, | ||
maxBatch: view.maxBatch || 10, | ||
@@ -23,0 +27,0 @@ batch: view.map, |
@@ -5,3 +5,3 @@ { | ||
"author": "Stephen Whitmore <sww@eight.net>", | ||
"version": "2.5.0", | ||
"version": "2.6.0", | ||
"repository": { | ||
@@ -8,0 +8,0 @@ "url": "git://github.com/noffle/kappa-core.git" |
@@ -48,3 +48,3 @@ # kappa-core | ||
// the api will be mounted at core.api.sum | ||
core.use('sum', sumview) | ||
core.use('sum', 1, sumview) // name the view 'sum' and consider the 'sumview' logic as version 1 | ||
@@ -92,3 +92,3 @@ core.feed('default', function (err, feed) { | ||
### core.use(name, view) | ||
### core.use(name[, version], view) | ||
@@ -120,2 +120,8 @@ Install a view called `name` to the kappa-core instance. A view is an object of | ||
`version` is an integer that represents what version you want to consider the | ||
view logic as. Whenever you change it (generally by incrementing it by 1), the | ||
underlying data generated by the view will be wiped, and the view will be | ||
regenerated again from scratch. This provides a means to change the logic or | ||
data structures of a view over time in a way that is future-compatible. | ||
The `{fetch,store}State` functions are optional: they tell the view where to | ||
@@ -122,0 +128,0 @@ store its state information about what log entries have been indexed thus far. |
90
221
163873
6