]> git.mxchange.org Git - hub.git/blobdiff - application/hub/interfaces/distributable/class_Distributable.php
Introduced ifDhtIsBooting(), updated TODOs.txt
[hub.git] / application / hub / interfaces / distributable / class_Distributable.php
index d7fa805b0c776ff81eb50cce13b8f869c895a59b..8adbc8d64b822eef96c3b40e86a24a9f7aacf22e 100644 (file)
@@ -39,71 +39,64 @@ interface Distributable extends FrameworkInterface {
        function bootstrapDht ();
 
        /**
-        * Finds a node locally by given session id
+        * Updates/refreshes DHT data (e.g. status).
         *
-        * @param       $sessionId      Session id to lookup
-        * @return      $nodeData       Node-data array
+        * @return      void
         */
-       function findNodeLocalBySessionId ($sessionId);
+       function updateDhtData ();
 
        /**
-        * Registers an other node with this node by given message data. The
-        * following data must always be present:
+        * Checks whether there are unpublished entries
         *
-        * - session-id  (for finding the node's record together with below data)
-        * - external-ip (hostname or IP number)
-        * - listen-port (TCP/UDP listen port for inbound connections)
+        * @return      $hasUnpublished         Whether there are unpublished entries
+        */
+       function hasUnpublishedEntries ();
+
+       /**
+        * Initializes publication of DHT entries. This does only prepare
+        * publication. The next step is to pickup such prepared entries and publish
+        * them by uploading to other (recently appeared) DHT members.
         *
-        * @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);
+       function initEntryPublication ();
 
        /**
-        * Queries the local DHT data(base) for a node list with all supported
-        * object types except the node by given session id.
+        * Checks whether there are entries pending publication
         *
-        * @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
+        * @return      $isPending      Whether there are entries pending publication
         */
-       function queryLocalNodeListExceptByMessageData (array $messageData, Handleable $handlerInstance, $excludeKey, $andKey, $separator);
+       function hasEntriesPendingPublication ();
 
        /**
-        * Inserts given node list array (from earlier database result produced by
-        * an other node) into the DHT. This array origins from above method
-        * queryLocalNodeListExceptByMessageData().
+        * Publishes next entry found in stack. This method shall also update the
+        * corresponding dabase entry.
         *
-        * @param       $nodeList       An array from an earlier database result instance
         * @return      void
         */
-       function insertNodeList (array $nodeList);
+       function publishEntry ();
 
        /**
-        * Updates/refreshes DHT data (e.g. status).
+        * Find recipients for given package data
         *
-        * @return      void
+        * @param       $packageData    An array of valid package data
+        * @return      $recipients             An indexed array with DHT recipients
         */
-       function updateDhtData ();
+       function findRecipientsByPackageData (array $packageData);
 
        /**
-        * Checks whether there are entries in "INSERT" node data stack
+        * Whether the DHT has fully bootstrapped (after state 'booting')
         *
-        * @return      $isPending      Whether there are pending entries
+        * @return      $isFullyBooted  Whether the DHT is fully booted
         */
-       function ifInsertNodeDataPending ();
+       function hasFullyBootstrapped ();
 
        /**
-        * Inserts a single entry of node data into the DHT
+        * Whether this DHT's state is 'booting'
         *
-        * @return      void
+        * @return      $isBooting      Whether this DHT is currently booting
         */
-       function insertSingleNodeData ();
+       function ifDhtIsBooting ();
 }
 
 // [EOF]