* @return $isInitialized Whether the file header is initialized
*/
protected function isFileHeaderInitialized () {
+ //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput(sprintf('[%s:%d:] CALLED!', __METHOD__, __LINE__));
+
// Is the method there?
assert(is_callable(array($this, 'readFileHeader')));
- //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput(sprintf('[%s:%d:] CALLED!', __METHOD__, __LINE__));
// Default is not initialized
$isInitialized = FALSE;
protected function preAllocateFile ($type) {
//* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput(sprintf('[%s:%d:] CALLED!', __METHOD__, __LINE__));
+ // caluclateMinimumFileEntryLength() must be callable
+ assert(is_callable(array($this, 'caluclateMinimumFileEntryLength')));
+
// Is it enabled?
if ($this->getConfigInstance()->getConfigEntry($type . '_pre_allocate_enabled') != 'Y') {
// Not enabled
// Message to user
self::createDebugInstance(__CLASS__)->debugOutput(sprintf('[%s:%d:] Pre-allocating file ...', __METHOD__, __LINE__));
- /*
- * Calculate minimum length for one entry:
- * minimum length = hash length + separator + name + minimum entry size = ?? + 1 + 10 + 1 = ??
- */
- $minLengthEntry = self::getHashLength() + strlen(self::SEPARATOR_HASH_NAME) + self::LENGTH_NAME + 1;
+ // Calculate minimum length for one entry
+ $minLengthEntry = $this->caluclateMinimumFileEntryLength();
//* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput(sprintf('[%s:%d:] minLengthEntry=%s', __METHOD__, __LINE__, $minLengthEntry));
// Calulcate seek position
//* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput(sprintf('[%s:%d:] EXIT!', __METHOD__, __LINE__));
}
+ /**
+ * Calculates minimum length for one entry
+ *
+ * @return $length Minimum length for one entry
+ */
+ protected function caluclateMinimumFileEntryLength () {
+ // Calulcate it
+ // @TODO Not finished yet
+ $length = 0;
+
+ // Return it
+ return $length;
+ }
+
/**
* Initializes this index
*
$this->setIndexInstance($indexInstance);
}
+ /**
+ * Calculates minimum length for one entry
+ *
+ * @return $length Minimum length for one entry
+ */
+ protected function caluclateMinimumFileEntryLength () {
+ // Calulcate it
+ $length = self::getHashLength() + strlen(self::SEPARATOR_HASH_NAME) + self::LENGTH_NAME + 1;
+
+ // Return it
+ return $length;
+ }
+
/**
* Adds a value to given stack
*