copious-transitions
Version:
Framework for working with frameworks
1,499 lines (388 loc) • 22.8 kB
HTML
<html lang="en">
<head>
<meta charset="utf-8">
<title>JSDoc: Class: FilesAndRelays_base</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: FilesAndRelays_base</h1>
<section>
<header>
<h2><span class="attribs"><span class="type-signature"></span></span>
<span class="ancestors"><a href="DefaultDB.html">DefaultDB</a>.</span>FilesAndRelays_base<span class="signature">()</span><span class="type-signature"></span></h2>
<div class="class-description"><p>Deals with CRUD operations for data.</p>
<p>The logic of the methods provide decisions about when to request a remote for data if it is not found locally.
Also, these methods interact with the application implementation of the methods outlined in CustomizationMethodsByApplication.</p></div>
</header>
<article>
<div class="container-overview">
<h2>Constructor</h2>
<h4 class="name" id="FilesAndRelays_base"><span class="type-signature"></span>new FilesAndRelays_base<span class="signature">()</span><span class="type-signature"></span></h4>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="custom_storage_files_and_relays.js.html">custom_storage/files_and_relays.js</a>, <a href="custom_storage_files_and_relays.js.html#line462">line 462</a>
</li></ul></dd>
</dl>
</div>
<h3 class="subsection-title">Methods</h3>
<h4 class="name" id=""><span class="type-signature"></span><span class="signature">(obj, do_remote)</span><span class="type-signature"></span></h4>
<div class="description">
<p>Enters the object into the storage map. Tells the application to handle it in case that it is large.
Tells the remote storage partners that this has created a new object for them to know about.</p>
</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"></td>
</tr>
<tr>
<td class="name"><code>do_remote</code></td>
<td class="type">
<span class="param-type">boolean</span>
</td>
<td class="description last"><ul>
<li>provided for applicationst that would like to prevent telling the remotes every time an object is created</li>
</ul></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="custom_storage_files_and_relays.js.html">custom_storage/files_and_relays.js</a>, <a href="custom_storage_files_and_relays.js.html#line545">line 545</a>
</li></ul></dd>
</dl>
<h4 class="name" id="all_keys"><span class="type-signature"></span>all_keys<span class="signature">()</span><span class="type-signature"></span></h4>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="custom_storage_files_and_relays.js.html">custom_storage/files_and_relays.js</a>, <a href="custom_storage_files_and_relays.js.html#line667">line 667</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>an array (list) of wide area identifiers</p>
</div>
<h4 class="name" id="delete"><span class="type-signature"></span>delete<span class="signature">(id, dont_remote)</span><span class="type-signature"></span></h4>
<div class="description">
<p>This attempts to remove data from everywhere.<br>
The local data stash is cleared of the data.
Removes the object from the local <code>_stroage_map</code>
Then, it suggests to the remote that the object be forgotten.</p>
</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>id</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last"></td>
</tr>
<tr>
<td class="name"><code>dont_remote</code></td>
<td class="type">
<span class="param-type">boolean</span>
</td>
<td class="description last"><ul>
<li>true if the object should be removed remotely</li>
</ul></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="custom_storage_files_and_relays.js.html">custom_storage/files_and_relays.js</a>, <a href="custom_storage_files_and_relays.js.html#line655">line 655</a>
</li></ul></dd>
</dl>
<h4 class="name" id="findOne"><span class="type-signature">(async) </span>findOne<span class="signature">(wa_id, dont_create)</span><span class="type-signature"> → {object|boolean}</span></h4>
<div class="description">
<p>First looks in the <code>_storage_map</code>. If it is there, this method updates the object's timestamp and then
calls on the application's data completion method, <code>application_large_data_from_stash</code>.</p>
<p>If the object is not in the <code>_storage_map</code>, this attemps to fetch the object from remote stores.
(Note that the object is already known in this case in that the wide area id is the parameter of the method.)</p>
<p>If the object cannot be found in a remote store, then this method will attempt to create one
unless <code>dont_create</code> is set.</p>
</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>wa_id</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last"></td>
</tr>
<tr>
<td class="name"><code>dont_create</code></td>
<td class="type">
<span class="param-type">boolean</span>
</td>
<td class="description last"><p>only the static descendant has to worry about dont_create</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="custom_storage_files_and_relays.js.html">custom_storage/files_and_relays.js</a>, <a href="custom_storage_files_and_relays.js.html#line570">line 570</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>The found object or false. Returns false if the object is nowhere...</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">object</span>
|
<span class="param-type">boolean</span>
</dd>
</dl>
<h4 class="name" id="initialize"><span class="type-signature"></span>initialize<span class="signature">(conf)</span><span class="type-signature"></span></h4>
<div class="description">
<p>Sets up the db file and then calls its super intializer (LocalStorageLifeCycle).
Finally, it sets up the pub/sub system configured by knowledge domains.</p>
<p>The pub/sub aspect of this data management interface allows subscription
to a number of topics refered to as knowledge_domains. Knowledge domains are listed in an array on the configuration.
This initialization subscribes to a number of topcis and then passes the subscription response down to the
application implementation</p>
</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>conf</code></td>
<td class="type">
<span class="param-type">object</span>
</td>
<td class="description last"></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="custom_storage_files_and_relays.js.html">custom_storage/files_and_relays.js</a>, <a href="custom_storage_files_and_relays.js.html#line483">line 483</a>
</li></ul></dd>
</dl>
<h4 class="name" id="remote_store_sync"><span class="type-signature"></span>remote_store_sync<span class="signature">(ids, prune)</span><span class="type-signature"></span></h4>
<div class="description">
<p>Looks through all the objecs in the <code>_storage_map</code> and tells the remote store about them.
If the <em>prune</em> parameter is provded, deletes the object from the <code>do_remote</code>.</p>
<p>This is a helper method that does its task without asking anymore questions.</p>
</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>ids</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last"></td>
</tr>
<tr>
<td class="name"><code>prune</code></td>
<td class="type">
<span class="param-type">boolean</span>
</td>
<td class="description last"></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="custom_storage_files_and_relays.js.html">custom_storage/files_and_relays.js</a>, <a href="custom_storage_files_and_relays.js.html#line525">line 525</a>
</li></ul></dd>
</dl>
<h4 class="name" id="search_one"><span class="type-signature">(async) </span>search_one<span class="signature">(key, field)</span><span class="type-signature"> → {object|boolean}</span></h4>
<div class="description">
<p>like findOne, but will return false if the remote object cannot be found (i.e does not create)</p>
<p>Also, this will pass along data for a key search on the remote.
When the object comes back the application has a chance to reset ID fields to match remote data.
This method also calls <code>application_large_data_from_stash</code>.</p>
</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>key</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last"></td>
</tr>
<tr>
<td class="name"><code>field</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last"></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="custom_storage_files_and_relays.js.html">custom_storage/files_and_relays.js</a>, <a href="custom_storage_files_and_relays.js.html#line601">line 601</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<ul>
<li>false if the object cannot be restored from the remotes, otherwise the sanitized object</li>
</ul>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">object</span>
|
<span class="param-type">boolean</span>
</dd>
</dl>
<h4 class="name" id="update"><span class="type-signature">(async) </span>update<span class="signature">(obj, dont_remote, udpate_op)</span><span class="type-signature"> → {Error|boolean}</span></h4>
<div class="description">
<p>This adds an object to the storage map if it is not already there.
An error will be returned if the object is already stored. (This is useful for debugging but it is ignored)</p>
<p>If the option to to remote is true, the object will be completed by reading in large data if the object is of that size.
Then, the object will be sent to the remote with a default operation <code>update</code>. The data will be marked for writing to a file.</p>
<p>If the is not telling the remote anything, the large data of the object will be stashed.
That is this calls <code>application_large_data_from_stash</code> which should put excessive data into a file and keep a skeleton of the
data in storage.</p>
</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"></td>
</tr>
<tr>
<td class="name"><code>dont_remote</code></td>
<td class="type">
<span class="param-type">boolean</span>
</td>
<td class="description last"></td>
</tr>
<tr>
<td class="name"><code>udpate_op</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last"></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="custom_storage_files_and_relays.js.html">custom_storage/files_and_relays.js</a>, <a href="custom_storage_files_and_relays.js.html#line629">line 629</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<ul>
<li>returns false if it does not return an error</li>
</ul>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Error</span>
|
<span class="param-type">boolean</span>
</dd>
</dl>
</article>
</section>
</div>
<nav>
<h2><a href="index.html">Home</a></h2><h3>Namespaces</h3><ul><li><a href="Contractual.html">Contractual</a></li><li><a href="CopiousTransitions.html">CopiousTransitions</a></li><li><a href="DefaultDB.html">DefaultDB</a></li><li><a href="base.html">base</a></li><li><a href="field_validators.html">field_validators</a></li></ul><h3>Classes</h3><ul><li><a href="Contractual.LocalTObjectCache.html">LocalTObjectCache</a></li><li><a href="Contractual.MimeHandling.html">MimeHandling</a></li><li><a href="Contractual.TransitionHandling.html">TransitionHandling</a></li><li><a href="Contractual.UserHandling.html">UserHandling</a></li><li><a href="CopiousTransitions.CopiousTransitions.html">CopiousTransitions</a></li><li><a href="DefaultDB.CustomizationMethodsByApplication.html">CustomizationMethodsByApplication</a></li><li><a href="DefaultDB.FauxInMemStore.html">FauxInMemStore</a></li><li><a href="DefaultDB.FileMapper.html">FileMapper</a></li><li><a href="DefaultDB.FilesAndRelays.html">FilesAndRelays</a></li><li><a href="DefaultDB.FilesAndRelays_base.html">FilesAndRelays_base</a></li><li><a href="DefaultDB.LocalStaticDB.html">LocalStaticDB</a></li><li><a href="DefaultDB.LocalStorageLifeCycle.html">LocalStorageLifeCycle</a></li><li><a href="DefaultDB.LocalStorageSerialization.html">LocalStorageSerialization</a></li><li><a href="DefaultDB.PageableMemStoreElement.html">PageableMemStoreElement</a></li><li><a href="DefaultDB.PersistenceContracts.html">PersistenceContracts</a></li><li><a href="DefaultDB.RemoteMessaging.html">RemoteMessaging</a></li><li><a href="DefaultDB.StaticDBDefault.html">StaticDBDefault</a></li><li><a href="GeneralUserDBWrapperImpl.html">GeneralUserDBWrapperImpl</a></li><li><a href="SessionTokenManager.html">SessionTokenManager</a></li><li><a href="base.DBClass.html">DBClass</a></li><li><a href="base.EndpointManager.html">EndpointManager</a></li><li><a href="base.GeneralAppLifeCycle.html">GeneralAppLifeCycle</a></li><li><a href="base.GeneralAuth.html">GeneralAuth</a></li><li><a href="base.GeneralBusiness.html">GeneralBusiness</a></li><li><a href="base.GeneralDynamic.html">GeneralDynamic</a></li><li><a href="base.GeneralMiddleWare.html">GeneralMiddleWare</a></li><li><a href="base.GeneralStatic.html">GeneralStatic</a></li><li><a href="base.GeneralTransitionEngImpl.html">GeneralTransitionEngImpl</a></li><li><a href="base.SessionManager.html">SessionManager</a></li><li><a href="base.SessionManager_Lite.html">SessionManager_Lite</a></li><li><a href="base.TaggedTransition.html">TaggedTransition</a></li><li><a href="base.TokenTables.html">TokenTables</a></li><li><a href="base.UserMessageEndpoint.html">UserMessageEndpoint</a></li><li><a href="base.WebSocketManager.html">WebSocketManager</a></li><li><a href="field_validators.DataLookupField.html">DataLookupField</a></li><li><a href="field_validators.EmailField.html">EmailField</a></li><li><a href="field_validators.EmailVerifyField.html">EmailVerifyField</a></li><li><a href="field_validators.FieldTest.html">FieldTest</a></li><li><a href="field_validators.FieldValidatorTools.html">FieldValidatorTools</a></li><li><a href="field_validators.ForeignAuth.html">ForeignAuth</a></li><li><a href="field_validators.GeneralValidator.html">GeneralValidator</a></li><li><a href="field_validators.LengthyAlphabetField.html">LengthyAlphabetField</a></li><li><a href="field_validators.LengthyDigitalField.html">LengthyDigitalField</a></li><li><a href="field_validators.LengthyField.html">LengthyField</a></li><li><a href="field_validators.LengthyStringField.html">LengthyStringField</a></li><li><a href="field_validators.PasswordField.html">PasswordField</a></li><li><a href="field_validators.PasswordVerifyField.html">PasswordVerifyField</a></li><li><a href="field_validators.TypeCheckField.html">TypeCheckField</a></li></ul><h3>Global</h3><ul><li><a href="global.html#generate_password_block">generate_password_block</a></li><li><a href="global.html#load_configuration">load_configuration</a></li><li><a href="global.html#load_parameters">load_parameters</a></li><li><a href="global.html#module_top">module_top</a></li></ul>
</nav>
<br class="clear">
<footer>
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 4.0.2</a> on Tue Oct 31 2023 17:32:59 GMT-0700 (Pacific Daylight Time)
</footer>
<script> prettyPrint(); </script>
<script src="scripts/linenumber.js"> </script>
</body>
</html>