How to use level-codec - 2 common examples

To help you get started, we’ve selected a few level-codec examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github flumedb / flumeview-query / test / random.js View on Github external
{ key: 't', value: ['timestamp'] },
  { key: 'ir', value: [['index'], ['random']] },
  { key: 'rt', value: [['random'], ['timestamp']] },
  { key: 'ti', value: [['timestamp'], ['index']] },
  { key: 'ri', value: [['random'], ['index']] },
  { key: 'tr', value: [['timestamp'], ['random'], ] },
  { key: 'it', value: [['index'], ['timestamp']] },
]

var raw = []


var dbPath = path.join(osenv.tmpdir(), 'test_stream-view_random')
rimraf.sync(dbPath)

var db = Flume(FlumeLog(path.join(dbPath, 'log.offset'), 1024, codec.json))
          .use('query', Query(1, {indexes: indexes}))

var query = db.query

test('preinit', function (t) {
  query.since.once(function (v) {
    t.equal(v, -1)
    t.end()

  })
})

var data = []
test('init', function (t) {
  for(var i = 0; i < 100; i++)
    data.push({
github flumedb / flumeview-query / test / links.js View on Github external
tape('simple', function (t) {
  var linksPath = path.join(osenv.tmpdir(), 'test_stream-view_links')
  rimraf.sync(linksPath)

  var db = Flume(FlumeLog(path.join(linksPath, 'log.offset'), 1024, codec.json))
            .use('links', Links(indexes, extract))

  var links = db.links

  t.test('init', function (t) {
    links.since.once(function (v) {
      t.equal(v, -1)
      t.end()

    })
  })

  var live = []

  pull(
    links.read({query: [{$filter: {rel: {$prefix: 'e'}}}], live: true, sync: false}),

level-codec

Encode keys, values and range options, with built-in or custom encodings

MIT
Latest version published 4 years ago

Package Health Score

71 / 100
Full package analysis

Popular level-codec functions