Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

file 68 lines (47 sloc) 1.038 kb

Stuff

{
  JVR,
  MockKVR
} = require 'datastores'

Abstractions

KV

  • k is an arbitrary Buffer. If you pass a string, it will get UTF-8-encoded.
  • v is an arbitrary Buffer. If you pass a string, it will get UTF-8-encoded.
.set k, v,  (e) ->

.get k,     (e, v) ->p

KVR

KV plus:

.getRange {k__prefix:"foo/", max:50}, (e, items) ->
  for [k, v] in items
    ...

# TODO: implement this:
.getRangeEmitter {...}, (e, itemEmitter) ->
  itemEmitter.on 'item', (k, v) ->
  itemEmitter.on 'end', () ->
  # itemEmitter.pause
  # itemEmitter.resume
  # itemEmitter.destroy

{JV, JVR}

A wrapper around a {KV, KVR} store, keyjson-{en,de}oding the keys.

jv = new JV kv
jv.set [WIKIMEDIA, 'enwiki', articleId, revId], data, (e) ->
jv.getRange k__prefix:[WIKIMEDIA, 'enwiki', articleId], (e, items) ->

SQL

TODO

Engines

MockKVR

  • in-RAM
  • O(total-number-of-items) getRanges so far
kvr = new MockKVR
Something went wrong with that request. Please try again.