michaellperry / jinaga

Universal web back-end, offering an application-agnostic API, real-time collaboration, and conflict resolution.
http://jinaga.com
MIT License
35 stars 3 forks source link

initial jinaga class #7

Closed leblancmeneses closed 9 years ago

leblancmeneses commented 9 years ago

initial jinaga class

leblancmeneses commented 9 years ago

I would add jsdoc comments but I don't fully know the args for query or interface requirements you have on "message".

That said I haven't had much exposure with typescript and am wondering if this project may benefit more from typescript than traditional js/jsdoc approach.

michaellperry commented 9 years ago

It might benefit from Typescript. Let's explore that route.

We'll need to do something different with classes and "new". I don't want different modules to get different instances. If I query in one file, and add a fact in another, the query should hit.

leblancmeneses commented 9 years ago
// Create a connection to your Firebase database
var ref = new Firebase("https://<YOUR-FIREBASE-APP>.firebaseio.com");

If someone needs to maintain the original reference use dependency injection framework to handle that e.g. angularjs factory. I recommend the framework use classes.

For the backend I remember you mentioning you are using a nested set model to store the facts. How does that perform for queries (indexes/partitions)? For tenancy I would assume creating a root node for the tenant.

michaellperry commented 9 years ago

That's a good point. OK, let's do that.

Queries are turned into a tree of predecessor/successor joins. Facts are stored in a tree with predecessor/successor references. To run a query, choose a starting point, and then walk the fact tree using the instructions in the join tree.

And, yes, tenancy will be represented as root nodes.