]> git.mxchange.org Git - hub.git/blobdiff - application/hub/interfaces/distributable/class_Distributable.php
Use array_push() instead of [] as array_push() checks if parameter 1 is really an...
[hub.git] / application / hub / interfaces / distributable / class_Distributable.php
index ad031b4565cb10c9ee72abaed4692fb8f3c98a7b..94d2f4ab33ac42bc9188207ffa24e153acde7c1f 100644 (file)
@@ -30,12 +30,21 @@ interface Distributable extends FrameworkInterface {
        function initDht ();
 
        /**
-        * Finds a node by given session id
+        * Bootstraps the DHT by sending out a message to all available nodes
+        * (including itself). This step helps the node to get to know more nodes
+        * which can be queried later for object distribution.
+        *
+        * @return      void
+        */
+       function bootstrapDht ();
+
+       /**
+        * Finds a node locally by given session id
         *
         * @param       $sessionId      Session id to lookup
-        * @return      $nodeData       Node data array
+        * @return      $nodeData       Node-data array
         */
-       function findNodeBySessionId ($sessionId);
+       function findNodeLocalBySessionId ($sessionId);
 
        /**
         * Registers an other node with this node by given message data. The
@@ -45,12 +54,56 @@ interface Distributable extends FrameworkInterface {
         * - external-ip (hostname or IP number)
         * - listen-port (TCP/UDP listen port for inbound connections)
         *
-        * @param       $messageArray           An array with all minimum message data
+        * @param       $messageData            An array with all minimum message data
         * @param       $handlerInstance        An instance of a Handleable class
         * @param       $forceUpdate            Optionally force update, don't register (default: register if not found)
         * @return      void
         */
        function registerNodeByMessageData (array $messageData, Handleable $handlerInstance, $forceUpdate = FALSE);
+
+       /**
+        * Queries the local DHT data(base) for a node list with all supported
+        * object types except the node by given session id.
+        *
+        * @param       $messageData            An array with message data from a node_list request
+        * @param       $handlerInstance        An instance of a Handleable class
+        * @param       $excludeKey                     Array key which should be excluded
+        * @param       $andKey                         Array of $separator-separated list of elements which all must match
+        * @param       $separator                      Sepator char (1st parameter for explode() call)
+        * @return      $nodeList                       An array with all found nodes
+        */
+       function queryLocalNodeListExceptByMessageData (array $messageData, Handleable $handlerInstance, $excludeKey, $andKey, $separator);
+
+       /**
+        * Inserts given node list array (from earlier database result produced by
+        * an other node) into the DHT. This array origins from above method
+        * queryLocalNodeListExceptByMessageData().
+        *
+        * @param       $nodeList       An array from an earlier database result instance
+        * @return      void
+        */
+       function insertNodeList (array $nodeList);
+
+       /**
+        * Updates/refreshes DHT data (e.g. status).
+        *
+        * @return      void
+        */
+       function updateDhtData ();
+
+       /**
+        * Checks whether there are entries in "INSERT" node data stack
+        *
+        * @return      $isPending      Whether there are pending entries
+        */
+       function ifInsertNodeDataPending ();
+
+       /**
+        * Inserts a single entry of node data into the DHT
+        *
+        * @return      void
+        */
+       function insertSingleNodeData ();
 }
 
 // [EOF]