]> git.mxchange.org Git - hub.git/commitdiff
Continued with development:
authorRoland Häder <roland@mxchange.org>
Mon, 27 Feb 2012 23:04:37 +0000 (23:04 +0000)
committerRoland Häder <roland@mxchange.org>
Mon, 27 Feb 2012 23:04:37 +0000 (23:04 +0000)
- Renamed some methods in ChunkHandler (and interface)
- Added another missing public method to HandleableChunks interface
- Internal TODO added to implement a way to allow non-announcement packages
  being hashed with the extra-salt. This extra-salt then needs to be included
  in the announcement.
- TODOs.txt updated

application/hub/interfaces/handler/chunks/class_HandleableChunks.php
application/hub/main/handler/chunks/class_ChunkHandler.php
application/hub/main/package/fragmenter/class_PackageFragmenter.php
application/hub/main/tasks/hub/chunks/class_HubChunkAssemblerTask.php
docs/TODOs.txt

index f19ee14c208a6a8799d70fc0af693e20adb58450..ab9c59318313140a7bd852dd6ae2499087e70ac4 100644 (file)
@@ -31,6 +31,13 @@ interface HandleableChunks extends Handleable {
         */
        function addAllChunksWithFinal (array $chunks);
 
+       /**
+        * Checks whether unhandled chunks are available
+        *
+        * @return      $unhandledChunks        Whether unhandled chunks are left
+        */
+       function ifUnhandledChunksWithFinalAvailable ();
+
        /**
         * Handles available chunks by processing one-by-one (not all together,
         * this would slow-down the whole application) with the help of an
@@ -38,7 +45,7 @@ interface HandleableChunks extends Handleable {
         *
         * @return      void
         */
-       function handleAvailableChunks ();
+       function handleAvailableChunksWithFinal ();
 }
 
 // [EOF]
index 14a726563dd477563c8596d6816cc2c27c7b63f4..8ee59a934321be9850e46fbf1d282dfc207e5337 100644 (file)
@@ -94,7 +94,7 @@ class ChunkHandler extends BaseHandler implements HandleableChunks, Registerable
         *
         * @return      $unhandledChunks        Whether unhandled chunks are left
         */
-       public function ifUnhandledChunksAvailable () {
+       public function ifUnhandledChunksWithFinalAvailable () {
                // Simply check if the stacker is not empty
                $unhandledChunks = $this->getStackerInstance()->isStackEmpty(self::STACKER_NAME_CHUNKS_WITH_FINAL_EOP) === false;
 
@@ -109,9 +109,9 @@ class ChunkHandler extends BaseHandler implements HandleableChunks, Registerable
         *
         * @return      void
         */
-       public function handleAvailableChunks () {
+       public function handleAvailableChunksWithFinal () {
                // First check if there are undhandled chunks available
-               assert($this->ifUnhandledChunksAvailable());
+               assert($this->ifUnhandledChunksWithFinalAvailable());
 
                // Get an entry from the stacker
                $chunk = $this->getStackerInstance()->popNamed(self::STACKER_NAME_CHUNKS_WITH_FINAL_EOP);
@@ -141,6 +141,12 @@ class ChunkHandler extends BaseHandler implements HandleableChunks, Registerable
                        // Don't process this chunk
                        return;
                } // END - if
+
+               /*
+                * It is now known that (as long as the hash algorithm has no
+                * collisions) the content is the same as the sender sends it to this
+                * peer.
+                */
                die('chunk=' . $chunk . chr(10));
        }
 }
index a254b3d18db7c4575a0d9dcef7a4409c7cf56982..8799f131cef5fe3eddaf1118ba674e1f573aac0a 100644 (file)
@@ -271,6 +271,7 @@ class PackageFragmenter extends BaseFrameworkSystem implements Fragmentable, Reg
         *
         * @param       $rawData        Raw data bytes to hash
         * @return      $hash           Hash from the raw data
+        * @todo        Implement a way to send non-announcement packages with extra-salt
         */
        private function generateHashFromRawData ($rawData) {
                /*
index cc2c5d753444e1a8492f3f3d82fda9ae2cf7fd17..8c040645b34f6482eb2393686c81ba5ceed1a343 100644 (file)
@@ -70,9 +70,9 @@ class HubChunkAssemblerTask extends BaseTask implements Taskable, Visitable {
         */
        public function executeTask () {
                // Are there chunks to handle?
-               if ($this->getHandlerInstance()->ifUnhandledChunksAvailable()) {
+               if ($this->getHandlerInstance()->ifUnhandledChunksWithFinalAvailable()) {
                        // Then handle them (not all!)
-                       $this->getHandlerInstance()->handleAvailableChunks();
+                       $this->getHandlerInstance()->handleAvailableChunksWithFinal();
                } // END - if
        }
 }
index 757301ad125f0702b878089e4c5c8f1d2b4179f9..774faf82ebf4f228d2d816506e33e5c9dc8e83ed 100644 (file)
 ./application/hub/main/package/class_NetworkPackage.php:225:    * @todo        $helperInstance is unused
 ./application/hub/main/package/class_NetworkPackage.php:229:           // @TODO crc32() is very weak, but it needs to be fast
 ./application/hub/main/package/class_NetworkPackage.php:23: * @todo            Needs to add functionality for handling the object's type
-./application/hub/main/package/class_NetworkPackage.php:393:                   // @TODO We may want to do somthing more here?
-./application/hub/main/package/class_NetworkPackage.php:499:                   // @TODO Add some logging here
-./application/hub/main/package/class_NetworkPackage.php:525:                   // @TODO Add some logging here
-./application/hub/main/package/class_NetworkPackage.php:629:                   // @TODO Add some logging here
-./application/hub/main/package/class_NetworkPackage.php:728:           // @TODO Add some content here
-./application/hub/main/package/class_NetworkPackage.php:767:    * @todo        This may be enchanced for outgoing packages?
-./application/hub/main/package/fragmenter/class_PackageFragmenter.php:427:      * @todo        $helperInstance is unused
+./application/hub/main/package/class_NetworkPackage.php:392:                   // @TODO We may want to do somthing more here?
+./application/hub/main/package/class_NetworkPackage.php:498:                   // @TODO Add some logging here
+./application/hub/main/package/class_NetworkPackage.php:524:                   // @TODO Add some logging here
+./application/hub/main/package/class_NetworkPackage.php:628:                   // @TODO Add some logging here
+./application/hub/main/package/class_NetworkPackage.php:727:           // @TODO Add some content here
+./application/hub/main/package/class_NetworkPackage.php:766:    * @todo        This may be enchanced for outgoing packages?
+./application/hub/main/package/fragmenter/class_PackageFragmenter.php:274:      * @todo        Implement a way to send non-announcement packages with extra-salt
+./application/hub/main/package/fragmenter/class_PackageFragmenter.php:431:      * @todo        $helperInstance is unused
 ./application/hub/main/producer/cruncher/keys/class_CruncherKeyProducer.php:106:                       // @TODO Do something with it
 ./application/hub/main/producer/cruncher/keys/class_CruncherKeyProducer.php:62:         * @todo        Find something for init phase of this key producer
 ./application/hub/main/producer/cruncher/keys/class_CruncherKeyProducer.php:72:         * @todo        ~30% done