Permalink
Browse files

update docs

  • Loading branch information...
1 parent c303873 commit cf3434f366e4263c519392db02173ff5dcb0c85c @chrisdew committed Feb 5, 2011
View
19 docs/app-test.html
@@ -0,0 +1,19 @@
+<!DOCTYPE html> <html> <head> <title>app-test.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="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> <a class="source" href="app-test.html"> app-test.js </a> <a class="source" href="demo-model.html"> demo-model.js </a> <a class="source" href="hello-world-test.html"> hello-world-test.js </a> <a class="source" href="mock.html"> mock.js </a> <a class="source" href="old-disk-manager.html"> old-disk-manager.js </a> <a class="source" href="old-serialisation.html"> old-serialisation.js </a> <a class="source" href="swoj-codec-test.html"> swoj-codec-test.js </a> </div> </div> </div> <table cellpadding="0" cellspacing="0"> <thead> <tr> <th class="docs"> <h1> app-test.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">vows</span> <span class="o">=</span> <span class="nx">require</span><span class="p">(</span><span class="s1">&#39;vows&#39;</span><span class="p">)</span>
+ <span class="p">,</span> <span class="nx">assert</span> <span class="o">=</span> <span class="nx">require</span><span class="p">(</span><span class="s1">&#39;assert&#39;</span><span class="p">)</span>
+ <span class="p">,</span> <span class="nx">bdb</span> <span class="o">=</span> <span class="nx">require</span><span class="p">(</span><span class="s1">&#39;../lib/barricane-db&#39;</span><span class="p">)</span>
+ <span class="p">;</span>
+
+<span class="kd">var</span> <span class="nx">suite</span> <span class="o">=</span> <span class="nx">vows</span><span class="p">.</span><span class="nx">describe</span><span class="p">(</span><span class="s1">&#39;Setup&#39;</span><span class="p">).</span><span class="nx">addBatch</span><span class="p">(</span>
+ <span class="p">{</span> <span class="s2">&quot;dummy&quot;</span>
+ <span class="o">:</span> <span class="p">{</span> <span class="nx">topic</span>
+ <span class="o">:</span> <span class="kd">function</span><span class="p">()</span> <span class="p">{</span> <span class="k">return</span> <span class="mi">42</span><span class="p">;</span> <span class="p">}</span>
+ <span class="p">,</span> <span class="s2">&quot;equal 42&quot;</span>
+ <span class="o">:</span> <span class="kd">function</span><span class="p">(</span><span class="nx">topic</span><span class="p">)</span> <span class="p">{</span> <span class="nx">assert</span><span class="p">.</span><span class="nx">equal</span><span class="p">(</span><span class="nx">topic</span><span class="p">,</span> <span class="mi">42</span><span class="p">);</span> <span class="p">}</span>
+ <span class="p">}</span>
+ <span class="p">}</span>
+<span class="p">)</span>
+
+<span class="nx">suite</span><span class="p">.</span><span class="kr">export</span><span class="p">(</span><span class="nx">module</span><span class="p">);</span>
+
+</pre></div> </td> </tr> </tbody> </table> </div> </body> </html>
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="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="demo.html"> demo.js </a> <a class="source" href="hello_world.html"> hello_world.js </a> <a class="source" href="model.html"> model.js </a> <a class="source" href="old-disk-manager.html"> old-disk-manager.js </a> <a class="source" href="old-serialisation.html"> old-serialisation.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="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> <a class="source" href="app-test.html"> app-test.js </a> <a class="source" href="demo-model.html"> demo-model.js </a> <a class="source" href="hello-world-test.html"> hello-world-test.js </a> <a class="source" href="mock.html"> mock.js </a> <a class="source" href="old-disk-manager.html"> old-disk-manager.js </a> <a class="source" href="old-serialisation.html"> old-serialisation.js </a> <a class="source" href="swoj-codec-test.html"> swoj-codec-test.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/bdb-disk-manager.html
@@ -1,4 +1,4 @@
-<!DOCTYPE html> <html> <head> <title>bdb-disk-manager.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="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="demo.html"> demo.js </a> <a class="source" href="hello_world.html"> hello_world.js </a> <a class="source" href="model.html"> model.js </a> <a class="source" href="old-disk-manager.html"> old-disk-manager.js </a> <a class="source" href="old-serialisation.html"> old-serialisation.js </a> </div> </div> </div> <table cellpadding="0" cellspacing="0"> <thead> <tr> <th class="docs"> <h1> bdb-disk-manager.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>The DB Manager handles aspects such as loading DBs from disk and persistence.</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;../lib/old-barricane-db&#39;</span><span class="p">);</span>
+<!DOCTYPE html> <html> <head> <title>bdb-disk-manager.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="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> <a class="source" href="app-test.html"> app-test.js </a> <a class="source" href="demo-model.html"> demo-model.js </a> <a class="source" href="hello-world-test.html"> hello-world-test.js </a> <a class="source" href="mock.html"> mock.js </a> <a class="source" href="old-disk-manager.html"> old-disk-manager.js </a> <a class="source" href="old-serialisation.html"> old-serialisation.js </a> <a class="source" href="swoj-codec-test.html"> swoj-codec-test.js </a> </div> </div> </div> <table cellpadding="0" cellspacing="0"> <thead> <tr> <th class="docs"> <h1> bdb-disk-manager.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>The DB Manager handles aspects such as loading DBs from disk and persistence.</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;../lib/old-barricane-db&#39;</span><span class="p">);</span>
<span class="kd">var</span> <span class="nx">fs</span> <span class="o">=</span> <span class="nx">require</span><span class="p">(</span><span class="s1">&#39;fs&#39;</span><span class="p">);</span>
<span class="kd">function</span> <span class="nx">BDBDiskManager</span><span class="p">(</span><span class="nx">options</span><span class="p">)</span> <span class="p">{</span>
View
4 docs/db.html
@@ -1,6 +1,6 @@
-<!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="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="demo.html"> demo.js </a> <a class="source" href="hello_world.html"> hello_world.js </a> <a class="source" href="model.html"> model.js </a> <a class="source" href="old-disk-manager.html"> old-disk-manager.js </a> <a class="source" href="old-serialisation.html"> old-serialisation.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="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> <a class="source" href="app-test.html"> app-test.js </a> <a class="source" href="demo-model.html"> demo-model.js </a> <a class="source" href="hello-world-test.html"> hello-world-test.js </a> <a class="source" href="mock.html"> mock.js </a> <a class="source" href="old-disk-manager.html"> old-disk-manager.js </a> <a class="source" href="old-serialisation.html"> old-serialisation.js </a> <a class="source" href="swoj-codec-test.html"> swoj-codec-test.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;uuid&#39;</span><span class="p">)</span><span class="nx">l</span>
+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></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 DB constructor represents the database. In almost all circumstances only
one database will exist per process. More can be used, if needed, but the
application will become more complex, as it cannot use
View
19 docs/demo-model.html
@@ -0,0 +1,19 @@
+<!DOCTYPE html> <html> <head> <title>demo-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="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> <a class="source" href="app-test.html"> app-test.js </a> <a class="source" href="demo-model.html"> demo-model.js </a> <a class="source" href="hello-world-test.html"> hello-world-test.js </a> <a class="source" href="mock.html"> mock.js </a> <a class="source" href="old-disk-manager.html"> old-disk-manager.js </a> <a class="source" href="old-serialisation.html"> old-serialisation.js </a> <a class="source" href="swoj-codec-test.html"> swoj-codec-test.js </a> </div> </div> </div> <table cellpadding="0" cellspacing="0"> <thead> <tr> <th class="docs"> <h1> demo-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 test suites.</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.
+Registering in the constructor is just convenient, not required.</p> </td> <td class="code"> <div class="highlight"><pre> <span class="nx">process</span><span class="p">.</span><span class="nx">db</span><span class="p">.</span><span class="nx">registerInstance</span><span class="p">(</span><span class="k">this</span><span class="p">);</span>
+<span class="p">}</span></pre></div> </td> </tr> <tr id="section-5"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-5">&#182;</a> </div> <p>A pointless method, just because.</p> </td> <td class="code"> <div class="highlight"><pre><span class="nx">House</span><span class="p">.</span><span class="nx">prototype</span><span class="p">.</span><span class="nx">logConstructionMaterial</span> <span class="o">=</span> <span class="kd">function</span><span class="p">()</span> <span class="p">{</span>
+ <span class="nx">console</span><span class="p">.</span><span class="nx">log</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="s1">&#39; is made of stone&#39;</span><span class="p">);</span>
+<span class="p">}</span></pre></div> </td> </tr> <tr id="section-6"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-6">&#182;</a> </div> <p>A person constructor.</p> </td> <td class="code"> <div class="highlight"><pre><span class="kd">function</span> <span class="nx">Person</span><span class="p">(</span><span class="nx">personalName</span><span class="p">,</span> <span class="nx">familyName</span><span class="p">)</span> <span class="p">{</span>
+ <span class="k">this</span><span class="p">.</span><span class="nx">personalName</span> <span class="o">=</span> <span class="nx">personalName</span><span class="p">;</span>
+ <span class="k">this</span><span class="p">.</span><span class="nx">familyName</span> <span class="o">=</span> <span class="nx">familyName</span><span class="p">;</span></pre></div> </td> </tr> <tr id="section-7"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-7">&#182;</a> </div> <p>MUST declare any field which needs to trigger persistence.
+ONLY registered constructors, plain objects, arrays, strings, numbers and
+dates will be persisted.</p> </td> <td class="code"> <div class="highlight"><pre> <span class="k">this</span><span class="p">.</span><span class="nx">spouse</span> <span class="o">=</span> <span class="kc">null</span><span class="p">;</span>
+ <span class="k">this</span><span class="p">.</span><span class="nx">house</span> <span class="o">=</span> <span class="kc">null</span><span class="p">;</span>
+
+ <span class="nx">process</span><span class="p">.</span><span class="nx">db</span><span class="p">.</span><span class="nx">registerInstance</span><span class="p">(</span><span class="k">this</span><span class="p">);</span>
+<span class="p">}</span></pre></div> </td> </tr> <tr id="section-8"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-8">&#182;</a> </div> <p>Register the constructors.</p> </td> <td class="code"> <div class="highlight"><pre><span class="nx">process</span><span class="p">.</span><span class="nx">db</span><span class="p">.</span><span class="nx">registerConstructors</span><span class="p">(</span><span class="nx">House</span><span class="p">,</span> <span class="nx">Person</span><span class="p">);</span></pre></div> </td> </tr> <tr id="section-9"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-9">&#182;</a> </div> <p>Export the symbols.</p> </td> <td class="code"> <div class="highlight"><pre><span class="nx">exports</span><span class="p">.</span><span class="nx">House</span> <span class="o">=</span> <span class="nx">House</span><span class="p">;</span>
+<span class="nx">exports</span><span class="p">.</span><span class="nx">Person</span> <span class="o">=</span> <span class="nx">Person</span><span class="p">;</span>
+
+</pre></div> </td> </tr> </tbody> </table> </div> </body> </html>
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="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="demo.html"> demo.js </a> <a class="source" href="hello_world.html"> hello_world.js </a> <a class="source" href="model.html"> model.js </a> <a class="source" href="old-disk-manager.html"> old-disk-manager.js </a> <a class="source" href="old-serialisation.html"> old-serialisation.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="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> <a class="source" href="app-test.html"> app-test.js </a> <a class="source" href="demo-model.html"> demo-model.js </a> <a class="source" href="hello-world-test.html"> hello-world-test.js </a> <a class="source" href="mock.html"> mock.js </a> <a class="source" href="old-disk-manager.html"> old-disk-manager.js </a> <a class="source" href="old-serialisation.html"> old-serialisation.js </a> <a class="source" href="swoj-codec-test.html"> swoj-codec-test.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">function</span> <span class="nx">DiskIO</span><span class="p">(</span><span class="nx">options</span><span class="p">)</span> <span class="p">{</span>
View
14 docs/hello-world-test.html
@@ -0,0 +1,14 @@
+<!DOCTYPE html> <html> <head> <title>hello-world-test.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="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> <a class="source" href="app-test.html"> app-test.js </a> <a class="source" href="demo-model.html"> demo-model.js </a> <a class="source" href="hello-world-test.html"> hello-world-test.js </a> <a class="source" href="mock.html"> mock.js </a> <a class="source" href="old-disk-manager.html"> old-disk-manager.js </a> <a class="source" href="old-serialisation.html"> old-serialisation.js </a> <a class="source" href="swoj-codec-test.html"> swoj-codec-test.js </a> </div> </div> </div> <table cellpadding="0" cellspacing="0"> <thead> <tr> <th class="docs"> <h1> hello-world-test.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> </td> <td class="code"> <div class="highlight"><pre><span class="kd">var</span> <span class="nx">vows</span> <span class="o">=</span> <span class="nx">require</span><span class="p">(</span><span class="s1">&#39;vows&#39;</span><span class="p">)</span>
+ <span class="p">,</span> <span class="nx">assert</span> <span class="o">=</span> <span class="nx">require</span><span class="p">(</span><span class="s1">&#39;assert&#39;</span><span class="p">)</span>
+ <span class="p">,</span> <span class="nx">bdb</span> <span class="o">=</span> <span class="nx">require</span><span class="p">(</span><span class="s1">&#39;../lib/old-barricane-db&#39;</span><span class="p">)</span>
+ <span class="p">;</span>
+
+<span class="nx">vows</span><span class="p">.</span><span class="nx">describe</span><span class="p">(</span><span class="s1">&#39;The First Test&#39;</span><span class="p">).</span><span class="nx">addBatch</span><span class="p">({</span>
+ <span class="s1">&#39;Hello World&#39;</span><span class="o">:</span> <span class="p">{</span> <span class="nx">topic</span><span class="o">:</span> <span class="nx">bdb</span><span class="p">.</span><span class="nx">hello_world</span>
+ <span class="p">,</span> <span class="s1">&#39;equals &quot;Hello World&quot;&#39;</span><span class="o">:</span> <span class="kd">function</span><span class="p">(</span><span class="nx">topic</span><span class="p">)</span> <span class="p">{</span>
+ <span class="nx">assert</span><span class="p">.</span><span class="nx">equal</span><span class="p">(</span><span class="nx">topic</span><span class="p">,</span> <span class="s2">&quot;Hello World&quot;</span><span class="p">);</span>
+ <span class="p">}</span>
+ <span class="p">}</span>
+<span class="p">}).</span><span class="kr">export</span><span class="p">(</span><span class="nx">module</span><span class="p">);</span>
+
+</pre></div> </td> </tr> </tbody> </table> </div> </body> </html>
View
17 docs/mock.html
@@ -0,0 +1,17 @@
+<!DOCTYPE html> <html> <head> <title>mock.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="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> <a class="source" href="app-test.html"> app-test.js </a> <a class="source" href="demo-model.html"> demo-model.js </a> <a class="source" href="hello-world-test.html"> hello-world-test.js </a> <a class="source" href="mock.html"> mock.js </a> <a class="source" href="old-disk-manager.html"> old-disk-manager.js </a> <a class="source" href="old-serialisation.html"> old-serialisation.js </a> <a class="source" href="swoj-codec-test.html"> swoj-codec-test.js </a> </div> </div> </div> <table cellpadding="0" cellspacing="0"> <thead> <tr> <th class="docs"> <h1> mock.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 source exists because the demo-model uses process.db to register its
+instances and constructors.</p> </td> <td class="code"> <div class="highlight"><pre><span class="kd">function</span> <span class="nx">MockDB</span><span class="p">()</span> <span class="p">{</span>
+<span class="p">}</span>
+
+<span class="nx">MockDB</span><span class="p">.</span><span class="nx">prototype</span><span class="p">.</span><span class="nx">registerInstance</span> <span class="o">=</span> <span class="kd">function</span><span class="p">(</span><span class="nx">instance</span><span class="p">)</span> <span class="p">{</span>
+ <span class="nx">instance</span><span class="p">[</span><span class="s2">&quot;__uuid__&quot;</span><span class="p">]</span> <span class="o">=</span> <span class="nx">mockUuid</span><span class="p">();</span>
+<span class="p">};</span>
+<span class="nx">MockDB</span><span class="p">.</span><span class="nx">prototype</span><span class="p">.</span><span class="nx">registerConstructors</span> <span class="o">=</span> <span class="kd">function</span><span class="p">()</span> <span class="p">{};</span>
+
+<span class="kd">var</span> <span class="nx">nextUuid</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span>
+<span class="kd">function</span> <span class="nx">mockUuid</span><span class="p">()</span> <span class="p">{</span>
+ <span class="k">return</span> <span class="s2">&quot;&quot;</span> <span class="o">+</span> <span class="nx">nextUuid</span><span class="o">++</span><span class="p">;</span>
+<span class="p">}</span></pre></div> </td> </tr> <tr id="section-3"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-3">&#182;</a> </div> <p>Export the MockDB in place of DB.</p> </td> <td class="code"> <div class="highlight"><pre><span class="nx">exports</span><span class="p">.</span><span class="nx">DB</span> <span class="o">=</span> <span class="nx">MockDB</span><span class="p">;</span>
+<span class="nx">exports</span><span class="p">.</span><span class="nx">uuid</span> <span class="o">=</span> <span class="nx">mockUuid</span><span class="p">;</span>
+
+</pre></div> </td> </tr> </tbody> </table> </div> </body> </html>
View
2 docs/old-barricane-db.html
@@ -1,4 +1,4 @@
-<!DOCTYPE html> <html> <head> <title>old-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="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="demo.html"> demo.js </a> <a class="source" href="hello_world.html"> hello_world.js </a> <a class="source" href="model.html"> model.js </a> <a class="source" href="old-disk-manager.html"> old-disk-manager.js </a> <a class="source" href="old-serialisation.html"> old-serialisation.js </a> </div> </div> </div> <table cellpadding="0" cellspacing="0"> <thead> <tr> <th class="docs"> <h1> old-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> </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>
+<!DOCTYPE html> <html> <head> <title>old-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="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> <a class="source" href="app-test.html"> app-test.js </a> <a class="source" href="demo-model.html"> demo-model.js </a> <a class="source" href="hello-world-test.html"> hello-world-test.js </a> <a class="source" href="mock.html"> mock.js </a> <a class="source" href="old-disk-manager.html"> old-disk-manager.js </a> <a class="source" href="old-serialisation.html"> old-serialisation.js </a> <a class="source" href="swoj-codec-test.html"> swoj-codec-test.js </a> </div> </div> </div> <table cellpadding="0" cellspacing="0"> <thead> <tr> <th class="docs"> <h1> old-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> </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="nx">exports</span><span class="p">.</span><span class="nx">hello_world</span> <span class="o">=</span> <span class="s2">&quot;Hello World&quot;</span><span class="p">;</span></pre></div> </td> </tr> <tr id="section-2"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-2">&#182;</a> </div> <p>newClosure([args... ,] function<em>to</em>call)</p> </td> <td class="code"> <div class="highlight"><pre><span class="kd">function</span> <span class="nx">newClosure</span><span class="p">()</span> <span class="p">{</span>
<span class="kd">var</span> <span class="nx">args</span> <span class="o">=</span> <span class="nb">Array</span><span class="p">.</span><span class="nx">prototype</span><span class="p">.</span><span class="nx">slice</span><span class="p">.</span><span class="nx">call</span><span class="p">(</span><span class="nx">arguments</span><span class="p">);</span>
View
2 docs/old-disk-manager.html
@@ -1,4 +1,4 @@
-<!DOCTYPE html> <html> <head> <title>old-disk-manager.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="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="demo.html"> demo.js </a> <a class="source" href="hello_world.html"> hello_world.js </a> <a class="source" href="model.html"> model.js </a> <a class="source" href="old-disk-manager.html"> old-disk-manager.js </a> <a class="source" href="old-serialisation.html"> old-serialisation.js </a> </div> </div> </div> <table cellpadding="0" cellspacing="0"> <thead> <tr> <th class="docs"> <h1> old-disk-manager.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> </td> <td class="code"> <div class="highlight"><pre><span class="kd">var</span> <span class="nx">vows</span> <span class="o">=</span> <span class="nx">require</span><span class="p">(</span><span class="s1">&#39;vows&#39;</span><span class="p">)</span>
+<!DOCTYPE html> <html> <head> <title>old-disk-manager.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="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> <a class="source" href="app-test.html"> app-test.js </a> <a class="source" href="demo-model.html"> demo-model.js </a> <a class="source" href="hello-world-test.html"> hello-world-test.js </a> <a class="source" href="mock.html"> mock.js </a> <a class="source" href="old-disk-manager.html"> old-disk-manager.js </a> <a class="source" href="old-serialisation.html"> old-serialisation.js </a> <a class="source" href="swoj-codec-test.html"> swoj-codec-test.js </a> </div> </div> </div> <table cellpadding="0" cellspacing="0"> <thead> <tr> <th class="docs"> <h1> old-disk-manager.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> </td> <td class="code"> <div class="highlight"><pre><span class="kd">var</span> <span class="nx">vows</span> <span class="o">=</span> <span class="nx">require</span><span class="p">(</span><span class="s1">&#39;vows&#39;</span><span class="p">)</span>
<span class="p">,</span> <span class="nx">assert</span> <span class="o">=</span> <span class="nx">require</span><span class="p">(</span><span class="s1">&#39;assert&#39;</span><span class="p">)</span>
<span class="p">,</span> <span class="nx">bdb</span> <span class="o">=</span> <span class="nx">require</span><span class="p">(</span><span class="s1">&#39;../lib/old-barricane-db&#39;</span><span class="p">)</span>
<span class="p">,</span> <span class="nx">bdm</span> <span class="o">=</span> <span class="nx">require</span><span class="p">(</span><span class="s1">&#39;../lib/bdb-disk-manager&#39;</span><span class="p">)</span>
View
2 docs/old-serialisation.html
@@ -1,4 +1,4 @@
-<!DOCTYPE html> <html> <head> <title>old-serialisation.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="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="demo.html"> demo.js </a> <a class="source" href="hello_world.html"> hello_world.js </a> <a class="source" href="model.html"> model.js </a> <a class="source" href="old-disk-manager.html"> old-disk-manager.js </a> <a class="source" href="old-serialisation.html"> old-serialisation.js </a> </div> </div> </div> <table cellpadding="0" cellspacing="0"> <thead> <tr> <th class="docs"> <h1> old-serialisation.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> </td> <td class="code"> <div class="highlight"><pre><span class="kd">var</span> <span class="nx">vows</span> <span class="o">=</span> <span class="nx">require</span><span class="p">(</span><span class="s1">&#39;vows&#39;</span><span class="p">)</span>
+<!DOCTYPE html> <html> <head> <title>old-serialisation.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="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> <a class="source" href="app-test.html"> app-test.js </a> <a class="source" href="demo-model.html"> demo-model.js </a> <a class="source" href="hello-world-test.html"> hello-world-test.js </a> <a class="source" href="mock.html"> mock.js </a> <a class="source" href="old-disk-manager.html"> old-disk-manager.js </a> <a class="source" href="old-serialisation.html"> old-serialisation.js </a> <a class="source" href="swoj-codec-test.html"> swoj-codec-test.js </a> </div> </div> </div> <table cellpadding="0" cellspacing="0"> <thead> <tr> <th class="docs"> <h1> old-serialisation.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> </td> <td class="code"> <div class="highlight"><pre><span class="kd">var</span> <span class="nx">vows</span> <span class="o">=</span> <span class="nx">require</span><span class="p">(</span><span class="s1">&#39;vows&#39;</span><span class="p">)</span>
<span class="p">,</span> <span class="nx">assert</span> <span class="o">=</span> <span class="nx">require</span><span class="p">(</span><span class="s1">&#39;assert&#39;</span><span class="p">)</span>
<span class="p">,</span> <span class="nx">bdb</span> <span class="o">=</span> <span class="nx">require</span><span class="p">(</span><span class="s1">&#39;../lib/old-barricane-db&#39;</span><span class="p">)</span>
<span class="p">;</span></pre></div> </td> </tr> <tr id="section-2"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-2">&#182;</a> </div> <p>mock up uuids for testing</p> </td> <td class="code"> <div class="highlight"><pre><span class="kd">var</span> <span class="nx">nextMockUuid</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span>
View
2 docs/serialisation.html
@@ -1,4 +1,4 @@
-<!DOCTYPE html> <html> <head> <title>serialisation.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="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="demo.html"> demo.js </a> <a class="source" href="hello_world.html"> hello_world.js </a> <a class="source" href="model.html"> model.js </a> <a class="source" href="old-disk-manager.html"> old-disk-manager.js </a> <a class="source" href="old-serialisation.html"> old-serialisation.js </a> </div> </div> </div> <table cellpadding="0" cellspacing="0"> <thead> <tr> <th class="docs"> <h1> serialisation.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> </td> <td class="code"> <div class="highlight"><pre><span class="cm">/*</span>
+<!DOCTYPE html> <html> <head> <title>serialisation.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="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> <a class="source" href="app-test.html"> app-test.js </a> <a class="source" href="demo-model.html"> demo-model.js </a> <a class="source" href="hello-world-test.html"> hello-world-test.js </a> <a class="source" href="mock.html"> mock.js </a> <a class="source" href="old-disk-manager.html"> old-disk-manager.js </a> <a class="source" href="old-serialisation.html"> old-serialisation.js </a> <a class="source" href="swoj-codec-test.html"> swoj-codec-test.js </a> </div> </div> </div> <table cellpadding="0" cellspacing="0"> <thead> <tr> <th class="docs"> <h1> serialisation.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> </td> <td class="code"> <div class="highlight"><pre><span class="cm">/*</span>
<span class="cm"> * Serialisation (yes, I&#39;m English)</span>
<span class="cm"> * Copyright (c) 2010 Barricane Technology Ltd., All Rights Reserved.</span>
<span class="cm"> * Released under the MIT open source licence.</span>
View
42 docs/swoj-codec-test.html
@@ -0,0 +1,42 @@
+<!DOCTYPE html> <html> <head> <title>swoj-codec-test.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="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> <a class="source" href="app-test.html"> app-test.js </a> <a class="source" href="demo-model.html"> demo-model.js </a> <a class="source" href="hello-world-test.html"> hello-world-test.js </a> <a class="source" href="mock.html"> mock.js </a> <a class="source" href="old-disk-manager.html"> old-disk-manager.js </a> <a class="source" href="old-serialisation.html"> old-serialisation.js </a> <a class="source" href="swoj-codec-test.html"> swoj-codec-test.js </a> </div> </div> </div> <table cellpadding="0" cellspacing="0"> <thead> <tr> <th class="docs"> <h1> swoj-codec-test.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">vows</span> <span class="o">=</span> <span class="nx">require</span><span class="p">(</span><span class="s1">&#39;vows&#39;</span><span class="p">)</span>
+ <span class="p">,</span> <span class="nx">assert</span> <span class="o">=</span> <span class="nx">require</span><span class="p">(</span><span class="s1">&#39;assert&#39;</span><span class="p">)</span>
+ <span class="p">,</span> <span class="nx">mock</span> <span class="o">=</span> <span class="nx">require</span><span class="p">(</span><span class="s1">&#39;./mock&#39;</span><span class="p">)</span>
+ <span class="p">,</span> <span class="nx">swoj</span> <span class="o">=</span> <span class="nx">require</span><span class="p">(</span><span class="s1">&#39;../lib/swoj-codec&#39;</span><span class="p">)</span>
+ <span class="p">;</span></pre></div> </td> </tr> <tr id="section-2"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-2">&#182;</a> </div> <p>Create a process wide default DB, with mocked up uuids.</p> </td> <td class="code"> <div class="highlight"><pre><span class="nx">process</span><span class="p">.</span><span class="nx">db</span> <span class="o">=</span> <span class="k">new</span> <span class="nx">mock</span><span class="p">.</span><span class="nx">DB</span><span class="p">();</span></pre></div> </td> </tr> <tr id="section-3"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-3">&#182;</a> </div> <p><code>process.db</code> must exist before we can require our model. You can
+leave your model untouched by BarricanDB and manually call
+<code>DB.registerInstance</code> as each new object is constructed. This way
+is generally easier.</p> </td> <td class="code"> <div class="highlight"><pre><span class="kd">var</span> <span class="nx">model</span> <span class="o">=</span> <span class="nx">require</span><span class="p">(</span><span class="s1">&#39;./demo-model&#39;</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>Construct a simple model from which objects can be persisted.</p> </td> <td class="code"> <div class="highlight"><pre><span class="kd">var</span> <span class="nx">house</span> <span class="o">=</span> <span class="k">new</span> <span class="nx">model</span><span class="p">.</span><span class="nx">House</span><span class="p">(</span><span class="s2">&quot;301 Cobblestone Wy., Bedrock, 70777&quot;</span><span class="p">);</span>
+<span class="kd">var</span> <span class="nx">fred</span> <span class="o">=</span> <span class="k">new</span> <span class="nx">model</span><span class="p">.</span><span class="nx">Person</span><span class="p">(</span><span class="s2">&quot;Fred&quot;</span><span class="p">,</span> <span class="s2">&quot;Flintstone&quot;</span><span class="p">);</span>
+<span class="nx">fred</span><span class="p">.</span><span class="nx">house</span> <span class="o">=</span> <span class="nx">house</span><span class="p">;</span>
+<span class="kd">var</span> <span class="nx">wilma</span> <span class="o">=</span> <span class="k">new</span> <span class="nx">model</span><span class="p">.</span><span class="nx">Person</span><span class="p">(</span><span class="s2">&quot;Wilma&quot;</span><span class="p">,</span> <span class="s2">&quot;Flintstone&quot;</span><span class="p">);</span>
+<span class="nx">wilma</span><span class="p">.</span><span class="nx">house</span> <span class="o">=</span> <span class="nx">house</span><span class="p">;</span>
+<span class="nx">fred</span><span class="p">.</span><span class="nx">spouse</span> <span class="o">=</span> <span class="nx">wilma</span><span class="p">;</span>
+<span class="nx">wilma</span><span class="p">.</span><span class="nx">spouse</span> <span class="o">=</span> <span class="nx">fred</span><span class="p">;</span>
+
+
+<span class="kd">var</span> <span class="nx">codec</span> <span class="o">=</span> <span class="k">new</span> <span class="nx">swoj</span><span class="p">.</span><span class="nx">Codec</span><span class="p">(</span><span class="s2">&quot;__&quot;</span><span class="p">);</span>
+
+<span class="kd">var</span> <span class="nx">suite</span> <span class="o">=</span> <span class="nx">vows</span><span class="p">.</span><span class="nx">describe</span><span class="p">(</span><span class="s1">&#39;Serialise&#39;</span><span class="p">).</span><span class="nx">addBatch</span><span class="p">(</span>
+ <span class="p">{</span> <span class="s2">&quot;house&quot;</span>
+ <span class="o">:</span> <span class="p">{</span> <span class="nx">topic</span>
+ <span class="o">:</span> <span class="nx">house</span>
+ <span class="p">,</span> <span class="s2">&quot;serialise&quot;</span>
+ <span class="o">:</span> <span class="kd">function</span><span class="p">(</span><span class="nx">topic</span><span class="p">)</span> <span class="p">{</span> <span class="nx">assert</span><span class="p">.</span><span class="nx">deepEqual</span><span class="p">(</span><span class="nx">codec</span><span class="p">.</span><span class="nx">serialise</span><span class="p">(</span><span class="nx">topic</span><span class="p">),</span> <span class="s1">&#39;{&quot;__constructor&quot;:&quot;House&quot;,&quot;address&quot;:&quot;301 Cobblestone Wy., Bedrock, 70777&quot;,&quot;__uuid__&quot;:&quot;0&quot;}&#39;</span><span class="p">);</span> <span class="p">}</span>
+ <span class="p">}</span>
+ <span class="p">,</span> <span class="s2">&quot;fred&quot;</span>
+ <span class="o">:</span> <span class="p">{</span> <span class="nx">topic</span>
+ <span class="o">:</span> <span class="nx">fred</span>
+ <span class="p">,</span> <span class="s2">&quot;serialise&quot;</span>
+ <span class="o">:</span> <span class="kd">function</span><span class="p">(</span><span class="nx">topic</span><span class="p">)</span> <span class="p">{</span> <span class="nx">assert</span><span class="p">.</span><span class="nx">deepEqual</span><span class="p">(</span><span class="nx">codec</span><span class="p">.</span><span class="nx">serialise</span><span class="p">(</span><span class="nx">topic</span><span class="p">),</span> <span class="s1">&#39;{&quot;__constructor&quot;:&quot;Person&quot;,&quot;personalName&quot;:&quot;Fred&quot;,&quot;familyName&quot;:&quot;Flintstone&quot;,&quot;spouse&quot;:&quot;__UUID__:2&quot;,&quot;house&quot;:&quot;__UUID__:0&quot;,&quot;__uuid__&quot;:&quot;1&quot;}&#39;</span><span class="p">);</span> <span class="p">}</span>
+ <span class="p">}</span>
+ <span class="p">,</span> <span class="s2">&quot;wilma&quot;</span>
+ <span class="o">:</span> <span class="p">{</span> <span class="nx">topic</span>
+ <span class="o">:</span> <span class="nx">wilma</span>
+ <span class="p">,</span> <span class="s2">&quot;serialise&quot;</span>
+ <span class="o">:</span> <span class="kd">function</span><span class="p">(</span><span class="nx">topic</span><span class="p">)</span> <span class="p">{</span> <span class="nx">assert</span><span class="p">.</span><span class="nx">deepEqual</span><span class="p">(</span><span class="nx">codec</span><span class="p">.</span><span class="nx">serialise</span><span class="p">(</span><span class="nx">topic</span><span class="p">),</span> <span class="s1">&#39;{&quot;__constructor&quot;:&quot;Person&quot;,&quot;personalName&quot;:&quot;Wilma&quot;,&quot;familyName&quot;:&quot;Flintstone&quot;,&quot;spouse&quot;:&quot;__UUID__:1&quot;,&quot;house&quot;:&quot;__UUID__:0&quot;,&quot;__uuid__&quot;:&quot;2&quot;}&#39;</span><span class="p">);</span> <span class="p">}</span>
+ <span class="p">}</span>
+ <span class="p">}</span>
+<span class="p">)</span></pre></div> </td> </tr> <tr id="section-5"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-5">&#182;</a> </div> <p>TODO test unserialisation</p> </td> <td class="code"> <div class="highlight"><pre><span class="nx">suite</span><span class="p">.</span><span class="kr">export</span><span class="p">(</span><span class="nx">module</span><span class="p">);</span>
+
+</pre></div> </td> </tr> </tbody> </table> </div> </body> </html>
View
37 docs/swoj-codec.html
@@ -1,15 +1,42 @@
-<!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="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="demo.html"> demo.js </a> <a class="source" href="hello_world.html"> hello_world.js </a> <a class="source" href="model.html"> model.js </a> <a class="source" href="old-disk-manager.html"> old-disk-manager.js </a> <a class="source" href="old-serialisation.html"> old-serialisation.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="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> <a class="source" href="app-test.html"> app-test.js </a> <a class="source" href="demo-model.html"> demo-model.js </a> <a class="source" href="hello-world-test.html"> hello-world-test.js </a> <a class="source" href="mock.html"> mock.js </a> <a class="source" href="old-disk-manager.html"> old-disk-manager.js </a> <a class="source" href="old-serialisation.html"> old-serialisation.js </a> <a class="source" href="swoj-codec-test.html"> swoj-codec-test.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
read in in with one codec and written with another. </p> </td> <td class="code"> <div class="highlight"><pre></pre></div> </td> </tr> <tr id="section-5"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-5">&#182;</a> </div> <p>There is little or no state in this codec, I am just writing it as a
-psuedo-class because I can see other codecs needing state.</p> </td> <td class="code"> <div class="highlight"><pre><span class="kd">function</span> <span class="nx">SwojCodec</span><span class="p">()</span> <span class="p">{</span>
+psuedo-class because I can see other codecs needing state. It would be nice
+to reduce the two-way linkage between db and codecs. I'll be able to
+refactor the db reference into a nicer interface, once I know what the
+codecs require.</p> </td> <td class="code"> <div class="highlight"><pre><span class="kd">function</span> <span class="nx">SwojCodec</span><span class="p">(</span><span class="nx">magic</span><span class="p">)</span> <span class="p">{</span>
+ <span class="k">this</span><span class="p">.</span><span class="nx">magic</span> <span class="o">=</span> <span class="nx">magic</span><span class="p">;</span>
<span class="p">}</span>
-<span class="nx">SwojCodec</span><span class="p">.</span><span class="nx">prototype</span><span class="p">.</span><span class="nx">name</span> <span class="o">=</span> <span class="s2">&quot;swoj&quot;</span><span class="p">;</span>
+<span class="nx">SwojCodec</span><span class="p">.</span><span class="nx">prototype</span><span class="p">.</span><span class="nx">name</span> <span class="o">=</span> <span class="s1">&#39;swoj&#39;</span><span class="p">;</span>
<span class="nx">SwojCodec</span><span class="p">.</span><span class="nx">prototype</span><span class="p">.</span><span class="nx">version</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span>
-<span class="nx">SwojCodec</span><span class="p">.</span><span class="nx">prototype</span><span class="p">.</span><span class="nx">defaultFileExtension</span> <span class="o">=</span> <span class="s2">&quot;swoj&quot;</span><span class="p">;</span>
+<span class="nx">SwojCodec</span><span class="p">.</span><span class="nx">prototype</span><span class="p">.</span><span class="nx">defaultFileExtension</span> <span class="o">=</span> <span class="s1">&#39;swoj&#39;</span><span class="p">;</span>
+<span class="nx">SwojCodec</span><span class="p">.</span><span class="nx">prototype</span><span class="p">.</span><span class="nx">encoding</span> <span class="o">=</span> <span class="s1">&#39;utf&#39;</span><span class="p">;</span></pre></div> </td> </tr> <tr id="section-6"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-6">&#182;</a> </div> <p>This takes a single instance and returns a representation ready to be written
+to disk.</p> </td> <td class="code"> <div class="highlight"><pre><span class="nx">SwojCodec</span><span class="p">.</span><span class="nx">prototype</span><span class="p">.</span><span class="nx">serialise</span> <span class="o">=</span> <span class="kd">function</span><span class="p">(</span><span class="nx">instance</span><span class="p">)</span> <span class="p">{</span>
+ <span class="kd">var</span> <span class="nx">tmp</span> <span class="o">=</span> <span class="p">{};</span>
+ <span class="nx">tmp</span><span class="p">[</span><span class="k">this</span><span class="p">.</span><span class="nx">magic</span> <span class="o">+</span> <span class="s2">&quot;constructor&quot;</span><span class="p">]</span> <span class="o">=</span> <span class="nx">instance</span><span class="p">.</span><span class="nx">constructor</span><span class="p">.</span><span class="nx">name</span><span class="p">;</span>
+
+ <span class="k">for</span> <span class="p">(</span><span class="kd">var</span> <span class="nx">p</span> <span class="k">in</span> <span class="nx">instance</span><span class="p">)</span> <span class="p">{</span>
+ <span class="k">if</span> <span class="p">(</span><span class="nx">instance</span><span class="p">.</span><span class="nx">hasOwnProperty</span><span class="p">(</span><span class="nx">p</span><span class="p">))</span> <span class="p">{</span></pre></div> </td> </tr> <tr id="section-7"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-7">&#182;</a> </div> <p>Is this property a registered instance</p> </td> <td class="code"> <div class="highlight"><pre> <span class="k">if</span> <span class="p">(</span> <span class="nx">instance</span><span class="p">[</span><span class="nx">p</span><span class="p">]</span> <span class="o">!==</span> <span class="kc">undefined</span>
+ <span class="o">&amp;&amp;</span> <span class="nx">instance</span><span class="p">[</span><span class="nx">p</span><span class="p">]</span> <span class="o">!==</span> <span class="kc">null</span>
+ <span class="o">&amp;&amp;</span> <span class="nx">instance</span><span class="p">[</span><span class="nx">p</span><span class="p">].</span><span class="nx">hasOwnProperty</span><span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">wrap</span><span class="p">(</span><span class="s2">&quot;uuid&quot;</span><span class="p">))</span>
+ <span class="p">)</span> <span class="p">{</span>
+ <span class="nx">tmp</span><span class="p">[</span><span class="nx">p</span><span class="p">]</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">wrap</span><span class="p">(</span><span class="s2">&quot;UUID&quot;</span><span class="p">)</span> <span class="o">+</span> <span class="s2">&quot;:&quot;</span> <span class="o">+</span> <span class="nx">instance</span><span class="p">[</span><span class="nx">p</span><span class="p">][</span><span class="k">this</span><span class="p">.</span><span class="nx">wrap</span><span class="p">(</span><span class="s2">&quot;uuid&quot;</span><span class="p">)];</span>
+ <span class="p">}</span> <span class="k">else</span> <span class="p">{</span></pre></div> </td> </tr> <tr id="section-8"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-8">&#182;</a> </div> <p>Treat dates carefully.</p> </td> <td class="code"> <div class="highlight"><pre> <span class="k">if</span> <span class="p">(</span><span class="nx">instance</span><span class="p">[</span><span class="nx">p</span><span class="p">]</span> <span class="k">instanceof</span> <span class="nb">Date</span><span class="p">)</span> <span class="p">{</span>
+ <span class="nx">tmp</span><span class="p">[</span><span class="nx">p</span><span class="p">]</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">wrap</span><span class="p">(</span><span class="s2">&quot;DATE&quot;</span><span class="p">)</span> <span class="o">+</span> <span class="s2">&quot;:&quot;</span> <span class="o">+</span> <span class="nx">instance</span><span class="p">[</span><span class="nx">p</span><span class="p">].</span><span class="nx">getTime</span><span class="p">();</span>
+ <span class="p">}</span> <span class="k">else</span> <span class="p">{</span>
+ <span class="nx">tmp</span><span class="p">[</span><span class="nx">p</span><span class="p">]</span> <span class="o">=</span> <span class="nx">instance</span><span class="p">[</span><span class="nx">p</span><span class="p">];</span>
+ <span class="p">}</span>
+ <span class="p">}</span>
+ <span class="p">}</span>
+ <span class="p">}</span>
+ <span class="k">return</span> <span class="nx">JSON</span><span class="p">.</span><span class="nx">stringify</span><span class="p">(</span><span class="nx">tmp</span><span class="p">);</span>
+<span class="p">}</span>
-<span class="nx">SwojCodec</span><span class="p">.</span><span class="nx">prototype</span><span class="p">.</span>
+<span class="nx">SwojCodec</span><span class="p">.</span><span class="nx">prototype</span><span class="p">.</span><span class="nx">wrap</span> <span class="o">=</span> <span class="kd">function</span><span class="p">(</span><span class="nx">string</span><span class="p">)</span> <span class="p">{</span>
+ <span class="k">return</span> <span class="k">this</span><span class="p">.</span><span class="nx">magic</span> <span class="o">+</span> <span class="nx">string</span> <span class="o">+</span> <span class="k">this</span><span class="p">.</span><span class="nx">magic</span><span class="p">;</span>
+<span class="p">}</span></pre></div> </td> </tr> <tr id="section-9"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-9">&#182;</a> </div> <p>Anonomise the exported name, so that codec can be used interchangeably, </p> </td> <td class="code"> <div class="highlight"><pre><span class="nx">exports</span><span class="p">.</span><span class="nx">Codec</span> <span class="o">=</span> <span class="nx">SwojCodec</span><span class="p">;</span>
</pre></div> </td> </tr> </tbody> </table> </div> </body> </html>
View
15 docs/util.html
@@ -0,0 +1,15 @@
+<!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="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> <a class="source" href="app-test.html"> app-test.js </a> <a class="source" href="demo-model.html"> demo-model.js </a> <a class="source" href="hello-world-test.html"> hello-world-test.js </a> <a class="source" href="mock.html"> mock.js </a> <a class="source" href="old-disk-manager.html"> old-disk-manager.js </a> <a class="source" href="old-serialisation.html"> old-serialisation.js </a> <a class="source" href="swoj-codec-test.html"> swoj-codec-test.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, which do not contain the magic marker.</p> </td> <td class="code"> <div class="highlight"><pre><span class="kd">function</span> <span class="nx">ownRealKeys</span><span class="p">(</span><span class="nx">o</span><span class="p">,</span> <span class="nx">magic</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>
+ <span class="k">for</span> <span class="p">(</span><span class="kd">var</span> <span class="nx">propertyName</span> <span class="k">in</span> <span class="nx">o</span><span class="p">)</span> <span class="p">{</span>
+ <span class="k">if</span> <span class="p">(</span><span class="nx">o</span><span class="p">.</span><span class="nx">hasOwnProperty</span><span class="p">(</span><span class="nx">propertyName</span><span class="p">)</span> <span class="o">&amp;&amp;</span> <span class="nx">propertyName</span><span class="p">.</span><span class="nx">slice</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span><span class="k">this</span><span class="p">.</span><span class="nx">magic</span><span class="p">.</span><span class="nx">length</span><span class="p">)</span> <span class="o">!==</span> <span class="nx">magic</span><span class="p">)</span> <span class="p">{</span>
+ <span class="nx">accumulator</span><span class="p">.</span><span class="nx">push</span><span class="p">(</span><span class="nx">propertyName</span><span class="p">);</span>
+ <span class="p">}</span>
+ <span class="p">}</span>
+ <span class="k">return</span> <span class="nx">accumulator</span><span class="p">;</span>
+<span class="p">}</span>
+
+<span class="nx">exports</span><span class="p">.</span><span class="nx">ownRealKeys</span> <span class="o">=</span> <span class="nx">ownRealKeys</span>
+
+</pre></div> </td> </tr> </tbody> </table> </div> </body> </html>

0 comments on commit cf3434f

Please sign in to comment.