/* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-FILE-STACK: Calling this->iteratorInstance->initCountersGapsArray() ...');
$this->getIteratorInstance()->initCountersGapsArray();
+ /*
+ * Get stack index instance. This can be used for faster
+ * "defragmentation" and startup.
+ */
+ /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-FILE-STACK: Creating index instance for fileInfoInstance[%s]=%s,type=%s ...', get_class($fileInfoInstance), $fileInfoInstance, $type));
+ $indexInstance = FileStackIndexFactory::createFileStackIndexInstance($fileInfoInstance, $type);
+
+ // And set it here
+ /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-FILE-STACK: indexInstance=%s', $indexInstance->__toString()));
+ $this->setIndexInstance($indexInstance);
+
// Is the file's header initialized?
if (!$this->getIteratorInstance()->isFileHeaderInitialized()) {
// First pre-allocate a bit
/* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-FILE-STACK: Calling this->readStackHeader() ...');
$this->readStackHeader();
- /*
- * Get stack index instance. This can be used for faster
- * "defragmentation" and startup.
- */
- /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-FILE-STACK: Creating index instance for fileInfoInstance[%s]=%s,type=%s ...', get_class($fileInfoInstance), $fileInfoInstance, $type));
- $indexInstance = FileStackIndexFactory::createFileStackIndexInstance($fileInfoInstance, $type);
-
- // And set it here
- /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-FILE-STACK: indexInstance=%s', $indexInstance->__toString()));
- $this->setIndexInstance($indexInstance);
-
// Is the index loaded correctly and the stack file is just created?
/* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-FILE-STACK: Calling this->indexInstance->isIndexLoaded() ...');
if (!$this->getIndexInstance()->isIndexLoaded()) {
// Return gap position, hash and length of raw data
/* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-FILE-STACK: stackName=%s,hash=%s,rawData()=%d - EXIT!', $stackName, $hash, strlen($rawData)));
return [
- self::ARRAY_NAME_GAP_POSITION => $gapPosition,
- self::ARRAY_NAME_HASH => $hash,
- self::ARRAY_NAME_DATA_LENGTH => strlen($rawData),
+ StackableFile::ARRAY_NAME_GAP_POSITION => $gapPosition,
+ StackableFile::ARRAY_NAME_HASH => $hash,
+ StackableFile::ARRAY_NAME_DATA_LENGTH => strlen($rawData),
];
}