Helma Logo
main list history

Persistence API

Current efforts

Query API design

Preliminary Design

The current Git snapshot implements preliminary query functionality for the googlestore, berkeleystore, filestore, memstore backends. Note that while googlestore and berkeleystore use indxing and query functionality provided by the underlying libraries and APIs, filestore and memstore use unindexed, brute force query implementations that require a full read of the queried objects.

Query example:
  var books = Book.query().equals("title", req.params.title).select();

Prior Art

Collecting links of prior art and to collect more ideas on this.

Store interface

A persistent class is created by calling the Storable.defineClass() method with a store implementation and a class name.

  // define Storable base class
  // create a new store
  var store = new MyStore('/db');
  // create a persistent Book object
  var Book = Storable.defineClass(store, "Book");
  // Book objects can now be accessed via the 
  // Storable data access methods and scripted 
  // via Book.prototype
  Book.prototype.toString = function() this.title;
  var b = new Book({title: 'JS for dummies'});

A store implementation can be any JavaScript object that implements the folloing functions: