]> git.mxchange.org Git - hub.git/blobdiff - application/hub/interfaces/distributable/class_Distributable.php
Added very basic implementation of updateDhtData()
[hub.git] / application / hub / interfaces / distributable / class_Distributable.php
index e3511e7b88a5eaca35e30d30ee473c45507b8042..dc828071d27f532228fd2e62c3b5f46b1c61f95d 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
@@ -56,10 +65,31 @@ interface Distributable extends FrameworkInterface {
         * 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
-        * @return      $nodeList               An array with all found nodes
+        * @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 queryLocalNodeListExceptByMessageData (array $messageData);
+       function updateDhtData ();
 }
 
 // [EOF]