nmos-ledger
Version:
NMOS discovery and registration APIs
1,061 lines (287 loc) • 12.4 kB
HTML
<html lang="en">
<head>
<meta charset="utf-8">
<title>JSDoc: Class: NodeAPI</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: NodeAPI</h1>
<section>
<header>
<h2>NodeAPI</h2>
</header>
<article>
<div class="container-overview">
<h4 class="name" id="NodeAPI"><span class="type-signature"></span>new NodeAPI<span class="signature">(port, store)</span><span class="type-signature"> → {<a href="NodeAPI.html">NodeAPI</a>|Error}</span></h4>
<div class="description">
Create an instance of the Node API.
</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>port</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="description last">Port number of which to run the API. Expected to be
an integer.</td>
</tr>
<tr>
<td class="name"><code>store</code></td>
<td class="type">
<span class="param-type"><a href="NodeStore.html">NodeStore</a></span>
</td>
<td class="description last">Store containing access to the details of the node.</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="api_NodeAPI.js.html">api/NodeAPI.js</a>, <a href="api_NodeAPI.js.html#line28">line 28</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
Creates a NodeAPI or returns an error.
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type"><a href="NodeAPI.html">NodeAPI</a></span>
|
<span class="param-type">Error</span>
</dd>
</dl>
</div>
<h3 class="subsection-title">Methods</h3>
<h4 class="name" id="getPort"><span class="type-signature"></span>getPort<span class="signature">()</span><span class="type-signature"> → {Number}</span></h4>
<div class="description">
Returns the port that this Node API is configured to use.
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="api_NodeAPI.js.html">api/NodeAPI.js</a>, <a href="api_NodeAPI.js.html#line64">line 64</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
Port for this node API.
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Number</span>
</dd>
</dl>
<h4 class="name" id="getStore"><span class="type-signature"></span>getStore<span class="signature">()</span><span class="type-signature"> → {<a href="NodeStore.html">NodeStore</a>}</span></h4>
<div class="description">
Returns the <a href="NodeStore.html">store</a> used to produce results.
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="api_NodeAPI.js.html">api/NodeAPI.js</a>, <a href="api_NodeAPI.js.html#line56">line 56</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
Store backing this Node API.
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type"><a href="NodeStore.html">NodeStore</a></span>
</dd>
</dl>
<h4 class="name" id="init"><span class="type-signature"></span>init<span class="signature">()</span><span class="type-signature"> → {<a href="NodeAPI.html">NodeAPI</a>}</span></h4>
<div class="description">
Initialise the Node APIs routing table.
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="api_NodeAPI.js.html">api/NodeAPI.js</a>, <a href="api_NodeAPI.js.html#line73">line 73</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
Returns this object with the routing table initialised and
ready to <a href="NodeAPI.html#start">NodeAPI#start</a>.
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type"><a href="NodeAPI.html">NodeAPI</a></span>
</dd>
</dl>
<h4 class="name" id="setStore"><span class="type-signature"></span>setStore<span class="signature">(replacementStore)</span><span class="type-signature"> → {Error|null}</span></h4>
<div class="description">
Replace the <a href="NodeStore.html">store</a> set for this API.
</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>replacementStore</code></td>
<td class="type">
<span class="param-type"><a href="NodeAPI.html">NodeAPI</a></span>
</td>
<td class="description last">Store to use to replace the current one.</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="api_NodeAPI.js.html">api/NodeAPI.js</a>, <a href="api_NodeAPI.js.html#line45">line 45</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
Error if a problem, otherwise null for success.
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Error</span>
|
<span class="param-type">null</span>
</dd>
</dl>
<h4 class="name" id="start"><span class="type-signature"></span>start<span class="signature">(cb<span class="signature-attributes">opt</span>)</span><span class="type-signature"> → {<a href="NodeAPI.html">NodeAPI</a>}</span></h4>
<div class="description">
Start the Node API server. If the port is already in use, the server
will be closed.
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Attributes</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>cb</code></td>
<td class="type">
<span class="param-type">NodeAPI~trackStatus</span>
</td>
<td class="attributes">
<optional><br>
</td>
<td class="description last">Optional callback to track API starting
or errors.</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="api_NodeAPI.js.html">api/NodeAPI.js</a>, <a href="api_NodeAPI.js.html#line206">line 206</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
This object with an asynchronous request
to start the server.
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type"><a href="NodeAPI.html">NodeAPI</a></span>
</dd>
</dl>
<h4 class="name" id="stop"><span class="type-signature"></span>stop<span class="signature">(cb<span class="signature-attributes">opt</span>)</span><span class="type-signature"> → {<a href="NodeAPI.html">NodeAPI</a>}</span></h4>
<div class="description">
Stop the server running the Node API.
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Attributes</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>cb</code></td>
<td class="type">
<span class="param-type">NodeAPI~trackStatus</span>
</td>
<td class="attributes">
<optional><br>
</td>
<td class="description last">Optional callback that tracks when the
server is stopped.</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="api_NodeAPI.js.html">api/NodeAPI.js</a>, <a href="api_NodeAPI.js.html#line233">line 233</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
This object with an asynchronous request
to stop the server.
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type"><a href="NodeAPI.html">NodeAPI</a></span>
</dd>
</dl>
</article>
</section>
</div>
<nav>
<h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="Device.html">Device</a></li><li><a href="Flow.html">Flow</a></li><li><a href="Node.html">Node</a></li><li><a href="NodeAPI.html">NodeAPI</a></li><li><a href="NodeRAMStore.html">NodeRAMStore</a></li><li><a href="Versionned.html">Versionned</a></li></ul><h3>Interfaces</h3><ul><li><a href="NodeStore.html">NodeStore</a></li></ul><h3>Global</h3><ul><li><a href="global.html#capabilities">capabilities</a></li><li><a href="global.html#deviceTypes">deviceTypes</a></li><li><a href="global.html#formats">formats</a></li><li><a href="global.html#statusError">statusError</a></li><li><a href="global.html#transports">transports</a></li></ul>
</nav>
<br class="clear">
<footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.0</a> on Mon Dec 21 2015 17:19:50 GMT+0000 (GMT)
</footer>
<script> prettyPrint(); </script>
<script src="scripts/linenumber.js"> </script>
</body>
</html>