]> git.mxchange.org Git - hub.git/commitdiff
Some missing code added:
authorRoland Haeder <roland@mxchange.org>
Sun, 9 Feb 2014 03:02:24 +0000 (04:02 +0100)
committerRoland Haeder <roland@mxchange.org>
Sun, 9 Feb 2014 03:02:24 +0000 (04:02 +0100)
- Updated interface NodeDhtWrapper
- Added cleanup of non-public data from DHT entry array
- Again 'core' has "changed" ???

Signed-off-by: Roland Haeder <roland@mxchange.org>
application/hub/interfaces/wrapper/class_NodeDhtWrapper.php
application/hub/main/database/wrapper/node/class_NodeDistributedHashTableDatabaseWrapper.php
application/hub/main/database/wrapper/node/class_NodeInformationDatabaseWrapper.php
application/hub/main/dht/class_BaseDht.php
core

index e41ead812aa97682b3d19c9dea89349d31a7730f..64eea869518059395207e6a79afb61115b681e50 100644 (file)
  * along with this program. If not, see <http://www.gnu.org/licenses/>.
  */
 interface NodeDhtWrapper extends DatabaseWrapper {
+       /**
+        * Getter for result instance for unpublished entries
+        *
+        * @return      $unpublishedEntriesInstance             Result instance
+        */
+       function getUnpublishedEntriesInstance ();
+
        /**
         * Checks whether the local (*this*) node is registered in the DHT by
         * checking if the external ip/port is found.
@@ -53,6 +60,25 @@ interface NodeDhtWrapper extends DatabaseWrapper {
         */
        function findNodeLocalBySessionId ($sessionId);
 
+       /**
+        * Registeres a node by given message data.
+        *
+        * @param       $messageData            An array of all message data
+        * @param       $handlerInstance        An instance of a Handleable class
+        * @return      void
+        */
+       function registerNodeByMessageData (array $messageData, Handleable $handlerInstance);
+
+       /**
+        * Updates an existing entry in node list
+        *
+        * @param       $messageData            An array of all message data
+        * @param       $handlerInstance        An instance of a Handleable class
+        * @param       $searchInstance         An instance of LocalSearchCriteria class
+        * @return      void
+        */
+       function updateNodeByMessageData (array $messageData, Handleable $handlerInstance, LocalSearchCriteria $searchInstance);
+
        /**
         * Determines whether the given node data is already inserted in the DHT
         *
@@ -81,6 +107,32 @@ interface NodeDhtWrapper extends DatabaseWrapper {
         * @throws      NodeDataMissingException        If the node's data is missing
         */
        function updateNode (array $nodeData);
+
+       /**
+        * Checks whether there are unpublished entries
+        *
+        * @return      $hasUnpublished         Whether there are unpublished entries
+        * @todo        Add minimum/maximum age limitations
+        */
+       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.
+        *
+        * @return      void
+        * @todo        Add timestamp to dataset instance
+        */
+       function initEntryPublication ();
+
+       /**
+        * Removes non-public data from given array.
+        *
+        * @param       $data   An array with possible non-public data that needs to be removed.
+        * @return      $data   A cleaned up array with only public data.
+        */
+       function removeNonPublicDataFromArray (array $data);
 }
 
 // [EOF]
index 3cc15d8e4ac4d8e5fbbe34cb2ec53d02cbf73a0b..b9035bd06390ceeeb609a8a5798cc77b7ebf9b74 100644 (file)
@@ -491,6 +491,20 @@ class NodeDistributedHashTableDatabaseWrapper extends BaseDatabaseWrapper implem
                // Run the "UPDATE" query
                $this->queryUpdateDataSet($dataSetInstance);
        }
+
+       /**
+        * Removes non-public data from given array.
+        *
+        * @param       $data   An array with possible non-public data that needs to be removed.
+        * @return      $data   A cleaned up array with only public data.
+        */
+       public function removeNonPublicDataFromArray(array $data) {
+               // Currently call only inner method
+               $data = parent::removeNonPublicDataFromArray($data);
+
+               // Return cleaned data
+               return $data;
+       }
 }
 
 // [EOF]
index 2b2f6b70db09e2d125fde624757d32195ce44ceb..307cbb3e536b863665b08cba45ad5b6892761381 100644 (file)
@@ -163,6 +163,20 @@ class NodeInformationDatabaseWrapper extends BaseDatabaseWrapper implements Node
                // Update database record
                $this->queryUpdateDataSet($dataSetInstance);
        }
+
+       /**
+        * Removes non-public data from given array.
+        *
+        * @param       $data   An array with possible non-public data that needs to be removed.
+        * @return      $data   A cleaned up array with only public data.
+        */
+       public function removeNonPublicDataFromArray(array $data) {
+               // Currently call only inner method
+               $data = parent::removeNonPublicDataFromArray($data);
+
+               // Return cleaned data
+               return $data;
+       }
 }
 
 // [EOF]
index e676653f497d9bf48ada8efcc210827151f6af58..f6b5396ed8b29745e899fbb32bf2b3df48f3388d 100644 (file)
@@ -208,6 +208,9 @@ abstract class BaseDht extends BaseHubSystem {
                // Some sanity-checks
                assert(is_array($entry));
 
+               // Remove any non-public data the database layer desires
+               $entry = $this->getWrapperInstance()->removeNonPublicDataFromArray($entry);
+
                // Inject variables
                $this->publishHelperInstance->getTemplateInstance()->injectConfigVariables($entry);
 
diff --git a/core b/core
index b287094ddaed86f6d71c2d54f7b18d26a2312fd4..76c734026223c500bb37cc22539cbd1c6f006f83 160000 (submodule)
--- a/core
+++ b/core
@@ -1 +1 @@
-Subproject commit b287094ddaed86f6d71c2d54f7b18d26a2312fd4
+Subproject commit 76c734026223c500bb37cc22539cbd1c6f006f83