forerunnerdb
Version:
A NoSQL document store database for browsers and Node.js.
1,167 lines (327 loc) • 15.7 kB
HTML
<html lang="en">
<head>
<meta charset="utf-8">
<title>JSDoc: Class: ActiveBucket</title>
<script src="scripts/prettify/prettify.js"> </script>
<script src="scripts/prettify/lang-css.js"> </script>
<!--[if lt IE 9]>
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
<link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">
</head>
<body>
<div id="main">
<h1 class="page-title">Class: ActiveBucket</h1>
<section>
<header>
<h2>ActiveBucket</h2>
</header>
<article>
<div class="container-overview">
<h4 class="name" id="ActiveBucket"><span class="type-signature"></span>new ActiveBucket<span class="signature">(orderBy)</span><span class="type-signature"></span></h4>
<div class="description">
Creates an always-sorted multi-key bucket that allows ForerunnerDB to
know the index that a document will occupy in an array with minimal
processing, speeding up things like sorted views.
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>orderBy</code></td>
<td class="type">
<span class="param-type">Object</span>
</td>
<td class="description last">An order object.</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="ActiveBucket.js.html">ActiveBucket.js</a>, <a href="ActiveBucket.js.html#line14">line 14</a>
</li></ul></dd>
</dl>
</div>
<h3 class="subsection-title">Methods</h3>
<ul><li><a href="#count"><span class="type-signature"></span>count<span class="signature">()</span><span class="type-signature"> → {Number}</span></a></li><li><a href="#documentKey"><span class="type-signature"></span>documentKey<span class="signature">(obj)</span><span class="type-signature"> → {String}</span></a></li><li><a href="#index"><span class="type-signature"></span>index<span class="signature">(obj)</span><span class="type-signature"> → {Number}</span></a></li><li><a href="#insert"><span class="type-signature"></span>insert<span class="signature">(obj)</span><span class="type-signature"> → {Number}</span></a></li><li><a href="#qs"><span class="type-signature"></span>qs<span class="signature">(obj, arr, item, fn)</span><span class="type-signature"> → {Number}</span></a></li><li><a href="#remove"><span class="type-signature"></span>remove<span class="signature">(obj)</span><span class="type-signature"> → {Number}</span></a></li></ul>
<h4 class="name" id="count"><span class="type-signature"></span>count<span class="signature">()</span><span class="type-signature"> → {Number}</span></h4>
<div class="description">
Get the number of documents currently indexed in the active
bucket instance.
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="ActiveBucket.js.html">ActiveBucket.js</a>, <a href="ActiveBucket.js.html#line263">line 263</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
The number of documents.
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Number</span>
</dd>
</dl>
<h4 class="name" id="documentKey"><span class="type-signature"></span>documentKey<span class="signature">(obj)</span><span class="type-signature"> → {String}</span></h4>
<div class="description">
The key that represents the passed document.
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>obj</code></td>
<td class="type">
<span class="param-type">Object</span>
</td>
<td class="description last">The document to get the key for.</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="ActiveBucket.js.html">ActiveBucket.js</a>, <a href="ActiveBucket.js.html#line224">line 224</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
The document key.
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">String</span>
</dd>
</dl>
<h4 class="name" id="index"><span class="type-signature"></span>index<span class="signature">(obj)</span><span class="type-signature"> → {Number}</span></h4>
<div class="description">
Get the index that the passed document currently occupies
or the index it will occupy if added to the active bucket.
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>obj</code></td>
<td class="type">
<span class="param-type">Object</span>
</td>
<td class="description last">The document to get the index for.</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="ActiveBucket.js.html">ActiveBucket.js</a>, <a href="ActiveBucket.js.html#line204">line 204</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
The index.
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Number</span>
</dd>
</dl>
<h4 class="name" id="insert"><span class="type-signature"></span>insert<span class="signature">(obj)</span><span class="type-signature"> → {Number}</span></h4>
<div class="description">
Inserts a document into the active bucket.
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>obj</code></td>
<td class="type">
<span class="param-type">Object</span>
</td>
<td class="description last">The document to insert.</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="ActiveBucket.js.html">ActiveBucket.js</a>, <a href="ActiveBucket.js.html#line146">line 146</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
The index the document now occupies.
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Number</span>
</dd>
</dl>
<h4 class="name" id="qs"><span class="type-signature"></span>qs<span class="signature">(obj, arr, item, fn)</span><span class="type-signature"> → {Number}</span></h4>
<div class="description">
Quicksorts a single document into the passed array and
returns the index that the document should occupy.
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>obj</code></td>
<td class="type">
<span class="param-type">Object</span>
</td>
<td class="description last">The document to calculate index for.</td>
</tr>
<tr>
<td class="name"><code>arr</code></td>
<td class="type">
<span class="param-type">Array</span>
</td>
<td class="description last">The array the document index will be
calculated for.</td>
</tr>
<tr>
<td class="name"><code>item</code></td>
<td class="type">
<span class="param-type">String</span>
</td>
<td class="description last">The string key representation of the
document whose index is being calculated.</td>
</tr>
<tr>
<td class="name"><code>fn</code></td>
<td class="type">
<span class="param-type">function</span>
</td>
<td class="description last">The comparison function that is used
to determine if a document is sorted below or above the
document we are calculating the index for.</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="ActiveBucket.js.html">ActiveBucket.js</a>, <a href="ActiveBucket.js.html#line48">line 48</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
The index the document should occupy.
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Number</span>
</dd>
</dl>
<h4 class="name" id="remove"><span class="type-signature"></span>remove<span class="signature">(obj)</span><span class="type-signature"> → {Number}</span></h4>
<div class="description">
Removes a document from the active bucket.
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>obj</code></td>
<td class="type">
<span class="param-type">Object</span>
</td>
<td class="description last">The document to remove.</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="ActiveBucket.js.html">ActiveBucket.js</a>, <a href="ActiveBucket.js.html#line175">line 175</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
The index of the document if the document
was removed successfully or -1 if it wasn't found in the
active bucket.
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Number</span>
</dd>
</dl>
</article>
</section>
</div>
<nav>
<h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="ActiveBucket.html">ActiveBucket</a></li><li><a href="Angular.html">Angular</a></li><li><a href="AutoBind.html">AutoBind</a></li><li><a href="Collection.html">Collection</a></li><li><a href="CollectionGroup.html">CollectionGroup</a></li><li><a href="Condition.html">Condition</a></li><li><a href="Core.html">Core</a></li><li><a href="Db.html">Db</a></li><li><a href="Document.html">Document</a></li><li><a href="Grid.html">Grid</a></li><li><a href="Highchart.html">Highchart</a></li><li><a href="Index2d.html">Index2d</a></li><li><a href="IndexBinaryTree.html">IndexBinaryTree</a></li><li><a href="IndexHashMap.html">IndexHashMap</a></li><li><a href="Infinilist.html">Infinilist</a></li><li><a href="KeyValueStore.html">KeyValueStore</a></li><li><a href="Metrics.html">Metrics</a></li><li><a href="MyModule.html">MyModule</a></li><li><a href="NodeApiClient.html">NodeApiClient</a></li><li><a href="NodeApiServer.html">NodeApiServer</a></li><li><a href="NodeRAS.html">NodeRAS</a></li><li><a href="Odm.html">Odm</a></li><li><a href="OldView.html">OldView</a></li><li><a href="Operation.html">Operation</a></li><li><a href="Overload.html">Overload</a></li><li><a href="Overview.html">Overview</a></li><li><a href="Overview_init.html">init</a></li><li><a href="Path.html">Path</a></li><li><a href="Persist.html">Persist</a></li><li><a href="Procedure.html">Procedure</a></li><li><a href="ReactorIO.html">ReactorIO</a></li><li><a href="Section.html">Section</a></li><li><a href="Serialiser.html">Serialiser</a></li><li><a href="Shared.overload.html">overload</a></li><li><a href="View.html">View</a></li></ul><h3>Mixins</h3><ul><li><a href="ChainReactor.html">ChainReactor</a></li><li><a href="Common.html">Common</a></li><li><a href="Constants.html">Constants</a></li><li><a href="Events.html">Events</a></li><li><a href="Matching.html">Matching</a></li><li><a href="Shared.html">Shared</a></li><li><a href="Sorting.html">Sorting</a></li><li><a href="Tags.html">Tags</a></li><li><a href="Triggers.html">Triggers</a></li><li><a href="Updating.html">Updating</a></li></ul><h3><a href="global.html">Global</a></h3>
</nav>
<br class="clear">
<footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.0</a> on Thu Mar 01 2018 11:34:22 GMT+0000 (GMT)
</footer>
<script> prettyPrint(); </script>
<script src="scripts/linenumber.js"> </script>
</body>
</html>