Browse files

cleanup

  • Loading branch information...
1 parent 1d8ead1 commit c851f2b788a454fc41d55df942776ff97ef8ca2d @chrisdew committed Feb 9, 2011
View
2 docs/barricane-db.html
@@ -1,4 +1,4 @@
-<!DOCTYPE html> <html> <head> <title>barricane-db.js</title> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <link rel="stylesheet" media="all" href="docco.css" /> </head> <body> <div id="container"> <div id="background"></div> <div id="jump_to"> Jump To &hellip; <div id="jump_wrapper"> <div id="jump_page"> <a class="source" href="example-create-database.html"> example-create-database.js </a> <a class="source" href="example-model.html"> example-model.js </a> <a class="source" href="example-read-database.html"> example-read-database.js </a> <a class="source" href="barricane-db.html"> barricane-db.js </a> <a class="source" href="bdb-disk-manager.html"> bdb-disk-manager.js </a> <a class="source" href="db.html"> db.js </a> <a class="source" href="disk-io.html"> disk-io.js </a> <a class="source" href="old-barricane-db.html"> old-barricane-db.js </a> <a class="source" href="serialisation.html"> serialisation.js </a> <a class="source" href="swoj-codec.html"> swoj-codec.js </a> <a class="source" href="util.html"> util.js </a> </div> </div> </div> <table cellpadding="0" cellspacing="0"> <thead> <tr> <th class="docs"> <h1> barricane-db.js </h1> </th> <th class="code"> </th> </tr> </thead> <tbody> <tr id="section-1"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-1">&#182;</a> </div> <p>Copyright (c) 2010 Barricane Technology Ltd., All Rights Reserved.
+<!DOCTYPE html> <html> <head> <title>barricane-db.js</title> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <link rel="stylesheet" media="all" href="docco.css" /> </head> <body> <div id="container"> <div id="background"></div> <div id="jump_to"> Jump To &hellip; <div id="jump_wrapper"> <div id="jump_page"> <a class="source" href="example-create-database.html"> example-create-database.js </a> <a class="source" href="example-model.html"> example-model.js </a> <a class="source" href="example-read-database.html"> example-read-database.js </a> <a class="source" href="barricane-db.html"> barricane-db.js </a> <a class="source" href="db.html"> db.js </a> <a class="source" href="disk-io.html"> disk-io.js </a> <a class="source" href="swoj-codec.html"> swoj-codec.js </a> <a class="source" href="util.html"> util.js </a> </div> </div> </div> <table cellpadding="0" cellspacing="0"> <thead> <tr> <th class="docs"> <h1> barricane-db.js </h1> </th> <th class="code"> </th> </tr> </thead> <tbody> <tr id="section-1"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-1">&#182;</a> </div> <p>Copyright (c) 2010 Barricane Technology Ltd., All Rights Reserved.
Released under the MIT open source licence.</p> </td> <td class="code"> <div class="highlight"><pre></pre></div> </td> </tr> <tr id="section-2"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-2">&#182;</a> </div> <p>This file is the entry point for the NPM barricane-db package.
It only exports symbols required from other modules.</p> </td> <td class="code"> <div class="highlight"><pre><span class="kd">var</span> <span class="nx">bdb</span> <span class="o">=</span> <span class="nx">require</span><span class="p">(</span><span class="s1">&#39;./db&#39;</span><span class="p">);</span>
<span class="nx">exports</span><span class="p">.</span><span class="nx">DB</span> <span class="o">=</span> <span class="nx">bdb</span><span class="p">.</span><span class="nx">DB</span><span class="p">;</span>
View
2 docs/db.html
@@ -1,4 +1,4 @@
-<!DOCTYPE html> <html> <head> <title>db.js</title> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <link rel="stylesheet" media="all" href="docco.css" /> </head> <body> <div id="container"> <div id="background"></div> <div id="jump_to"> Jump To &hellip; <div id="jump_wrapper"> <div id="jump_page"> <a class="source" href="example-create-database.html"> example-create-database.js </a> <a class="source" href="example-model.html"> example-model.js </a> <a class="source" href="example-read-database.html"> example-read-database.js </a> <a class="source" href="barricane-db.html"> barricane-db.js </a> <a class="source" href="bdb-disk-manager.html"> bdb-disk-manager.js </a> <a class="source" href="db.html"> db.js </a> <a class="source" href="disk-io.html"> disk-io.js </a> <a class="source" href="old-barricane-db.html"> old-barricane-db.js </a> <a class="source" href="serialisation.html"> serialisation.js </a> <a class="source" href="swoj-codec.html"> swoj-codec.js </a> <a class="source" href="util.html"> util.js </a> </div> </div> </div> <table cellpadding="0" cellspacing="0"> <thead> <tr> <th class="docs"> <h1> db.js </h1> </th> <th class="code"> </th> </tr> </thead> <tbody> <tr id="section-1"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-1">&#182;</a> </div> <p>Copyright (c) 2010 Barricane Technology Ltd., All Rights Reserved.
+<!DOCTYPE html> <html> <head> <title>db.js</title> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <link rel="stylesheet" media="all" href="docco.css" /> </head> <body> <div id="container"> <div id="background"></div> <div id="jump_to"> Jump To &hellip; <div id="jump_wrapper"> <div id="jump_page"> <a class="source" href="example-create-database.html"> example-create-database.js </a> <a class="source" href="example-model.html"> example-model.js </a> <a class="source" href="example-read-database.html"> example-read-database.js </a> <a class="source" href="barricane-db.html"> barricane-db.js </a> <a class="source" href="db.html"> db.js </a> <a class="source" href="disk-io.html"> disk-io.js </a> <a class="source" href="swoj-codec.html"> swoj-codec.js </a> <a class="source" href="util.html"> util.js </a> </div> </div> </div> <table cellpadding="0" cellspacing="0"> <thead> <tr> <th class="docs"> <h1> db.js </h1> </th> <th class="code"> </th> </tr> </thead> <tbody> <tr id="section-1"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-1">&#182;</a> </div> <p>Copyright (c) 2010 Barricane Technology Ltd., All Rights Reserved.
Released under the MIT open source licence.</p> </td> <td class="code"> <div class="highlight"><pre></pre></div> </td> </tr> <tr id="section-2"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-2">&#182;</a> </div> <p>This module contains the database code.
It specifically eschews serialisation and io concerns.</p> </td> <td class="code"> <div class="highlight"><pre><span class="kd">var</span> <span class="nx">uuid</span> <span class="o">=</span> <span class="nx">require</span><span class="p">(</span><span class="s1">&#39;node-uuid&#39;</span><span class="p">)</span>
<span class="p">,</span> <span class="nx">dio</span> <span class="o">=</span> <span class="nx">require</span><span class="p">(</span><span class="s1">&#39;./disk-io&#39;</span><span class="p">)</span>
View
2 docs/disk-io.html
@@ -1,4 +1,4 @@
-<!DOCTYPE html> <html> <head> <title>disk-io.js</title> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <link rel="stylesheet" media="all" href="docco.css" /> </head> <body> <div id="container"> <div id="background"></div> <div id="jump_to"> Jump To &hellip; <div id="jump_wrapper"> <div id="jump_page"> <a class="source" href="example-create-database.html"> example-create-database.js </a> <a class="source" href="example-model.html"> example-model.js </a> <a class="source" href="example-read-database.html"> example-read-database.js </a> <a class="source" href="barricane-db.html"> barricane-db.js </a> <a class="source" href="bdb-disk-manager.html"> bdb-disk-manager.js </a> <a class="source" href="db.html"> db.js </a> <a class="source" href="disk-io.html"> disk-io.js </a> <a class="source" href="old-barricane-db.html"> old-barricane-db.js </a> <a class="source" href="serialisation.html"> serialisation.js </a> <a class="source" href="swoj-codec.html"> swoj-codec.js </a> <a class="source" href="util.html"> util.js </a> </div> </div> </div> <table cellpadding="0" cellspacing="0"> <thead> <tr> <th class="docs"> <h1> disk-io.js </h1> </th> <th class="code"> </th> </tr> </thead> <tbody> <tr id="section-1"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-1">&#182;</a> </div> <p>Copyright (c) 2010 Barricane Technology Ltd., All Rights Reserved.
+<!DOCTYPE html> <html> <head> <title>disk-io.js</title> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <link rel="stylesheet" media="all" href="docco.css" /> </head> <body> <div id="container"> <div id="background"></div> <div id="jump_to"> Jump To &hellip; <div id="jump_wrapper"> <div id="jump_page"> <a class="source" href="example-create-database.html"> example-create-database.js </a> <a class="source" href="example-model.html"> example-model.js </a> <a class="source" href="example-read-database.html"> example-read-database.js </a> <a class="source" href="barricane-db.html"> barricane-db.js </a> <a class="source" href="db.html"> db.js </a> <a class="source" href="disk-io.html"> disk-io.js </a> <a class="source" href="swoj-codec.html"> swoj-codec.js </a> <a class="source" href="util.html"> util.js </a> </div> </div> </div> <table cellpadding="0" cellspacing="0"> <thead> <tr> <th class="docs"> <h1> disk-io.js </h1> </th> <th class="code"> </th> </tr> </thead> <tbody> <tr id="section-1"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-1">&#182;</a> </div> <p>Copyright (c) 2010 Barricane Technology Ltd., All Rights Reserved.
/ Released under the MIT open source licence.</p> </td> <td class="code"> <div class="highlight"><pre></pre></div> </td> </tr> <tr id="section-2"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-2">&#182;</a> </div> <p>This module contains the DiskIO code.</p> </td> <td class="code"> <div class="highlight"><pre></pre></div> </td> </tr> <tr id="section-3"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-3">&#182;</a> </div> <p>The DiskIO constructor creates an object which can be used by DB to interact
with the outside world. Other IOs will be possible in future, including
ReplicationIO.</p> </td> <td class="code"> <div class="highlight"><pre><span class="kd">var</span> <span class="nx">codec</span> <span class="o">=</span> <span class="nx">require</span><span class="p">(</span><span class="s1">&#39;./swoj-codec&#39;</span><span class="p">)</span>
View
2 docs/example-create-database.html
@@ -1,4 +1,4 @@
-<!DOCTYPE html> <html> <head> <title>example-create-database.js</title> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <link rel="stylesheet" media="all" href="docco.css" /> </head> <body> <div id="container"> <div id="background"></div> <div id="jump_to"> Jump To &hellip; <div id="jump_wrapper"> <div id="jump_page"> <a class="source" href="example-create-database.html"> example-create-database.js </a> <a class="source" href="example-model.html"> example-model.js </a> <a class="source" href="example-read-database.html"> example-read-database.js </a> <a class="source" href="barricane-db.html"> barricane-db.js </a> <a class="source" href="bdb-disk-manager.html"> bdb-disk-manager.js </a> <a class="source" href="db.html"> db.js </a> <a class="source" href="disk-io.html"> disk-io.js </a> <a class="source" href="old-barricane-db.html"> old-barricane-db.js </a> <a class="source" href="serialisation.html"> serialisation.js </a> <a class="source" href="swoj-codec.html"> swoj-codec.js </a> <a class="source" href="util.html"> util.js </a> </div> </div> </div> <table cellpadding="0" cellspacing="0"> <thead> <tr> <th class="docs"> <h1> example-create-database.js </h1> </th> <th class="code"> </th> </tr> </thead> <tbody> <tr id="section-1"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-1">&#182;</a> </div> <p>Copyright (c) 2010 Barricane Technology Ltd., All Rights Reserved.
+<!DOCTYPE html> <html> <head> <title>example-create-database.js</title> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <link rel="stylesheet" media="all" href="docco.css" /> </head> <body> <div id="container"> <div id="background"></div> <div id="jump_to"> Jump To &hellip; <div id="jump_wrapper"> <div id="jump_page"> <a class="source" href="example-create-database.html"> example-create-database.js </a> <a class="source" href="example-model.html"> example-model.js </a> <a class="source" href="example-read-database.html"> example-read-database.js </a> <a class="source" href="barricane-db.html"> barricane-db.js </a> <a class="source" href="db.html"> db.js </a> <a class="source" href="disk-io.html"> disk-io.js </a> <a class="source" href="swoj-codec.html"> swoj-codec.js </a> <a class="source" href="util.html"> util.js </a> </div> </div> </div> <table cellpadding="0" cellspacing="0"> <thead> <tr> <th class="docs"> <h1> example-create-database.js </h1> </th> <th class="code"> </th> </tr> </thead> <tbody> <tr id="section-1"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-1">&#182;</a> </div> <p>Copyright (c) 2010 Barricane Technology Ltd., All Rights Reserved.
Released under the MIT open source licence.</p> </td> <td class="code"> <div class="highlight"><pre><span class="kd">var</span> <span class="nx">bdb</span> <span class="o">=</span> <span class="nx">require</span><span class="p">(</span><span class="s1">&#39;barricane-db&#39;</span><span class="p">)</span>
<span class="p">,</span> <span class="nx">model</span> <span class="o">=</span> <span class="nx">require</span><span class="p">(</span><span class="s1">&#39;./example-model&#39;</span><span class="p">);</span>
<span class="p">;</span>
View
2 docs/example-model.html
@@ -1,4 +1,4 @@
-<!DOCTYPE html> <html> <head> <title>example-model.js</title> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <link rel="stylesheet" media="all" href="docco.css" /> </head> <body> <div id="container"> <div id="background"></div> <div id="jump_to"> Jump To &hellip; <div id="jump_wrapper"> <div id="jump_page"> <a class="source" href="example-create-database.html"> example-create-database.js </a> <a class="source" href="example-model.html"> example-model.js </a> <a class="source" href="example-read-database.html"> example-read-database.js </a> <a class="source" href="barricane-db.html"> barricane-db.js </a> <a class="source" href="bdb-disk-manager.html"> bdb-disk-manager.js </a> <a class="source" href="db.html"> db.js </a> <a class="source" href="disk-io.html"> disk-io.js </a> <a class="source" href="old-barricane-db.html"> old-barricane-db.js </a> <a class="source" href="serialisation.html"> serialisation.js </a> <a class="source" href="swoj-codec.html"> swoj-codec.js </a> <a class="source" href="util.html"> util.js </a> </div> </div> </div> <table cellpadding="0" cellspacing="0"> <thead> <tr> <th class="docs"> <h1> example-model.js </h1> </th> <th class="code"> </th> </tr> </thead> <tbody> <tr id="section-1"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-1">&#182;</a> </div> <p>Copyright (c) 2010 Barricane Technology Ltd., All Rights Reserved.
+<!DOCTYPE html> <html> <head> <title>example-model.js</title> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <link rel="stylesheet" media="all" href="docco.css" /> </head> <body> <div id="container"> <div id="background"></div> <div id="jump_to"> Jump To &hellip; <div id="jump_wrapper"> <div id="jump_page"> <a class="source" href="example-create-database.html"> example-create-database.js </a> <a class="source" href="example-model.html"> example-model.js </a> <a class="source" href="example-read-database.html"> example-read-database.js </a> <a class="source" href="barricane-db.html"> barricane-db.js </a> <a class="source" href="db.html"> db.js </a> <a class="source" href="disk-io.html"> disk-io.js </a> <a class="source" href="swoj-codec.html"> swoj-codec.js </a> <a class="source" href="util.html"> util.js </a> </div> </div> </div> <table cellpadding="0" cellspacing="0"> <thead> <tr> <th class="docs"> <h1> example-model.js </h1> </th> <th class="code"> </th> </tr> </thead> <tbody> <tr id="section-1"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-1">&#182;</a> </div> <p>Copyright (c) 2010 Barricane Technology Ltd., All Rights Reserved.
Released under the MIT open source licence.</p> </td> <td class="code"> <div class="highlight"><pre></pre></div> </td> </tr> <tr id="section-2"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-2">&#182;</a> </div> <p>This is demonstration model code, as used in the examples.</p> </td> <td class="code"> <div class="highlight"><pre></pre></div> </td> </tr> <tr id="section-3"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-3">&#182;</a> </div> <p>A house constructor.</p> </td> <td class="code"> <div class="highlight"><pre><span class="kd">function</span> <span class="nx">House</span><span class="p">(</span><span class="nx">address</span><span class="p">)</span> <span class="p">{</span>
<span class="k">this</span><span class="p">.</span><span class="nx">address</span> <span class="o">=</span> <span class="nx">address</span><span class="p">;</span>
</pre></div> </td> </tr> <tr id="section-4"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-4">&#182;</a> </div> <p>Managed objects need to be registered - this causes them to be persisted.
View
2 docs/example-read-database.html
@@ -1,4 +1,4 @@
-<!DOCTYPE html> <html> <head> <title>example-read-database.js</title> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <link rel="stylesheet" media="all" href="docco.css" /> </head> <body> <div id="container"> <div id="background"></div> <div id="jump_to"> Jump To &hellip; <div id="jump_wrapper"> <div id="jump_page"> <a class="source" href="example-create-database.html"> example-create-database.js </a> <a class="source" href="example-model.html"> example-model.js </a> <a class="source" href="example-read-database.html"> example-read-database.js </a> <a class="source" href="barricane-db.html"> barricane-db.js </a> <a class="source" href="bdb-disk-manager.html"> bdb-disk-manager.js </a> <a class="source" href="db.html"> db.js </a> <a class="source" href="disk-io.html"> disk-io.js </a> <a class="source" href="old-barricane-db.html"> old-barricane-db.js </a> <a class="source" href="serialisation.html"> serialisation.js </a> <a class="source" href="swoj-codec.html"> swoj-codec.js </a> <a class="source" href="util.html"> util.js </a> </div> </div> </div> <table cellpadding="0" cellspacing="0"> <thead> <tr> <th class="docs"> <h1> example-read-database.js </h1> </th> <th class="code"> </th> </tr> </thead> <tbody> <tr id="section-1"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-1">&#182;</a> </div> <p>Copyright (c) 2010 Barricane Technology Ltd., All Rights Reserved.
+<!DOCTYPE html> <html> <head> <title>example-read-database.js</title> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <link rel="stylesheet" media="all" href="docco.css" /> </head> <body> <div id="container"> <div id="background"></div> <div id="jump_to"> Jump To &hellip; <div id="jump_wrapper"> <div id="jump_page"> <a class="source" href="example-create-database.html"> example-create-database.js </a> <a class="source" href="example-model.html"> example-model.js </a> <a class="source" href="example-read-database.html"> example-read-database.js </a> <a class="source" href="barricane-db.html"> barricane-db.js </a> <a class="source" href="db.html"> db.js </a> <a class="source" href="disk-io.html"> disk-io.js </a> <a class="source" href="swoj-codec.html"> swoj-codec.js </a> <a class="source" href="util.html"> util.js </a> </div> </div> </div> <table cellpadding="0" cellspacing="0"> <thead> <tr> <th class="docs"> <h1> example-read-database.js </h1> </th> <th class="code"> </th> </tr> </thead> <tbody> <tr id="section-1"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-1">&#182;</a> </div> <p>Copyright (c) 2010 Barricane Technology Ltd., All Rights Reserved.
Released under the MIT open source licence.</p> </td> <td class="code"> <div class="highlight"><pre><span class="kd">var</span> <span class="nx">bdb</span> <span class="o">=</span> <span class="nx">require</span><span class="p">(</span><span class="s1">&#39;barricane-db&#39;</span><span class="p">)</span>
<span class="p">,</span> <span class="nx">model</span> <span class="o">=</span> <span class="nx">require</span><span class="p">(</span><span class="s1">&#39;./example-model&#39;</span><span class="p">)</span>
<span class="p">;</span>
View
2 docs/swoj-codec.html
@@ -1,4 +1,4 @@
-<!DOCTYPE html> <html> <head> <title>swoj-codec.js</title> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <link rel="stylesheet" media="all" href="docco.css" /> </head> <body> <div id="container"> <div id="background"></div> <div id="jump_to"> Jump To &hellip; <div id="jump_wrapper"> <div id="jump_page"> <a class="source" href="example-create-database.html"> example-create-database.js </a> <a class="source" href="example-model.html"> example-model.js </a> <a class="source" href="example-read-database.html"> example-read-database.js </a> <a class="source" href="barricane-db.html"> barricane-db.js </a> <a class="source" href="bdb-disk-manager.html"> bdb-disk-manager.js </a> <a class="source" href="db.html"> db.js </a> <a class="source" href="disk-io.html"> disk-io.js </a> <a class="source" href="old-barricane-db.html"> old-barricane-db.js </a> <a class="source" href="serialisation.html"> serialisation.js </a> <a class="source" href="swoj-codec.html"> swoj-codec.js </a> <a class="source" href="util.html"> util.js </a> </div> </div> </div> <table cellpadding="0" cellspacing="0"> <thead> <tr> <th class="docs"> <h1> swoj-codec.js </h1> </th> <th class="code"> </th> </tr> </thead> <tbody> <tr id="section-1"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-1">&#182;</a> </div> <p>Copyright (c) 2010 Barricane Technology Ltd., All Rights Reserved.
+<!DOCTYPE html> <html> <head> <title>swoj-codec.js</title> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <link rel="stylesheet" media="all" href="docco.css" /> </head> <body> <div id="container"> <div id="background"></div> <div id="jump_to"> Jump To &hellip; <div id="jump_wrapper"> <div id="jump_page"> <a class="source" href="example-create-database.html"> example-create-database.js </a> <a class="source" href="example-model.html"> example-model.js </a> <a class="source" href="example-read-database.html"> example-read-database.js </a> <a class="source" href="barricane-db.html"> barricane-db.js </a> <a class="source" href="db.html"> db.js </a> <a class="source" href="disk-io.html"> disk-io.js </a> <a class="source" href="swoj-codec.html"> swoj-codec.js </a> <a class="source" href="util.html"> util.js </a> </div> </div> </div> <table cellpadding="0" cellspacing="0"> <thead> <tr> <th class="docs"> <h1> swoj-codec.js </h1> </th> <th class="code"> </th> </tr> </thead> <tbody> <tr id="section-1"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-1">&#182;</a> </div> <p>Copyright (c) 2010 Barricane Technology Ltd., All Rights Reserved.
Released under the MIT open source licence.</p> </td> <td class="code"> <div class="highlight"><pre></pre></div> </td> </tr> <tr id="section-2"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-2">&#182;</a> </div> <p>This module contains my first attempt at Serialisation/Unserialisation code.
SWOJ is Simple Whole Object JSON.</p> </td> <td class="code"> <div class="highlight"><pre> </pre></div> </td> </tr> <tr id="section-3"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-3">&#182;</a> </div> <p>Other codecs could improve on this by serialising deltas or using a binary
format.</p> </td> <td class="code"> <div class="highlight"><pre> </pre></div> </td> </tr> <tr id="section-4"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-4">&#182;</a> </div> <p>The codec system is designed to become pluggable - i.e. a database may be
View
2 docs/util.html
@@ -1,4 +1,4 @@
-<!DOCTYPE html> <html> <head> <title>util.js</title> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <link rel="stylesheet" media="all" href="docco.css" /> </head> <body> <div id="container"> <div id="background"></div> <div id="jump_to"> Jump To &hellip; <div id="jump_wrapper"> <div id="jump_page"> <a class="source" href="example-create-database.html"> example-create-database.js </a> <a class="source" href="example-model.html"> example-model.js </a> <a class="source" href="example-read-database.html"> example-read-database.js </a> <a class="source" href="barricane-db.html"> barricane-db.js </a> <a class="source" href="bdb-disk-manager.html"> bdb-disk-manager.js </a> <a class="source" href="db.html"> db.js </a> <a class="source" href="disk-io.html"> disk-io.js </a> <a class="source" href="old-barricane-db.html"> old-barricane-db.js </a> <a class="source" href="serialisation.html"> serialisation.js </a> <a class="source" href="swoj-codec.html"> swoj-codec.js </a> <a class="source" href="util.html"> util.js </a> </div> </div> </div> <table cellpadding="0" cellspacing="0"> <thead> <tr> <th class="docs"> <h1> util.js </h1> </th> <th class="code"> </th> </tr> </thead> <tbody> <tr id="section-1"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-1">&#182;</a> </div> <p>Copyright (c) 2010 Barricane Technology Ltd., All Rights Reserved.
+<!DOCTYPE html> <html> <head> <title>util.js</title> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <link rel="stylesheet" media="all" href="docco.css" /> </head> <body> <div id="container"> <div id="background"></div> <div id="jump_to"> Jump To &hellip; <div id="jump_wrapper"> <div id="jump_page"> <a class="source" href="example-create-database.html"> example-create-database.js </a> <a class="source" href="example-model.html"> example-model.js </a> <a class="source" href="example-read-database.html"> example-read-database.js </a> <a class="source" href="barricane-db.html"> barricane-db.js </a> <a class="source" href="db.html"> db.js </a> <a class="source" href="disk-io.html"> disk-io.js </a> <a class="source" href="swoj-codec.html"> swoj-codec.js </a> <a class="source" href="util.html"> util.js </a> </div> </div> </div> <table cellpadding="0" cellspacing="0"> <thead> <tr> <th class="docs"> <h1> util.js </h1> </th> <th class="code"> </th> </tr> </thead> <tbody> <tr id="section-1"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-1">&#182;</a> </div> <p>Copyright (c) 2010 Barricane Technology Ltd., All Rights Reserved.
Released under the MIT open source licence.</p> </td> <td class="code"> <div class="highlight"><pre></pre></div> </td> </tr> <tr id="section-2"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-2">&#182;</a> </div> <p>This is the obligatory dumping ground modules for all those bits which don't
fit well elsewhere.</p> </td> <td class="code"> <div class="highlight"><pre></pre></div> </td> </tr> <tr id="section-3"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-3">&#182;</a> </div> <p>This finds all the objects keys.</p> </td> <td class="code"> <div class="highlight"><pre><span class="kd">function</span> <span class="nx">ownKeys</span><span class="p">(</span><span class="nx">o</span><span class="p">)</span> <span class="p">{</span>
<span class="kd">var</span> <span class="nx">accumulator</span> <span class="o">=</span> <span class="p">[];</span>
View
47 lib/bdb-disk-manager.js
@@ -1,47 +0,0 @@
-// The DB Manager handles aspects such as loading DBs from disk and persistence.
-
-var bdb = require('../lib/old-barricane-db');
-var fs = require('fs');
-
-function BDBDiskManager(options) {
- var that = this;
-
- this.options = options;
- if (this.options === undefined) {
- this.options = {};
- }
- if (this.options.path === undefined) {
- this.options.path = "/tmp/";
- }
- if (this.options.name === undefined) {
- this.options.name = "unnamed_db";
- }
- this.db = new bdb.DB(this.options);
- this.txnlog = null;
- this.txnlogPath = this.options.path + "/" + this.options.name + ".log";
- this.snapshot = null;
- this.snapshotPath = this.options.path + "/" + this.options.name + ".bdb";
-
- try { // FIXME: do this properly
- fs.statSync(this.snapshotPath);
- console.log("loadDB");
- } catch (e) {
- console.log("createDB");
- this.snapshot_fd = fs.openSync(this.snapshotPath, 'w');
- this.txnlog_fd = fs.openSync(this.txnlogPath, 'w');
- this.db.options.write = function(arg) {
- //console.log(arg);
- fs.write(that.txnlog_fd, arg);
- }
- fs.writeSync(this.snapshot_fd, JSON.stringify(this.db));
- fs.closeSync(this.snapshot_fd);
- }
-}
-
-BDBDiskManager.prototype.end = function() {
- this.db.options.write = function() {};
- fs.closeSync(this.txnlog_fd);
- //this.txnlog.destroy();
-}
-
-exports.BDBDiskManager = BDBDiskManager;
View
183 lib/old-barricane-db.js
@@ -1,183 +0,0 @@
-var uuid = require('node-uuid')
-
-exports.hello_world = "Hello World";
-
-//newClosure([args... ,] function_to_call)
-function newClosure() {
- var args = Array.prototype.slice.call(arguments);
- return function() {
- args[args.length - 1].apply(undefined, args.slice(0, args.length - 1))
- }
-}
-
-function ownKeys(o) {
- var accumulator = [];
- for (var propertyName in o) {
- if (o.hasOwnProperty(propertyName)) {
- accumulator.push(propertyName);
- }
- }
- return accumulator;
-}
-
-DB.prototype.ownRealKeys = function(o) {
- var accumulator = [];
- for (var propertyName in o) {
- if (o.hasOwnProperty(propertyName) && propertyName.slice(0,this.options.magic.length) !== this.options.magic) {
- accumulator.push(propertyName);
- }
- }
- return accumulator;
-}
-
-function DB(options) {
- this.options = options;
- if (this.options === undefined) {
- this.options = {};
- }
- if (this.options.uuid === undefined) {
- this.options.uuid = uuid;
- }
- if (this.options.write === undefined) {
- this.options.write = function() {}; // do nothing
- }
- if (this.options.magic === undefined) {
- this.options.magic = "__";
- }
- if (this.options.name === undefined) {
- this.options.name = "unnamed_db";
- }
-
- this.constructors = {};
- this.instances = {};
- this.stores = {};
-
-}
-
-//var args = Array.prototype.slice.call(arguments);
-
-DB.prototype.serialise = function(ob) {
- var ret = {};
- ret.__constructor = ob.constructor.name;
-
- for (var p in ob) {
- if (ob.hasOwnProperty(p)) {
- // is this property a registered instance
- if (ob[p] !== undefined && ob[p].hasOwnProperty(this.options.magic + "uuid")) {
- ret[p] = this.options.magic + "ID" + this.options.magic + ob[p].__uuid;
- } else {
- if (ob[p] instanceof Date) {
- ret[p] = this.options.magic + "DATE" + this.options.magic + ob[p].getTime();;
- } else {
- ret[p] = ob[p];
- }
- }
- }
- }
- return ret;
-}
-
-DB.prototype.registerConstructors = function() {
- var args = Array.prototype.slice.call(arguments);
- for (var i in args) {
- this.constructors[args[i].name] = args[i];
- }
-}
-
-DB.prototype.register = function(instance) {
- var that = this;
-
- instance.__uuid = this.options.uuid();
-
- //constructor = instance.constructor;
- //// is it the first time we;ve seen an object of this type?
- //if (this.constructors[constructor.name] === undefined) {
- // this.constructors[constructor.name] = constructor;
- //}
- this.instances[instance.__uuid] = instance;
- var store = {}; // the backing store for the instance data
- this.stores[instance.__uuid] = store;
-
- // setup setter handlers FIXME
- //for (var p in instance) {
- // if (instance.hasOwnProperty(p) && p.slice(0,2) != "__") {
- // console.log("defineSetter", instance[p], p);
- // instance.__defineSetter__(p, newClosure(p, function(q) {
- // console.log("outerSetter", instance[q], q);
- // return (function(val) {
- // console.log("Setter", instance[q], q, val);
- // instance[q] = val;
- // that.options.write(that.serialise(instance));
- // })
- // }));
- // }
- //}
-
- // FIXME
- this.ownRealKeys(instance).forEach(function(p, i, all) {
- //var args = Array.prototype.slice.call(arguments);
- //console.log("Setter0", JSON.stringify(instance), instance[p], p);
- //var old = instance[p];
- store[p] = instance[p];
- instance.__defineSetter__(p, function(val) {
- //console.log("Setter", JSON.stringify(instance), instance[p], p, val);
- store[p] = val;
- that.options.write(JSON.stringify(that.serialise(instance)) + "\n");
- });
- instance.__defineGetter__(p, function() {
- return store[p];
- });
- });
-
-
- // finally add the object to the log
- //console.log("write0", this.options.write);
- this.options.write(JSON.stringify(that.serialise(instance)) + "\n");
-
-}
-
-DB.prototype.toJSON = function() {
- var ret = {};
- for (var p in this.instances) {
- if (this.instances.hasOwnProperty(p)) {
- ret[p] = this.serialise(this.instances[p]);
- }
- }
- //console.log(JSON.stringify(ret));
- return ret;
-}
-
-// This method sets up the instances from their serialised form.
-DB.prototype.fromJSON = function(json) {
- for(var uuid in json) {
- if (json.hasOwnProperty(uuid)) {
- // FIXME create the object using it's constructor
- // findout about modifying the constructors to automatically add a 'register' call.
- this.instances[uuid] = json[uuid];
- }
- }
- for(var uuid in this.instances) {
- if (this.instances.hasOwnProperty(uuid)) {
- var ob = this.instances[uuid];
- for(var p in ob) {
- if (ob.hasOwnProperty(p)) {
- var value = json[p];
- if (value instanceof String) {
- // FIXME
- // if it's a __ID__ or __DATE__
- // substitute in the real link/date
- //
- }
- }
- }
- }
- }
-}
-
-// This method amends the instances from the transaction log.
-DB.prototype.fromLog = function(log) {
-
-}
-
-
-exports.DB = DB;
View
9 lib/serialisation.js
@@ -1,9 +0,0 @@
-/*
- * Serialisation (yes, I'm English)
- * Copyright (c) 2010 Barricane Technology Ltd., All Rights Reserved.
- * Released under the MIT open source licence.
- */
-
-/*
- * This module contains the Serialisation code.
- */

0 comments on commit c851f2b

Please sign in to comment.