Kappa View Query
provides a querying interface for custom indexes – inspired by ssb-query which uses map-filter-reduce and flumeview-query – as a kappa-core materialised view.
Usage
const kappa = const Query = const ram = const memdb = const level = const pull = const core = // either memdb for a memoryDown level instance, or// write indexes to a leveldb instance stored as files const db = || // custom validator enabling you to write your own message schemasconst validator = { if typeof msg !== 'object' return null if typeof msgvalue !== 'object' return null if typeof msgvaluetimestamp !== 'number' return null if typeof msgvaluetype !== 'string' return null return msg} // some example indexes, ported over from ssb-queryconst indexes = // indexes all messages from all feeds by timestamp key: 'log' value: 'value' 'timestamp' // indexes all messages from all feeds by message type, then by timestamp key: 'typ' value: 'value' 'type' 'value' 'timestamp' core core
API
const View = require('kappa-view-pull-query')
Expects a LevelUP or LevelDOWN instance leveldb
.
// returns a source to be used by pull-streamcoreapiquery // returns information about index performancecoreapiquery // append an index onto existing setcoreapiquery
Install
$ npm install kappa-view-pull-query
Acknowledgments
kappa-view-pull-query was inspired by flumeview-query and programmed by @kieran and @dominictarr.