]> git.mxchange.org Git - core.git/blobdiff - framework/main/classes/index/file_stack/class_FileStackIndex.php
Continued:
[core.git] / framework / main / classes / index / file_stack / class_FileStackIndex.php
index a274dc46e5279738e6cd5b0bc0682f3d1beb3233..0a10498440c538694aac313349475e5b9cd407b0 100644 (file)
@@ -53,12 +53,14 @@ class FileStackIndex extends BaseIndex implements IndexableStack, Registerable {
         */
        public final static function createFileStackIndex (SplFileInfo $fileInfoInstance) {
                // Get a new instance
+               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('FILE-STACK-INDEX: fileInfoInstance=%s - CALLED!', $fileInfoInstance));
                $indexInstance = new FileStackIndex();
 
                // Initialize index
                $indexInstance->initIndex($fileInfoInstance);
 
                // Return the prepared instance
+               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('FILE-STACK-INDEX: indexInstance=%s - EXIT!', $indexInstance->__toString()));
                return $indexInstance;
        }
 
@@ -69,11 +71,9 @@ class FileStackIndex extends BaseIndex implements IndexableStack, Registerable {
         * @param       $data           Hash and gap position to be added to the index
         * @return      void
         */
-       public function addHashToIndex ($groupId, array $data) {
-               // Debug message
-               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('[%s:%d:] groupId=%s,hash=%s,gap=%d,length=%d - CALLED!', __METHOD__, __LINE__, $groupId, $data[BaseFileStack::ARRAY_INDEX_HASH], $data[BaseFileStack::ARRAY_INDEX_GAP_POSITION], $data[BaseFileStack::ARRAY_INDEX_DATA_LENGTH]));
-
+       public function addHashToIndex (string $groupId, array $data) {
                // Raw data been written to the file
+               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('FILE-STACK-INDEX: groupId=%s,hash=%s,gap=%d,length=%d - CALLED!', $groupId, $data[BaseFileStack::ARRAY_INDEX_HASH], $data[BaseFileStack::ARRAY_INDEX_GAP_POSITION], $data[BaseFileStack::ARRAY_INDEX_DATA_LENGTH]));
                $rawData = sprintf('%s%s%s%s%s%s%s',
                        $groupId,
                        self::SEPARATOR_GROUP_HASH,
@@ -85,7 +85,7 @@ class FileStackIndex extends BaseIndex implements IndexableStack, Registerable {
                );
 
                // Debug message
-               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('[%s:%d:] groupId=%s,hash=%s,rawData()=%d', __METHOD__, __LINE__, $groupId, $data[BaseFileStack::ARRAY_INDEX_HASH], strlen($rawData)));
+               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('FILE-STACK-INDEX: groupId=%s,hash=%s,rawData()=%d', $groupId, $data[BaseFileStack::ARRAY_INDEX_HASH], strlen($rawData)));
 
                // Search for next free gap
                $gapPosition = $this->getIteratorInstance()->searchNextGap(strlen($rawData));
@@ -93,14 +93,12 @@ class FileStackIndex extends BaseIndex implements IndexableStack, Registerable {
                // Gap position cannot be smaller than header length + 1
                assert($gapPosition > $this->getIteratorInstance()->getHeaderSize());
 
-               // Debug message
-               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('[%s:%d:] groupId=%s,hash=%s,gapPosition=%s', __METHOD__, __LINE__, $groupId, $data[BaseFileStack::ARRAY_INDEX_HASH], $gapPosition));
-
                // Then write the data at that gap
+               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('FILE-STACK-INDEX: groupId=%s,hash=%s,gapPosition=%s', $groupId, $data[BaseFileStack::ARRAY_INDEX_HASH], $gapPosition));
                $this->getIteratorInstance()->writeData($gapPosition, $rawData);
 
-               // Debug message
-               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('[%s:%d:] groupId=%s,hash=%s,rawData()=%d - EXIT!', __METHOD__, __LINE__, $groupId, $data[BaseFileStack::ARRAY_INDEX_HASH], strlen($rawData)));
+               // Trace message
+               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('FILE-STACK-INDEX: groupId=%s,hash=%s,rawData()=%d - EXIT!', $groupId, $data[BaseFileStack::ARRAY_INDEX_HASH], strlen($rawData)));
        }
 
        /**
@@ -110,7 +108,7 @@ class FileStackIndex extends BaseIndex implements IndexableStack, Registerable {
         * @param       $length                 Length of raw data
         * @return      $seekPosition   Found next gap's seek position
         */
-       public function searchNextGap ($length) {
+       public function searchNextGap (int $length) {
                $this->partialStub('length=' . $length);
        }