$cfg->setConfigEntry('cruncher_buffer_stacker_class', 'FiFoStacker');
// CFG: HUB-CONSOLE-CMD-CRUNCHER-RESOLVER-CLASS
-$cfg->setConfigEntry('hubconsole_cmd_cruncher_resolver_class', 'HubConsoleCommandResolver');
+$cfg->setConfigEntry('hub_console_cmd_cruncher_resolver_class', 'HubConsoleCommandResolver');
// CFG: CRUNCHER-PHP-REQUIREMENTS-FILTER
$cfg->setConfigEntry('cruncher_php_requirements_filter', 'CruncherPhpRequirementsFilter');
$cfg->setConfigEntry('work_unit_producer_key_iterator_class', 'WorkUnitKeyProducerIterator');
// CFG: TEST-UNIT-RANDOM-SECRET-KEY-LENGTH
-$cfg->setConfigEntry('test_unit_random_secret_key_length', 8*4);
+$cfg->setConfigEntry('test_unit_random_secret_key_length', 8 * 32);
// CFG: TEST-UNIT-SOURCE-CLASS
$cfg->setConfigEntry('test_unit_source_class', 'TestUnitSource');
///////////////////////////////////////////////////////////////////////////////
// CFG: HUB-CONSOLE-CMD-CHAT-RESOLVER-CLASS
-$cfg->setConfigEntry('hubconsole_cmd_chat_resolver_class', 'HubConsoleCommandResolver');
+$cfg->setConfigEntry('hub_console_cmd_chat_resolver_class', 'HubConsoleCommandResolver');
// CFG: CHAT-PHP-REQUIREMENTS-FILTER
$cfg->setConfigEntry('chat_php_requirements_filter', 'ChatPhpRequirementsFilter');
*/
private $communicatorInstance = NULL;
- /**
- * An instance of a cruncher
- */
- private $cruncherInstance = NULL;
-
- /**
- * An instance of a miner
- */
- private $minerInstance = NULL;
-
/**
* A network package handler instance
*/
$this->communicatorInstance = $communicatorInstance;
}
- /**
- * Getter for cruncher instance
- *
- * @return $cruncherInstance An instance of a cruncher cruncher
- */
- public final function getCruncherInstance () {
- return $this->cruncherInstance;
- }
-
- /**
- * Setter for cruncher instance
- *
- * @param $cruncherInstance An instance of a cruncher cruncher
- * @return void
- */
- protected final function setCruncherInstance (CruncherHelper $cruncherInstance) {
- $this->cruncherInstance = $cruncherInstance;
- }
-
- /**
- * Getter for miner instance
- *
- * @return $minerInstance An instance of a miner miner
- */
- public final function getMinerInstance () {
- return $this->minerInstance;
- }
-
- /**
- * Setter for miner instance
- *
- * @param $minerInstance An instance of a miner miner
- * @return void
- */
- protected final function setMinerInstance (MinerHelper $minerInstance) {
- $this->minerInstance = $minerInstance;
- }
-
/**
* Setter for network package handler instance
*
// Call parent constructor
parent::__construct($className);
+ // Set this cruncher instance in registry
+ Registry::getRegistry()->addInstance('cruncher', $this);
+
// Init this cruncher
$this->initCruncher();
}
*/
private function initCruncher () {
// Init the state
- CruncherStateFactory::createCruncherStateInstanceByName('init', $this);
+ CruncherStateFactory::createCruncherStateInstanceByName('init');
}
/**
* @param $cruncherInstance A CruncherHelper class instance
* @return $stateInstance A Stateable class instance
*/
- public static final function createCruncherStateInstanceByName ($stateName, CruncherHelper $cruncherInstance) {
+ public static final function createCruncherStateInstanceByName ($stateName) {
// Then construct the class' configuraton entry
$className = 'cruncher_' . $stateName . '_state_class';
+ // Get cruncher instance from registry
+ $cruncherInstance = Registry::getRegistry()->getInstance('cruncher');
+
// Get a class from that configuration entry
- $stateInstance = self::createObjectByConfiguredName($className, array($cruncherInstance));
+ $stateInstance = self::createObjectByConfiguredName($className);
// Debug message
self::createDebugInstance(__CLASS__)->debugOutput('CRUNCHER-STATE-FACTORY[' . __METHOD__ . ':' . __LINE__ . ']: Cruncher state has changed from ' . $cruncherInstance->getPrintableState() . ' to ' . $stateInstance->getStateName() . '.');
// @TODO Can we rewrite this to app_exit() ?
$this->debugBackTrace('[' . __METHOD__ . ':' . __LINE__ . ']: cruncher mode ' . $cruncherMode . ' is invalid.');
}
-
- // Set the cruncher instance in registry
- Registry::getRegistry()->addInstance('cruncher', $cruncherInstance);
}
}
*/
private function initMiner () {
// Init the state
- MinerStateFactory::createMinerStateInstanceByName('init', $this);
+ MinerStateFactory::createMinerStateInstanceByName('init');
}
/**
*/
private function initState() {
// Get the state factory and create the initial state.
- NodeStateFactory::createNodeStateInstanceByName('init', $this);
+ NodeStateFactory::createNodeStateInstanceByName('init');
}
/**
protected function initProducer () {
}
+ /**
+ * Initializes the executor, whatever it does.
+ *
+ * @return void
+ * @todo 0% done
+ */
+ public function initExecutor (Stateable $stateInstance) {
+ $this->partialStub('Maybe implement this method?');
+ }
+
/**
* Produces some keys and pushes them onto the queue
*
$stateInstance->encryptedMessageGenerated();
}
}
+
+ /**
+ * Initializes the executor, whatever it does.
+ *
+ * @return void
+ * @todo Maybe unfinished
+ */
+ public function initExecutor (Stateable $stateInstance) {
+ $this->partialStub('Maybe implement this method?');
+ }
}
// [EOF]
/**
* Creates an instance of this class
*
- * @param $cruncherInstance An instance of a CruncherHelper class
* @return $stateInstance An instance of a Stateable class
*/
- public final static function createCruncherInitState (CruncherHelper $cruncherInstance) {
+ public final static function createCruncherInitState () {
// Get new instance
$stateInstance = new CruncherInitState();
- // Set the cruncher instance
- $stateInstance->setCruncherInstance($cruncherInstance);
-
// Return the prepared instance
return $stateInstance;
}
*/
public function encryptedMessageGenerated () {
// Change the state now to 'virgin'
- CruncherStateFactory::createCruncherStateInstanceByName('virgin', $this->getCruncherInstance());
+ CruncherStateFactory::createCruncherStateInstanceByName('virgin');
}
}
/**
* Creates an instance of this class
*
- * @param $cruncherInstance An instance of a CruncherHelper class
* @return $stateInstance An instance of a Stateable class
*/
- public final static function createCruncherVirginState (CruncherHelper $cruncherInstance) {
+ public final static function createCruncherVirginState () {
// Get new instance
$stateInstance = new CruncherVirginState();
- // Set the cruncher instance
- $stateInstance->setCruncherInstance($cruncherInstance);
-
// Return the prepared instance
return $stateInstance;
}
/**
* Creates an instance of this class
*
- * @param $minerInstance An instance of a MinerHelper class
* @return $stateInstance An instance of a Stateable class
*/
- public final static function createMinerBootingState (MinerHelper $minerInstance) {
+ public final static function createMinerBootingState () {
// Get new instance
$stateInstance = new MinerBootingState();
// Debug message
//* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('MINER-STATE: Has changed from ' . $minerInstance->getPrintableState() . ' to ' . $stateInstance->getStateName() . '.');
- // Set the miner instance
- $stateInstance->setMinerInstance($minerInstance);
-
// Return the prepared instance
return $stateInstance;
}
/**
* Creates an instance of this class
*
- * @param $minerInstance An instance of a MinerHelper class
* @return $stateInstance An instance of a Stateable class
*/
- public final static function createMinerInitState (MinerHelper $minerInstance) {
+ public final static function createMinerInitState () {
// Get new instance
$stateInstance = new MinerInitState();
- // Set the miner instance
- $stateInstance->setMinerInstance($minerInstance);
-
// Return the prepared instance
return $stateInstance;
}
*/
public function encryptedMessageGenerated () {
// Change the state now to 'virgin'
- MinerStateFactory::createMinerStateInstanceByName('virgin', $this->getMinerInstance());
+ MinerStateFactory::createMinerStateInstanceByName('virgin');
}
}
/**
* Creates an instance of this class
*
- * @param $minerInstance An instance of a MinerHelper class
* @return $stateInstance An instance of a Stateable class
*/
- public final static function createMinerVirginState (MinerHelper $minerInstance) {
+ public final static function createMinerVirginState () {
// Get new instance
$stateInstance = new MinerVirginState();
- // Set the miner instance
- $stateInstance->setMinerInstance($minerInstance);
-
// Return the prepared instance
return $stateInstance;
}
-Subproject commit 17594a08ba68250b4693631ad6fab0f76c885d56
+Subproject commit e20cc950eac0ee7e24ad3ac67f5479b7f482bd8e