/**
* Do the helped attempt by delivering a package to ourselfs
*
+ * @param $nodeInstance An instance of a NodeHelper class
* @return void
*/
- function sendPackage ();
+ function sendPackage (NodeHelper $nodeInstance);
}
// [EOF]
* "Enqueues" raw content into this delivery class by reading the raw content
* from given template instance and pushing it on the 'undeclared' stack.
*
- * @param $helperInstance A BaseHubHelper instance
+ * @param $helperInstance An instance of a BaseHubHelper class
+ * @param $nodeInstance An instance of a NodeHelper class
* @return void
*/
- function enqueueRawDataFromTemplate (BaseHubHelper $helperInstance);
+ function enqueueRawDataFromTemplate (BaseHubHelper $helperInstance, NodeHelper $nodeInstance);
/**
* Checks wether a package has been enqueued for delivery.
/**
* Creates the helper class
*
- * @param $nodeInstance An instance of a NodeHelper class
* @return $helperInstance A prepared instance of this helper
*/
- public static final function createHubDescriptorHelper (NodeHelper $nodeInstance) {
+ public static final function createHubDescriptorHelper () {
// Get new instance
$helperInstance = new HubDescriptorHelper();
- // Set the node instance
- $helperInstance->setNodeInstance($nodeInstance);
-
// Return the prepared instance
return $helperInstance;
}
* the code. After this wents fine, the rendered content got "packaged"
* for network delivery.
*
+ * @param $nodeInstance An instance of a NodeHelper class
* @return void
*/
- public function sendPackage () {
+ public function sendPackage (NodeHelper $nodeInstance) {
// Sanity check: Is the node in the approx. state? (active)
- $this->getNodeInstance()->getStateInstance()->validateNodeStateIsActive();
+ $nodeInstance->getStateInstance()->validateNodeStateIsActive();
// Compile the template, this inserts the loaded node data into the gaps.
$this->getTemplateInstance()->compileTemplate();
$packageInstance = NetworkPackageFactory::createNetworkPackageInstance();
// Next, feed the content in. The network package class is a pipe-through class.
- $packageInstance->enqueueRawDataFromTemplate($this);
+ $packageInstance->enqueueRawDataFromTemplate($this, $nodeInstance);
}
/**
/**
* Do the helped attempt by delivering a package to ourselfs
*
+ * @param $nodeInstance An instance of a NodeHelper class
* @return void
*/
- public function sendPackage () {
+ public function sendPackage (NodeHelper $nodeInstance) {
// Sanity check: Is the node in the approx. state? (active)
- $this->getNodeInstance()->getStateInstance()->validateNodeStateIsActive();
+ $nodeInstance->getStateInstance()->validateNodeStateIsActive();
// Compile the template, this inserts the loaded node data into the gaps.
$this->getTemplateInstance()->compileTemplate();
/**
* Creates the helper class
*
- * @param $nodeInstance An instance of a NodeHelper class
* @return $helperInstance A prepared instance of this helper
*/
- public static final function createHubSelfConnectHelper (NodeHelper $nodeInstance) {
+ public static final function createHubSelfConnectHelper () {
// Get new instance
$helperInstance = new HubSelfConnectHelper();
- // Set the node instance
- $helperInstance->setNodeInstance($nodeInstance);
-
// Return the prepared instance
return $helperInstance;
}
/**
* Do the self-connect attempt by delivering a package to ourselfs
*
+ * @param $nodeInstance An instance of a NodeHelper class
* @return void
*/
- public function sendPackage () {
+ public function sendPackage (NodeHelper $nodeInstance) {
// Sanity check: Is the node in the approx. state? (active)
- $this->getNodeInstance()->getStateInstance()->validateNodeStateIsActive();
+ $nodeInstance->getStateInstance()->validateNodeStateIsActive();
// Compile the template, this inserts the loaded node data into the gaps.
$this->getTemplateInstance()->compileTemplate();
$packageInstance = NetworkPackageFactory::createNetworkPackageInstance();
// Next, feed the content in. The network package class is a pipe-through class.
- $packageInstance->enqueueRawDataFromTemplate($this);
+ $packageInstance->enqueueRawDataFromTemplate($this, $nodeInstance);
}
/**
$helperInstance->getTemplateInstance()->compileConfigInVariables();
// "Publish" the descriptor by sending it to the bootstrap/list nodes
- $helperInstance->sendPackage();
+ $helperInstance->sendPackage($this);
// Change the state, this should be the last line except debug output
$this->getStateInstance()->nodeAnnouncedToUpperHubs();
$helperInstance->loadDescriptorXml();
// And send the package away
- $helperInstance->sendPackage();
+ $helperInstance->sendPackage($this);
// Debug output
$this->debugOutput('HUB: Self Connection: FINISHED');
* "Getter" for hash from given content and helper instance
*
* @param $content Raw package content
- * @param $helperInstance A BaseHubHelper instance
+ * @param $helperInstance An instance of a BaseHubHelper class
+ * @param $nodeInstance An instance of a NodeHelper class
* @return $hash Hash for given package content
*/
- private function getHashFromContent ($content, BaseHubHelper $helperInstance) {
+ private function getHashFromContent ($content, BaseHubHelper $helperInstance, NodeHelper $nodeInstance) {
// Create the hash
// @TODO crc32 is not good, but it needs to be fast
$hash = crc32(
$content .
':' .
- $helperInstance->getNodeInstance()->getSessionId() .
+ $nodeInstance->getSessionId() .
':' .
$this->getCompressorInstance()->getCompressorExtension()
);
* "Enqueues" raw content into this delivery class by reading the raw content
* from given template instance and pushing it on the 'undeclared' stack.
*
- * @param $helperInstance A BaseHubHelper instance
+ * @param $helperInstance An instance of a BaseHubHelper class
+ * @param $nodeInstance An instance of a NodeHelper class
* @return void
*/
- public function enqueueRawDataFromTemplate (BaseHubHelper $helperInstance) {
+ public function enqueueRawDataFromTemplate (BaseHubHelper $helperInstance, NodeHelper $nodeInstance) {
// Get the raw content ...
$content = $helperInstance->getTemplateInstance()->getRawTemplateData();
// 3.) Tags
implode(self::PACKAGE_TAGS_SEPERATOR, $helperInstance->getPackageTags()),
// 4.) Checksum
- $this->getHashFromContent($content, $helperInstance)
+ $this->getHashFromContent($content, $helperInstance, $nodeInstance)
);
// Now prepare the temporary array and push it on the 'undeclared' stack
$this->getStackerInstance()->pushNamed(self::STACKER_NAME_UNDECLARED, array(
- 'sender' => $helperInstance->getNodeInstance()->getSessionId(),
+ 'sender' => $nodeInstance->getSessionId(),
'recipient' => $helperInstance->getRecipientType(),
'content' => $content,
));
} // END - if
} else {
// Server sockets won't work with socket_getpeername()
- $this->debugOutput('POOL: Socket resource is server socket. This is no bug.');
+ $this->debugOutput('POOL: Socket resource is server socket. This is not a bug.');
}
// Output error message
// Is this cruncher virgin?
if (!$stateInstance->isCruncherStateVirgin()) {
// This cruncher is not virgin, so skip it
- $this->debugOutput('ITERATOR: The cruncher is not virgin. stateInstance=' . $stateInstance->__toString() . '.');
+ $this->debugOutput('PRODUCER: The cruncher is not virgin. stateInstance=' . $stateInstance->__toString() . '');
return;
} elseif (!$this->getIteratorInstance()->valid()) {
- // This iterator has finished his assignment
- $this->debugOutput('ITERATOR: Finished creating keys. iteratorinstance=' . $this->getIteratorInstance()->__toString() . '');
+ // This producer's iterator has finished its assignment
+ $this->debugOutput('PRODUCER: Finished creating keys. iteratorinstance=' . $this->getIteratorInstance()->__toString() . '');
return;
}
*/
/*
- * Get current key (which is not the key of the iterator)
- * This is always an ASCII string.
+ * Get current key (which is not the key of the iterator) This is always
+ * an ASCII string.
*/
$currentKey = $this->getIteratorInstance()->current();