Skip to content

Instantly share code, notes, and snippets.

View deanlandolt's full-sized avatar

Dean Landolt deanlandolt

  • NowSecure
  • Washington, DC
View GitHub Profile

INTERVALS

Intervals are the basic unit of composition for ltgt-style queries over a keyspace. Below is a list of some typical intervals in standard interval notion, translated to ltgt queries...

// closed/open: [0,100) ->
{ gte: 0, lt: 100

// open/closed: (0,100] ->
{ gt: 0, lte: 100 }
var test = require('tape');
var bytewise = require('bytewise');
var encode = bytewise.encode;
var MIN = bytewise.MIN;
var MAX = bytewise.MAX;
test('tuple queries', function (t) {
var yearly = tuples('reports', 'yearly');
// component keys of the tuple space query are available by index

Keybase proof

I hereby claim:

  • I am deanlandolt on github.
  • I am deanlandolt (https://keybase.io/deanlandolt) on keybase.
  • I have a public key whose fingerprint is 1B20 FB42 A896 1235 20BF 0330 BFA9 6F92 9724 606C

To claim this, I am signing this object:

@deanlandolt
deanlandolt / ts_model_ideas.ts
Last active August 29, 2015 14:20
Typescript interfaces and classes as DAL model specifications
// Typescript interfaces and classes as DAL model specifications
/**
* @entity
*/
class IndexedEntity {
/**
* The @id annotation defines primary key, implies @unique, @index
*
* @id
@deanlandolt
deanlandolt / bytesspace-log.md
Last active August 29, 2015 14:23
bytespace-batchlog

bytespace-batchlog

Write-ahead logging for transactions in a bytespace.

Write operations are given a monotonically increasing id and written to transaction log. Batches are processed asynchronously and added to the store. By default, query methods withheld until batch processing is complete for the commit which was current at the time the query is received.

Batch processing pipeline

The batch processing pipeline exposes extensions points to allow pre-commit hooks to do additional work before committing to the transaction log, and post-commit hooks to do additional work after a transaction. Work can be isolated to specific subspaces, allowing heavyweight analytical processing to proceed without blocking queries in hot-path or transaction-heavy spaces. Analytical work can be delegated to subprocesses or even remote machines. Work on multiple commits can be batched together, and monotonically increasing batch ids can be leveraged to allow reads on possibly stale data to be held, e.g. until the next "

/**
* A wrapper store to aggregate stores of different types as nested child stores
*/
exports.MultiType = function(entityStores) {
openObjectStore: function(storeName){
// handle nested stores with nested paths
var store = entityStores[storeName];
if(store) {
return store;
var request = require("jsgi-client").request;
when(request({
method: "GET",
url: "http://google.com/"
}, function(response) {
print("why don't you print?!");
}));
/**
* A store wrapper for collecting multiple object stores into packages
*/
var Model = require("model").Model;
exports.Package = function(name, model, stores) {
if(!stores){
stores = model;
model = {};
/*
* CouchDB store
*/
var Model = require("model").Model,
request = require("jsgi-client").request,
when = require("promise").when,
error = require("jsgi/error");
var couch = require("store/couch");
var couchStore = couch.Database("test_suite_db");
var TestModel = require("model").Model("TestModel", couchStore, {
prototype: {
testMethod: function(){
return this.foo;
}
},
staticMethod: function(id){
return this.get(id);