thali
Version:
516 lines (174 loc) • 13.5 kB
HTML
<html lang="en">
<head>
<meta charset="utf-8">
<title>JSDoc: Class: ThaliPeerPoolInterface</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: ThaliPeerPoolInterface</h1>
<section>
<header>
<h2>
<span class="ancestors"><a href="module-thaliPeerPoolInterface.html">thaliPeerPoolInterface</a>~</span>ThaliPeerPoolInterface</h2>
</header>
<article>
<div class="container-overview">
<h4 class="name" id="ThaliPeerPoolInterface"><span class="type-signature"></span>new ThaliPeerPoolInterface<span class="signature">()</span><span class="type-signature"></span></h4>
<div class="description">
<p>Interface for a class that can manage communications with remote peers. All
requests to communicate with remote peers are submitted as action class
instances to a pool who decides how many actions of which types to allow.
The pool will also track how many incoming connections there are and turn
off advertising when necessary to keep the number of connections at an
acceptable limit.</p>
<p><strong>Open Issue:</strong> One suspects that it will turn out that Bluetooth has a fixed
limit for how many connections it can have regardless of who initiated them.
But this has not been proved yet. Once it is we will need to specify that the
pool has to manage the fixed sum of ingoing and outgoing connections.</p>
<p><strong>Open Issue:</strong> Have we found a practical limit to how many simultaneous
sessions MPCF can handle? One suspects the behavior will be different over
Bluetooth vs Apple's proprietary variant of Wifi Direct vs a Wifi AP point.
We will have to consider the answer to the question of connection limits when
creating an instance of this interface.</p>
<p>This is created as an interface in order to allow us to experiment with
different approaches for managing bandwidth and to make it easy for third
parties to create their own drop in managers.</p>
<p>Amongst other things the pool must limit:</p>
<ul>
<li>How many simultaneous HTTP requests we have outstanding.<ul>
<li>Typically this will be a global pool for Wifi and a per peer pool for
non-TCP transports.</li>
</ul>
</li>
<li>How many incoming peers are allowed to simultaneously have incoming
connections over non-TCP transports.</li>
</ul>
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="NextGeneration_thaliPeerPoolInterface.js.html">NextGeneration/thaliPeerPoolInterface.js</a>, <a href="NextGeneration_thaliPeerPoolInterface.js.html#line40">line 40</a>
</li></ul></dd>
</dl>
</div>
<h3 class="subsection-title">Methods</h3>
<h4 class="name" id="enqueue"><span class="type-signature"></span>enqueue<span class="signature">(peerAction)</span><span class="type-signature"> → (nullable) {Error}</span></h4>
<div class="description">
<p>Adds a request to run the specified peerAction.</p>
<p>If there is already an entry either in the queue or currently running with
the same peerAction object then the "Object already in use" error MUST be
returned and no further action taken.</p>
<p>If peerAction is null or not a peerAction object then a "Bad peerAction"
error MUST be returned.</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>peerAction</code></td>
<td class="type">
<span class="param-type"><a href="module-thaliPeerAction-PeerAction.html">module:thaliPeerAction~PeerAction</a></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="NextGeneration_thaliPeerPoolInterface.js.html">NextGeneration/thaliPeerPoolInterface.js</a>, <a href="NextGeneration_thaliPeerPoolInterface.js.html#line59">line 59</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>Null unless there is a problem in which case Error is
returned.</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Error</span>
</dd>
</dl>
<h4 class="name" id="kill"><span class="type-signature"></span>kill<span class="signature">(peerAction)</span><span class="type-signature"> → (nullable) {Error}</span></h4>
<div class="description">
<p>Requests that the identified action be killed. The exact meaning of kill
depends on the state of the action.</p>
<p>If the action is still in the pool's queue then it MUST be removed from the
queue, the kill method called on the action and then the pool MUST stop
tracking that action.</p>
<p>If the action was started by the pool and is in its started state but has not
finished yet then the kill method MUST be called on the action and the pool
MUST NOT track the action any further.</p>
<p>If the action is not recognized then this is treated as a success and null is
returned.</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>peerAction</code></td>
<td class="type">
<span class="param-type"><a href="module-thaliPeerAction-PeerAction.html">module:thaliPeerAction~PeerAction</a></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="NextGeneration_thaliPeerPoolInterface.js.html">NextGeneration/thaliPeerPoolInterface.js</a>, <a href="NextGeneration_thaliPeerPoolInterface.js.html#line82">line 82</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>Null will be returned if the kill succeeded otherwise an
Error object will be returned.</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Error</span>
</dd>
</dl>
</article>
</section>
</div>
<nav>
<h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-TCPServersManager.html">TCPServersManager</a></li><li><a href="module-thaliMobile.html">thaliMobile</a></li><li><a href="module-thaliMobileNative.html">thaliMobileNative</a></li><li><a href="module-thaliMobileNativeWrapper.html">thaliMobileNativeWrapper</a></li><li><a href="module-thaliNotificationAction.html">thaliNotificationAction</a></li><li><a href="module-thaliNotificationBeacons.html">thaliNotificationBeacons</a></li><li><a href="module-thaliNotificationClient.html">thaliNotificationClient</a></li><li><a href="module-thaliNotificationServer.html">thaliNotificationServer</a></li><li><a href="module-thaliPeerAction.html">thaliPeerAction</a></li><li><a href="module-thaliPeerDictionary.html">thaliPeerDictionary</a></li><li><a href="module-thaliPeerPoolInterface.html">thaliPeerPoolInterface</a></li><li><a href="module-ThaliWifiInfrastructure.html">ThaliWifiInfrastructure</a></li><li><a href="module-WifiBasedNativeMock.html">WifiBasedNativeMock</a></li></ul><h3>Externals</h3><ul><li><a href="external-_Mobile(_connect_)_.html">Mobile('connect')</a></li><li><a href="external-_Mobile(_discoveryAdvertisingStateUpdateNonTCP_)_.html">Mobile('discoveryAdvertisingStateUpdateNonTCP')</a></li><li><a href="external-_Mobile(_incomingConnectionToPortNumberFailed_)_.html">Mobile('incomingConnectionToPortNumberFailed')</a></li><li><a href="external-_Mobile(_killConnections_)_.html">Mobile('killConnections')</a></li><li><a href="external-_Mobile(_networkChanged_)_.html">Mobile('networkChanged')</a></li><li><a href="external-_Mobile(_peerAvailabilityChanged_)_.html">Mobile('peerAvailabilityChanged')</a></li><li><a href="external-_Mobile(_startListeningForAdvertisements_)_.html">Mobile('startListeningForAdvertisements')</a></li><li><a href="external-_Mobile(_startUpdateAdvertisingAndListening_)_.html">Mobile('startUpdateAdvertisingAndListening')</a></li><li><a href="external-_Mobile(_stopAdvertisingAndListening_)_.html">Mobile('stopAdvertisingAndListening')</a></li><li><a href="external-_Mobile(_stopListeningForAdvertisements_)_.html">Mobile('stopListeningForAdvertisements')</a></li></ul><h3>Classes</h3><ul><li><a href="ConnectionTable.html">ConnectionTable</a></li><li><a href="module-TCPServersManager-TCPServersManager.html">TCPServersManager</a></li><li><a href="module-thaliNotificationAction-NotificationAction.html">NotificationAction</a></li><li><a href="module-thaliNotificationBeacons-ParseBeaconsResponse.html">ParseBeaconsResponse</a></li><li><a href="module-thaliNotificationClient-ThaliNotificationClient.html">ThaliNotificationClient</a></li><li><a href="module-thaliNotificationServer-ThaliNotificationServer.html">ThaliNotificationServer</a></li><li><a href="module-thaliPeerAction-PeerAction.html">PeerAction</a></li><li><a href="module-thaliPeerDictionary-NotificationPeerDictionaryEntry.html">NotificationPeerDictionaryEntry</a></li><li><a href="module-thaliPeerDictionary-PeerConnectionInformation.html">PeerConnectionInformation</a></li><li><a href="module-thaliPeerDictionary-PeerDictionary.html">PeerDictionary</a></li><li><a href="module-thaliPeerPoolInterface-ThaliPeerPoolInterface.html">ThaliPeerPoolInterface</a></li><li><a href="module-ThaliWifiInfrastructure-ThaliWifiInfrastructure.html">ThaliWifiInfrastructure</a></li><li><a href="module-WifiBasedNativeMock-MobileCallInstance.html">MobileCallInstance</a></li><li><a href="module-WifiBasedNativeMock-WifiBasedNativeMock.html">WifiBasedNativeMock</a></li></ul><h3>Events</h3><ul><li><a href="module-thaliMobileNativeWrapper.html#~event:discoveryAdvertisingStateUpdateNonTCPEvent">discoveryAdvertisingStateUpdateNonTCPEvent</a></li><li><a href="module-ThaliWifiInfrastructure.html#~event:discoveryAdvertisingStateUpdateWifiEvent">discoveryAdvertisingStateUpdateWifiEvent</a></li><li><a href="module-TCPServersManager.html#~event:failedConnection">failedConnection</a></li><li><a href="module-thaliMobileNativeWrapper.html#~event:incomingConnectionToPortNumberFailed">incomingConnectionToPortNumberFailed</a></li><li><a href="module-thaliMobileNativeWrapper.html#~event:networkChangedNonTCP">networkChangedNonTCP</a></li><li><a href="module-ThaliWifiInfrastructure.html#~event:networkChangedWifi">networkChangedWifi</a></li><li><a href="module-thaliMobileNativeWrapper.html#~event:nonTCPPeerAvailabilityChangedEvent">nonTCPPeerAvailabilityChangedEvent</a></li><li><a href="module-TCPServersManager.html#~event:routerPortConnectionFailed">routerPortConnectionFailed</a></li><li><a href="module-ThaliWifiInfrastructure.html#~event:wifiPeerAvailabilityChanged">wifiPeerAvailabilityChanged</a></li><li><a href="module-thaliMobile.html#.event:event:discoveryAdvertisingStateUpdate">discoveryAdvertisingStateUpdate</a></li><li><a href="module-thaliMobile.html#.event:event:networkChanged">networkChanged</a></li><li><a href="module-thaliMobile.html#.event:event:peerAvailabilityChanged">peerAvailabilityChanged</a></li><li><a href="module-thaliNotificationAction-NotificationAction.html#.event:event:Resolved">Resolved</a></li><li><a href="module-thaliNotificationClient.html#.event:event:peerAdvertisesDataForUs">peerAdvertisesDataForUs</a></li></ul><h3>Global</h3><ul><li><a href="global.html#getPKCS12Content">getPKCS12Content</a></li><li><a href="global.html#getPublicKeyHash">getPublicKeyHash</a></li><li><a href="global.html#stopThaliReplicationManager">stopThaliReplicationManager</a></li><li><a href="global.html#ThaliEmitter">ThaliEmitter</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 Jan 18 2016 11:19:32 GMT+0200 (EET)
</footer>
<script> prettyPrint(); </script>
<script src="scripts/linenumber.js"> </script>
</body>
</html>