die('Node mode ' . $nodeMode . ' is invalid.' . "\n");
}
+ // ----------------------- Output teaser lines ------------------------
+ // Output some introducing lines to the console. This should be later
+ // be switched off if this is a productive release because it would be
+ // only visible to the logfile.
+ $nodeInstance->outputConsoleTeaser();
+
// ----------------------- Bootstrapping phase ------------------------
// Try to bootstrap the node and pass the request instance to it for
// extra arguments which mostly override config entries or enable special
// Set the request instance
$nodeInstance->setRequestInstance($requestInstance);
- // --------------------- Hub-id acquirement phase ---------------------
- // Acquire a hub-id. This step generates on first launch a new one and
- // on any later launches it will restore the hub-id from the database.
- // A passed 'nickname=xxx' argument will be used to add some
- // 'personality' to the hub.
- $nodeInstance->acquireHubId();
-
// Return the instance
return $nodeInstance;
}
* @todo add some more special bootstrap things for this boot node
*/
public function doBootstrapping () {
+ // Output message
+ $this->getDebugInstance()->output('BOOTSTRAP: Beginning with bootstrap...');
+
// Call generic (parent) bootstrapping method first
parent::doGenericBootstrapping();
// This might not be all...
$this->partialStub('Please implement more bootsrapping steps.');
+
+ // Output message
+ $this->getDebugInstance()->output('BOOTSTRAP: Bootstrap finished.');
}
/**
*
* @return void
*/
- protected function outputConsoleTeaser () {
+ public function outputConsoleTeaser () {
// Get the app instance (for shortening our code)
$app = $this->getApplicationInstance();
* @todo This method is maybe not yet finished.
*/
protected function doGenericBootstrapping () {
- // This should be the last line: output teaser
- $this->outputConsoleTeaser();
+ // --------------------- Hub-id acquirement phase ---------------------
+ // Acquire a hub-id. This step generates on first launch a new one and
+ // on any later launches it will restore the hub-id from the database.
+ // A passed 'nickname=xxx' argument will be used to add some
+ // 'personality' to the hub.
+ $this->bootstrapAcquireHubId();
+
+ // ------------------- More generic bootstrap steps -------------------
+ // Generate the session id which will only be stored in RAM
+ $this->bootstrapGenerateSessionId();
+
+ // Restore a previously downloaded bootstrap-node list
+ $this->bootstrapRestoreNodeList();
+
+ // Download or update the bootstrap-node list
+ $this->bootstrapDownloadNodeList();
// @TODO Add some generic bootstrap steps
$this->partialStub('Add some generic bootstrap steps here.');
*
* @return void
*/
- protected function acquireHubId () {
+ private function bootstrapAcquireHubId () {
// Get a wrapper instance
$wrapperInstance = ObjectFactory::createObjectByConfiguredName('node_info_db_wrapper_class');
$this->setNodeId($this->getField(NodeInformationDatabaseWrapper::DB_COLUMN_NODE_ID));
// Output message
- $this->getDebugInstance()->output('Re-using found node-id: ' . $this->getNodeId() . '');
+ $this->getDebugInstance()->output('BOOTSTRAP: Re-using found node-id: ' . $this->getNodeId() . '');
} else {
// Get an RNG instance (Random Number Generator)
$rngInstance = ObjectFactory::createObjectByConfiguredName('rng_class');
$wrapperInstance->registerNodeId($this, $this->getRequestInstance());
// Output message
- $this->getDebugInstance()->output('Created new node-id: ' . $this->getNodeId() . '');
+ $this->getDebugInstance()->output('BOOTSTRAP: Created new node-id: ' . $this->getNodeId() . '');
}
}
// Set the request instance
$nodeInstance->setRequestInstance($requestInstance);
- // --------------------- Hub-id acquirement phase ---------------------
- // Acquire a hub-id. This step generates on first launch a new one and
- // on any later launches it will restore the hub-id from the database.
- // A passed 'nickname=xxx' argument will be used to add some
- // 'personality' to the hub.
- $nodeInstance->acquireHubId();
-
// Return the instance
return $nodeInstance;
}
* @todo Implement this method
*/
public function doBootstrapping () {
+ // Output message
+ $this->getDebugInstance()->output('BOOTSTRAP: Beginning with bootstrap...');
+
// Call generic (parent) bootstrapping method first
parent::doGenericBootstrapping();
$this->partialStub('Please implement this method.');
+
+ // Output message
+ $this->getDebugInstance()->output('BOOTSTRAP: Bootstrap finished.');
}
/**
// Set the request instance
$nodeInstance->setRequestInstance($requestInstance);
- // --------------------- Hub-id acquirement phase ---------------------
- // Acquire a hub-id. This step generates on first launch a new one and
- // on any later launches it will restore the hub-id from the database.
- // A passed 'nickname=xxx' argument will be used to add some
- // 'personality' to the hub.
- $nodeInstance->acquireHubId();
-
// Return the instance
return $nodeInstance;
}
* @todo Implement this method
*/
public function doBootstrapping () {
+ // Output message
+ $this->getDebugInstance()->output('BOOTSTRAP: Beginning with bootstrap...');
+
// Call generic (parent) bootstrapping method first
parent::doGenericBootstrapping();
$this->partialStub('Please implement this method.');
+
+ // Output message
+ $this->getDebugInstance()->output('BOOTSTRAP: Bootstrap finished.');
}
/**
// Set the request instance
$nodeInstance->setRequestInstance($requestInstance);
- // --------------------- Hub-id acquirement phase ---------------------
- // Acquire a hub-id. This step generates on first launch a new one and
- // on any later launches it will restore the hub-id from the database.
- // A passed 'nickname=xxx' argument will be used to add some
- // 'personality' to the hub.
- $nodeInstance->acquireHubId();
-
// Return the instance
return $nodeInstance;
}
* command-line arguments stored in the request instance. The regular node
* should communicate with the bootstrap-nodes at this point.
*
- * @param $requestInstance A Requestable instance
* @return void
* @todo Implement this method
*/
public function doBootstrapping () {
+ // Output message
+ $this->getDebugInstance()->output('BOOTSTRAP: Beginning with bootstrap...');
+
// Call generic (parent) bootstrapping method first
parent::doGenericBootstrapping();
$this->partialStub('Please implement this method.');
+
+ // Output message
+ $this->getDebugInstance()->output('BOOTSTRAP: Bootstrap finished.');
}
/**