From 0072999fbd0ea82ee7d4a2e2934ab2f8cf67efc8 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Fri, 6 Nov 2020 00:03:47 +0100 Subject: [PATCH] Continued: - introduced abstract classes BaseCruncherProducer and BaseMinerProducer as the cruncher won't have a miner registry key ready. - added missing namespaces - imported missing classes/interfaces MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Roland Häder --- application/hub/class_ApplicationHelper.php | 1 - ...lass_NetworkPackageCompressorDecorator.php | 2 +- .../cruncher/class_BaseHubCruncher.php | 1 + .../cruncher/{mcrypt => openssl}/.htaccess | 0 .../class_HubOpenSslCruncher.php} | 20 ++++--- .../class_CruncherUnitDatabaseWrapper.php | 2 + .../class_BaseRecipientDiscovery.php | 2 +- .../source/units/class_UnitSourceFactory.php | 2 +- .../cruncher/class_CruncherStateFactory.php | 3 +- ...rBootstrapBufferQueueInitializerFilter.php | 3 + ...ncherBootstrapExtraBootstrappingFilter.php | 3 + ...uncherBootstrapGenericActivationFilter.php | 3 + .../class_CruncherInitializationFilter.php | 7 ++- .../class_CruncherPhpRequirementsFilter.php | 3 + .../class_CruncherWelcomeTeaserFilter.php | 3 + .../cruncher/class_CruncherShutdownFilter.php | 3 + ...s_CruncherTaskHandlerInitializerFilter.php | 3 + .../class_BaseAnswerStatusHandler.php | 2 +- .../class_CryptoRandomUnitMessageHelper.php | 9 ++- .../cruncher/class_CruncherTestUnitHelper.php | 7 +++ .../class_TestUnitKeyProducerIterator.php | 2 +- .../miner/chash/class_HubCoinMiner.php | 2 +- .../classes/producer/class_BaseProducer.php | 6 -- .../cruncher/class_BaseCruncherProducer.php | 51 +++++++++++++++++ .../{ => keys}/class_BaseKeyProducer.php | 6 +- .../producer/cruncher/keys/cruncher/.htaccess | 1 + .../class_CruncherKeyProducer.php | 2 + .../class_BaseUnitProducer.php | 6 +- .../cruncher/work_units/cruncher/.htaccess | 1 + .../class_CruncherTestUnitProducer.php | 5 +- .../{ => blocks}/class_BaseBlockProducer.php | 5 +- .../producer/miner/blocks/miner/.htaccess | 1 + .../class_MinerRealGenesisBlockProducer.php | 2 +- .../class_MinerTestGenesisBlockProducer.php | 2 +- .../miner/class_BaseMinerProducer.php | 48 ++++++++++++++++ .../cruncher/init/class_CruncherInitState.php | 6 +- .../virgin/class_CruncherVirginState.php | 5 +- application/hub/config.php | 57 ++++++++++--------- .../producer/keys/class_KeyProducer.php | 3 + .../work_units/class_UnitProducer.php | 3 + 40 files changed, 223 insertions(+), 70 deletions(-) rename application/hub/classes/cruncher/{mcrypt => openssl}/.htaccess (100%) rename application/hub/classes/cruncher/{mcrypt/class_HubMcryptCruncher.php => openssl/class_HubOpenSslCruncher.php} (90%) create mode 100644 application/hub/classes/producer/cruncher/class_BaseCruncherProducer.php rename application/hub/classes/producer/cruncher/{ => keys}/class_BaseKeyProducer.php (87%) create mode 100644 application/hub/classes/producer/cruncher/keys/cruncher/.htaccess rename application/hub/classes/producer/cruncher/keys/{ => cruncher}/class_CruncherKeyProducer.php (97%) rename application/hub/classes/producer/cruncher/{ => work_units}/class_BaseUnitProducer.php (90%) create mode 100644 application/hub/classes/producer/cruncher/work_units/cruncher/.htaccess rename application/hub/classes/producer/cruncher/work_units/{ => cruncher}/class_CruncherTestUnitProducer.php (96%) rename application/hub/classes/producer/miner/{ => blocks}/class_BaseBlockProducer.php (89%) create mode 100644 application/hub/classes/producer/miner/blocks/miner/.htaccess rename application/hub/classes/producer/miner/blocks/{ => miner}/class_MinerRealGenesisBlockProducer.php (97%) rename application/hub/classes/producer/miner/blocks/{ => miner}/class_MinerTestGenesisBlockProducer.php (98%) create mode 100644 application/hub/classes/producer/miner/class_BaseMinerProducer.php diff --git a/application/hub/class_ApplicationHelper.php b/application/hub/class_ApplicationHelper.php index 11a15027d..df604326b 100644 --- a/application/hub/class_ApplicationHelper.php +++ b/application/hub/class_ApplicationHelper.php @@ -11,7 +11,6 @@ use Org\Mxchange\CoreFramework\Bootstrap\FrameworkBootstrap; use Org\Mxchange\CoreFramework\Factory\ObjectFactory; use Org\Mxchange\CoreFramework\Loader\ClassLoader; use Org\Mxchange\CoreFramework\Manager\ManageableApplication; -use Org\Mxchange\CoreFramework\Registry\GenericRegistry; use Org\Mxchange\CoreFramework\Registry\Registerable; use Org\Mxchange\CoreFramework\Template\CompileableTemplate; diff --git a/application/hub/classes/compressor/decorator/class_NetworkPackageCompressorDecorator.php b/application/hub/classes/compressor/decorator/class_NetworkPackageCompressorDecorator.php index 56c4e946b..d2a5ac585 100644 --- a/application/hub/classes/compressor/decorator/class_NetworkPackageCompressorDecorator.php +++ b/application/hub/classes/compressor/decorator/class_NetworkPackageCompressorDecorator.php @@ -5,7 +5,7 @@ namespace Org\Shipsimu\Hub\Network\Compressor\Package; // Import application-specific stuff use Org\Shipsimu\Hub\Generic\BaseHubSystem; -// Import framework-specific stuff +// Import framework stuff use Org\Mxchange\CoreFramework\Compressor\Compressor; /** diff --git a/application/hub/classes/cruncher/class_BaseHubCruncher.php b/application/hub/classes/cruncher/class_BaseHubCruncher.php index 5e6c50ef4..15771d133 100644 --- a/application/hub/classes/cruncher/class_BaseHubCruncher.php +++ b/application/hub/classes/cruncher/class_BaseHubCruncher.php @@ -3,6 +3,7 @@ namespace Org\Shipsimu\Hub\Cruncher; // Import application-specific stuff +use Org\Shipsimu\Hub\Factory\State\Cruncher\CruncherStateFactory; use Org\Shipsimu\Hub\Generic\BaseHubSystem; // Import framework stuff diff --git a/application/hub/classes/cruncher/mcrypt/.htaccess b/application/hub/classes/cruncher/openssl/.htaccess similarity index 100% rename from application/hub/classes/cruncher/mcrypt/.htaccess rename to application/hub/classes/cruncher/openssl/.htaccess diff --git a/application/hub/classes/cruncher/mcrypt/class_HubMcryptCruncher.php b/application/hub/classes/cruncher/openssl/class_HubOpenSslCruncher.php similarity index 90% rename from application/hub/classes/cruncher/mcrypt/class_HubMcryptCruncher.php rename to application/hub/classes/cruncher/openssl/class_HubOpenSslCruncher.php index 4ceaabda8..455ee4e1b 100644 --- a/application/hub/classes/cruncher/mcrypt/class_HubMcryptCruncher.php +++ b/application/hub/classes/cruncher/openssl/class_HubOpenSslCruncher.php @@ -1,6 +1,10 @@ * @version 0.0.0 @@ -30,7 +34,7 @@ use Org\Mxchange\CoreFramework\Response\Responseable; * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -class HubMcryptCruncher extends BaseHubCruncher implements CruncherHelper, Registerable { +class HubOpenSslCruncher extends BaseHubCruncher implements CruncherHelper, Registerable { /** * Protected constructor * @@ -49,9 +53,9 @@ class HubMcryptCruncher extends BaseHubCruncher implements CruncherHelper, Regis * * @return $cruncherInstance An instance of this hub-cruncher class */ - public final static function createHubMcryptCruncher () { + public final static function createHubOpenSslCruncher () { // Get a new instance - $cruncherInstance = new HubMcryptCruncher(); + $cruncherInstance = new HubOpenSslCruncher(); // Return the instance return $cruncherInstance; @@ -129,7 +133,7 @@ class HubMcryptCruncher extends BaseHubCruncher implements CruncherHelper, Regis public function outputConsoleTeaser () { // Output all lines self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(' '); - self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('MCrypt Cruncher v' . $this->getVersion() . ' is starting ...'); + self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('OpenSSL Cruncher v' . $this->getVersion() . ' is starting ...'); self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('Copyright (c) 2011 - 2014 - 2018 Hub Developer Team'); self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(' '); self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('This program comes with ABSOLUTELY NO WARRANTY; for details see docs/COPYING.'); @@ -150,7 +154,5 @@ class HubMcryptCruncher extends BaseHubCruncher implements CruncherHelper, Regis // Add some filters here $this->partialStub('Please add some cruncher-specific filters, if required.'); } -} -// [EOF] -?> +} diff --git a/application/hub/classes/database/frontend/cruncher/class_CruncherUnitDatabaseWrapper.php b/application/hub/classes/database/frontend/cruncher/class_CruncherUnitDatabaseWrapper.php index 850d7ea78..fcffd06fe 100644 --- a/application/hub/classes/database/frontend/cruncher/class_CruncherUnitDatabaseWrapper.php +++ b/application/hub/classes/database/frontend/cruncher/class_CruncherUnitDatabaseWrapper.php @@ -4,6 +4,8 @@ namespace Org\Shipsimu\Hub\Database\Frontend\Cruncher\Unit; // Import application-specific stuff use Org\Shipsimu\Hub\Database\Frontend\BaseHubDatabaseWrapper; +use Org\Shipsimu\Hub\Database\Frontend\Unit\UnitDatabaseWrapper; +use Org\Shipsimu\Hub\Producer\Cruncher\Unit\BaseUnitProducer; // Import framework stuff use Org\Mxchange\CoreFramework\Factory\ObjectFactory; diff --git a/application/hub/classes/discovery/recipient/class_BaseRecipientDiscovery.php b/application/hub/classes/discovery/recipient/class_BaseRecipientDiscovery.php index 1573c1433..3c71dc22e 100644 --- a/application/hub/classes/discovery/recipient/class_BaseRecipientDiscovery.php +++ b/application/hub/classes/discovery/recipient/class_BaseRecipientDiscovery.php @@ -2,7 +2,7 @@ // Own namespace namespace Org\Shipsimu\Hub\Discovery\Recipient; -// Import framework-specific stuff +// Import framework stuff use Org\Shipsimu\Hub\Discovery\Node\BaseNodeDiscovery; use Org\Shipsimu\Hub\Discovery\Recipient\DiscoverableRecipient; use Org\Shipsimu\Hub\Factory\Lists\Recipient\RecipientListFactory; diff --git a/application/hub/classes/factories/source/units/class_UnitSourceFactory.php b/application/hub/classes/factories/source/units/class_UnitSourceFactory.php index 5fcf24915..fff207404 100644 --- a/application/hub/classes/factories/source/units/class_UnitSourceFactory.php +++ b/application/hub/classes/factories/source/units/class_UnitSourceFactory.php @@ -1,6 +1,6 @@ getInstance('cruncher'); diff --git a/application/hub/classes/filter/bootstrap/cruncher/class_CruncherBootstrapBufferQueueInitializerFilter.php b/application/hub/classes/filter/bootstrap/cruncher/class_CruncherBootstrapBufferQueueInitializerFilter.php index 2c7f5a340..f9c00574f 100644 --- a/application/hub/classes/filter/bootstrap/cruncher/class_CruncherBootstrapBufferQueueInitializerFilter.php +++ b/application/hub/classes/filter/bootstrap/cruncher/class_CruncherBootstrapBufferQueueInitializerFilter.php @@ -2,6 +2,9 @@ // Own namespace namespace Org\Shipsimu\Hub\Filter\Bootstrap\Cruncher\Queue; +// Import application-specific stuff +use Org\Shipsimu\Hub\Cruncher\Filter\BaseCruncherFilter; + // Import framework stuff use Org\Mxchange\CoreFramework\Filter\Filterable; use Org\Mxchange\CoreFramework\Registry\GenericRegistry; diff --git a/application/hub/classes/filter/bootstrap/cruncher/class_CruncherBootstrapExtraBootstrappingFilter.php b/application/hub/classes/filter/bootstrap/cruncher/class_CruncherBootstrapExtraBootstrappingFilter.php index edd80bfdd..bf44749c6 100644 --- a/application/hub/classes/filter/bootstrap/cruncher/class_CruncherBootstrapExtraBootstrappingFilter.php +++ b/application/hub/classes/filter/bootstrap/cruncher/class_CruncherBootstrapExtraBootstrappingFilter.php @@ -2,6 +2,9 @@ // Own namespace namespace Org\Shipsimu\Hub\Filter\Bootstrap\Cruncher\Extra; +// Import application-specific stuff +use Org\Shipsimu\Hub\Cruncher\Filter\BaseCruncherFilter; + // Import framework stuff use Org\Mxchange\CoreFramework\Filter\Filterable; use Org\Mxchange\CoreFramework\Registry\GenericRegistry; diff --git a/application/hub/classes/filter/bootstrap/cruncher/class_CruncherBootstrapGenericActivationFilter.php b/application/hub/classes/filter/bootstrap/cruncher/class_CruncherBootstrapGenericActivationFilter.php index 69bee2f80..2ec30086b 100644 --- a/application/hub/classes/filter/bootstrap/cruncher/class_CruncherBootstrapGenericActivationFilter.php +++ b/application/hub/classes/filter/bootstrap/cruncher/class_CruncherBootstrapGenericActivationFilter.php @@ -2,6 +2,9 @@ // Own namespace namespace Org\Shipsimu\Hub\Filter\Bootstrap\Cruncher\Activation; +// Import application-specific stuff +use Org\Shipsimu\Hub\Cruncher\Filter\BaseCruncherFilter; + // Import framework stuff use Org\Mxchange\CoreFramework\Filter\Filterable; use Org\Mxchange\CoreFramework\Registry\GenericRegistry; diff --git a/application/hub/classes/filter/cruncher/class_CruncherInitializationFilter.php b/application/hub/classes/filter/cruncher/class_CruncherInitializationFilter.php index 029628f1e..2457a7f5f 100644 --- a/application/hub/classes/filter/cruncher/class_CruncherInitializationFilter.php +++ b/application/hub/classes/filter/cruncher/class_CruncherInitializationFilter.php @@ -2,6 +2,9 @@ // Own namespace namespace Org\Shipsimu\Hub\Cruncher\Filter\Initialization; +// Import application-specific stuff +use Org\Shipsimu\Hub\Cruncher\Filter\BaseCruncherFilter; + // Import framework stuff use Org\Mxchange\CoreFramework\Factory\ObjectFactory; use Org\Mxchange\CoreFramework\Filter\Filterable; @@ -77,12 +80,12 @@ class CruncherInitializationFilter extends BaseCruncherFilter implements Filtera } // Now convert the cruncher-mode in a class name - $className = 'Hub' . self::convertToClassName($cruncherMode) . 'Cruncher'; + $configEntry = sprintf('hub_%s_cruncher_mode_class', $cruncherMode); // And try to instance it try { // Get an instance - $cruncherInstance = ObjectFactory::createObjectByName($className); + $cruncherInstance = ObjectFactory::createObjectByConfiguredName($configEntry); // Get a registry $applicationInstance = GenericRegistry::getRegistry()->getInstance('application'); diff --git a/application/hub/classes/filter/cruncher/class_CruncherPhpRequirementsFilter.php b/application/hub/classes/filter/cruncher/class_CruncherPhpRequirementsFilter.php index 8e476e503..718fc0b5a 100644 --- a/application/hub/classes/filter/cruncher/class_CruncherPhpRequirementsFilter.php +++ b/application/hub/classes/filter/cruncher/class_CruncherPhpRequirementsFilter.php @@ -2,6 +2,9 @@ // Own namespace namespace Org\Shipsimu\Hub\Cruncher\Filter\Requirements; +// Import application-specific stuff +use Org\Shipsimu\Hub\Cruncher\Filter\BaseCruncherFilter; + // Import framework stuff use Org\Mxchange\CoreFramework\Filter\Filterable; use Org\Mxchange\CoreFramework\Request\Requestable; diff --git a/application/hub/classes/filter/cruncher/class_CruncherWelcomeTeaserFilter.php b/application/hub/classes/filter/cruncher/class_CruncherWelcomeTeaserFilter.php index 6ce151b2a..92b5e8dc8 100644 --- a/application/hub/classes/filter/cruncher/class_CruncherWelcomeTeaserFilter.php +++ b/application/hub/classes/filter/cruncher/class_CruncherWelcomeTeaserFilter.php @@ -2,6 +2,9 @@ // Own namespace namespace Org\Shipsimu\Hub\Cruncher\Filter\WelcomeTeaser; +// Import application-specific stuff +use Org\Shipsimu\Hub\Cruncher\Filter\BaseCruncherFilter; + // Import framework stuff use Org\Mxchange\CoreFramework\Filter\Filterable; use Org\Mxchange\CoreFramework\Registry\GenericRegistry; diff --git a/application/hub/classes/filter/shutdown/cruncher/class_CruncherShutdownFilter.php b/application/hub/classes/filter/shutdown/cruncher/class_CruncherShutdownFilter.php index 8d2a1e9bb..3c94ef7cc 100644 --- a/application/hub/classes/filter/shutdown/cruncher/class_CruncherShutdownFilter.php +++ b/application/hub/classes/filter/shutdown/cruncher/class_CruncherShutdownFilter.php @@ -2,6 +2,9 @@ // Own namespace namespace Org\Shipsimu\Hub\Filter\Shutdown\Cruncher; +// Import application-specific stuff +use Org\Shipsimu\Hub\Cruncher\Filter\BaseCruncherFilter; + // Import framework stuff use Org\Mxchange\CoreFramework\Filter\Filterable; use Org\Mxchange\CoreFramework\Registry\GenericRegistry; diff --git a/application/hub/classes/filter/task/cruncher/class_CruncherTaskHandlerInitializerFilter.php b/application/hub/classes/filter/task/cruncher/class_CruncherTaskHandlerInitializerFilter.php index 4422e11ba..0f4e3d108 100644 --- a/application/hub/classes/filter/task/cruncher/class_CruncherTaskHandlerInitializerFilter.php +++ b/application/hub/classes/filter/task/cruncher/class_CruncherTaskHandlerInitializerFilter.php @@ -2,6 +2,9 @@ // Own namespace namespace Org\Shipsimu\Hub\Filter\Initializer\Cruncher\Handler\Task; +// Import application-specific stuff +use Org\Shipsimu\Hub\Cruncher\Filter\BaseCruncherFilter; + // Import framework stuff use Org\Mxchange\CoreFramework\Factory\ObjectFactory; use Org\Mxchange\CoreFramework\Filter\Filterable; diff --git a/application/hub/classes/handler/data/answer-status/class_BaseAnswerStatusHandler.php b/application/hub/classes/handler/data/answer-status/class_BaseAnswerStatusHandler.php index a6b72ad74..e0c13216a 100644 --- a/application/hub/classes/handler/data/answer-status/class_BaseAnswerStatusHandler.php +++ b/application/hub/classes/handler/data/answer-status/class_BaseAnswerStatusHandler.php @@ -2,7 +2,7 @@ // Own namespace namespace Org\Shipsimu\Hub\Handler\Status\Answer; -// Import framework-specific stuff +// Import framework stuff use Org\Shipsimu\Hub\Handler\Data\BaseDataHandler; /** diff --git a/application/hub/classes/helper/messages/crypto/class_CryptoRandomUnitMessageHelper.php b/application/hub/classes/helper/messages/crypto/class_CryptoRandomUnitMessageHelper.php index bb952e00a..71c999992 100644 --- a/application/hub/classes/helper/messages/crypto/class_CryptoRandomUnitMessageHelper.php +++ b/application/hub/classes/helper/messages/crypto/class_CryptoRandomUnitMessageHelper.php @@ -3,7 +3,12 @@ namespace Org\Shipsimu\Hub\Helper\Crypto\Message\RandomUnit; // Import application-specific stuff -use Org\Shipsimu\Hub\Factory\Source\Unit\UnitSourceFactory; +use Org\Shipsimu\Hub\Factory\Crawler\Source\Unit\UnitSourceFactory; +use Org\Shipsimu\Hub\Helper\Message\BaseMessageHelper; +use Org\Shipsimu\Hub\Helper\Message\MessageHelper; + +// Import framework stuff +use Org\Mxchange\CoreFramework\Factory\ObjectFactory; /** * A CryptoRandom message helper @@ -42,7 +47,7 @@ class CryptoRandomUnitMessageHelper extends BaseMessageHelper implements Message * Creates an instance of this class * * @param $sourceType Type of the source - * @return $messageInstance An instance of a UnitHelper class + * @return $messageInstance An instance of a MessageHelper class */ public final static function createCryptoRandomUnitMessageHelper ($sourceType) { // Get new instance diff --git a/application/hub/classes/helper/work_units/cruncher/class_CruncherTestUnitHelper.php b/application/hub/classes/helper/work_units/cruncher/class_CruncherTestUnitHelper.php index 399911687..9a16298fd 100644 --- a/application/hub/classes/helper/work_units/cruncher/class_CruncherTestUnitHelper.php +++ b/application/hub/classes/helper/work_units/cruncher/class_CruncherTestUnitHelper.php @@ -1,4 +1,11 @@ * @version 0.0.0 diff --git a/application/hub/classes/producer/class_BaseProducer.php b/application/hub/classes/producer/class_BaseProducer.php index a12b53714..c90269965 100644 --- a/application/hub/classes/producer/class_BaseProducer.php +++ b/application/hub/classes/producer/class_BaseProducer.php @@ -66,12 +66,6 @@ abstract class BaseProducer extends BaseHubSystem { // Initialize all producers $this->initProducer(); - // Get miner instance - $minerInstance = GenericRegistry::getRegistry()->getInstance('miner'); - - // Change state to next state - $minerInstance->blockProducerHasInitialized($this); - // Initialize work queue (out-going, produced items) $this->initWorkQueue(); } diff --git a/application/hub/classes/producer/cruncher/class_BaseCruncherProducer.php b/application/hub/classes/producer/cruncher/class_BaseCruncherProducer.php new file mode 100644 index 000000000..7efeeb97d --- /dev/null +++ b/application/hub/classes/producer/cruncher/class_BaseCruncherProducer.php @@ -0,0 +1,51 @@ + + * @version 0.0.0 + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2018 Hub Developer Team + * @license GNU GPL 3.0 or any newer version + * @link http://www.ship-simu.org + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +abstract class BaseCruncherProducer extends BaseProducer { + /** + * Protected constructor + * + * @param $className Complete class name + * @return void + */ + protected function __construct ($className) { + // Call parent constructor + parent::__construct($className); + + // Get cruncher instance + $cruncherInstance = GenericRegistry::getRegistry()->getInstance('cruncher'); + + // Change state to next state + $cruncherInstance->blockProducerHasInitialized($this); + } + +} diff --git a/application/hub/classes/producer/cruncher/class_BaseKeyProducer.php b/application/hub/classes/producer/cruncher/keys/class_BaseKeyProducer.php similarity index 87% rename from application/hub/classes/producer/cruncher/class_BaseKeyProducer.php rename to application/hub/classes/producer/cruncher/keys/class_BaseKeyProducer.php index 0a6d7354b..309e06d3b 100644 --- a/application/hub/classes/producer/cruncher/class_BaseKeyProducer.php +++ b/application/hub/classes/producer/cruncher/keys/class_BaseKeyProducer.php @@ -1,9 +1,9 @@ . */ -abstract class BaseKeyProducer extends BaseProducer { +abstract class BaseKeyProducer extends BaseCruncherProducer { /** * Protected constructor * diff --git a/application/hub/classes/producer/cruncher/keys/cruncher/.htaccess b/application/hub/classes/producer/cruncher/keys/cruncher/.htaccess new file mode 100644 index 000000000..3a4288278 --- /dev/null +++ b/application/hub/classes/producer/cruncher/keys/cruncher/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/application/hub/classes/producer/cruncher/keys/class_CruncherKeyProducer.php b/application/hub/classes/producer/cruncher/keys/cruncher/class_CruncherKeyProducer.php similarity index 97% rename from application/hub/classes/producer/cruncher/keys/class_CruncherKeyProducer.php rename to application/hub/classes/producer/cruncher/keys/cruncher/class_CruncherKeyProducer.php index 44a008c71..7f36ee430 100644 --- a/application/hub/classes/producer/cruncher/keys/class_CruncherKeyProducer.php +++ b/application/hub/classes/producer/cruncher/keys/cruncher/class_CruncherKeyProducer.php @@ -4,6 +4,7 @@ namespace Org\Shipsimu\Hub\Producer\Cruncher\Key; // Import application-specific stuff use Org\Shipsimu\Hub\Producer\BaseProducer; +use Org\Shipsimu\Hub\Producer\Key\KeyProducer; // Import framework stuff use Org\Mxchange\CoreFramework\Factory\ObjectFactory; @@ -73,6 +74,7 @@ class CruncherKeyProducer extends BaseKeyProducer implements KeyProducer, Regist * @todo Find something for init phase of this key producer */ protected function initProducer () { + $this->partialStub('Maybe add something here?'); } /** diff --git a/application/hub/classes/producer/cruncher/class_BaseUnitProducer.php b/application/hub/classes/producer/cruncher/work_units/class_BaseUnitProducer.php similarity index 90% rename from application/hub/classes/producer/cruncher/class_BaseUnitProducer.php rename to application/hub/classes/producer/cruncher/work_units/class_BaseUnitProducer.php index 395649cdb..68f4ef9b7 100644 --- a/application/hub/classes/producer/cruncher/class_BaseUnitProducer.php +++ b/application/hub/classes/producer/cruncher/work_units/class_BaseUnitProducer.php @@ -1,9 +1,9 @@ . */ -abstract class BaseUnitProducer extends BaseProducer { +abstract class BaseUnitProducer extends BaseCruncherProducer { /** * Work/test unit status */ diff --git a/application/hub/classes/producer/cruncher/work_units/cruncher/.htaccess b/application/hub/classes/producer/cruncher/work_units/cruncher/.htaccess new file mode 100644 index 000000000..3a4288278 --- /dev/null +++ b/application/hub/classes/producer/cruncher/work_units/cruncher/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/application/hub/classes/producer/cruncher/work_units/class_CruncherTestUnitProducer.php b/application/hub/classes/producer/cruncher/work_units/cruncher/class_CruncherTestUnitProducer.php similarity index 96% rename from application/hub/classes/producer/cruncher/work_units/class_CruncherTestUnitProducer.php rename to application/hub/classes/producer/cruncher/work_units/cruncher/class_CruncherTestUnitProducer.php index 63a954567..45cf0b017 100644 --- a/application/hub/classes/producer/cruncher/work_units/class_CruncherTestUnitProducer.php +++ b/application/hub/classes/producer/cruncher/work_units/cruncher/class_CruncherTestUnitProducer.php @@ -1,9 +1,10 @@ . */ -abstract class BaseBlockProducer extends BaseProducer { +abstract class BaseBlockProducer extends BaseMinerProducer { /** * Block status */ diff --git a/application/hub/classes/producer/miner/blocks/miner/.htaccess b/application/hub/classes/producer/miner/blocks/miner/.htaccess new file mode 100644 index 000000000..3a4288278 --- /dev/null +++ b/application/hub/classes/producer/miner/blocks/miner/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/application/hub/classes/producer/miner/blocks/class_MinerRealGenesisBlockProducer.php b/application/hub/classes/producer/miner/blocks/miner/class_MinerRealGenesisBlockProducer.php similarity index 97% rename from application/hub/classes/producer/miner/blocks/class_MinerRealGenesisBlockProducer.php rename to application/hub/classes/producer/miner/blocks/miner/class_MinerRealGenesisBlockProducer.php index f85425427..6d4420e53 100644 --- a/application/hub/classes/producer/miner/blocks/class_MinerRealGenesisBlockProducer.php +++ b/application/hub/classes/producer/miner/blocks/miner/class_MinerRealGenesisBlockProducer.php @@ -1,6 +1,6 @@ + * @version 0.0.0 + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2018 Hub Developer Team + * @license GNU GPL 3.0 or any newer version + * @link http://www.ship-simu.org + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +abstract class BaseMinerProducer extends BaseProducer { + /** + * Protected constructor + * + * @param $className Complete class name + * @return void + */ + protected function __construct ($className) { + // Call parent constructor + parent::__construct($className); + + // Get miner instance + $minerInstance = GenericRegistry::getRegistry()->getInstance('miner'); + + // Change state to next state + $minerInstance->blockProducerHasInitialized($this); + } + +} diff --git a/application/hub/classes/states/cruncher/init/class_CruncherInitState.php b/application/hub/classes/states/cruncher/init/class_CruncherInitState.php index 5cb6832e9..0ab4cc83d 100644 --- a/application/hub/classes/states/cruncher/init/class_CruncherInitState.php +++ b/application/hub/classes/states/cruncher/init/class_CruncherInitState.php @@ -1,6 +1,10 @@ setConfigEntry('task_miner_block_fetcher_interval_delay', 1000); $cfg->setConfigEntry('task_miner_block_fetcher_max_runs', 0); // CFG: MINER-TEST-GENESIS-BLOCK-PRODUCER-TASK-CLASS -$cfg->setConfigEntry('miner_test_genesis_block_producer_task_class', 'Org\Shipsimu\Hub\Miner\Task\Producer\Block\Genesis\MinerTestGenesisBlockProducerTask'); +$cfg->setConfigEntry('miner_test_genesis_block_producer_task_class', 'Org\Shipsimu\Hub\Miner\Task\Producer\Miner\Block\Genesis\MinerTestGenesisBlockProducerTask'); // CFG: TASK-MINER-TEST-GENESIS-BLOCK-PRODUCER-STARTUP-DELAY $cfg->setConfigEntry('task_miner_test_genesis_block_producer_startup_delay', 1000); @@ -1020,7 +1020,7 @@ $cfg->setConfigEntry('task_miner_test_genesis_block_producer_interval_delay', 10 $cfg->setConfigEntry('task_miner_test_genesis_block_producer_max_runs', 0); // CFG: MINER-REAL-GENESIS-BLOCK-PRODUCER-TASK-CLASS -$cfg->setConfigEntry('miner_real_genesis_block_producer_task_class', 'Org\Shipsimu\Hub\Miner\Task\Producer\Block\Genesis\MinerRealGenesisBlockProducerTask'); +$cfg->setConfigEntry('miner_real_genesis_block_producer_task_class', 'Org\Shipsimu\Hub\Miner\Task\Producer\Miner\Block\Genesis\MinerRealGenesisBlockProducerTask'); // CFG: TASK-MINER-REAL-GENESIS-BLOCK-PRODUCER-STARTUP-DELAY $cfg->setConfigEntry('task_miner_real_genesis_block_producer_startup_delay', 500); @@ -1044,10 +1044,10 @@ $cfg->setConfigEntry('task_miner_node_communicator_interval_delay', 250); $cfg->setConfigEntry('task_miner_node_communicator_max_runs', 0); // CFG: MINER-TEST-GENESIS-BLOCK-PRODUCER-CLASS -$cfg->setConfigEntry('miner_test_genesis_block_producer_class', 'Org\Shipsimu\Hub\miner\Producer\Block\Genesis\MinerTestGenesisBlockProducer'); +$cfg->setConfigEntry('miner_test_genesis_block_producer_class', 'Org\Shipsimu\Hub\miner\Producer\Miner\Block\Genesis\MinerTestGenesisBlockProducer'); // CFG: MINER-REAL-GENESIS-BLOCK-PRODUCER-CLASS -$cfg->setConfigEntry('miner_real_genesis_block_producer_class', 'Org\Shipsimu\Hub\Miner\Producer\Block\Genesis\MinerRealGenesisBlockProducer'); +$cfg->setConfigEntry('miner_real_genesis_block_producer_class', 'Org\Shipsimu\Hub\Miner\Producer\Miner\Block\Genesis\MinerRealGenesisBlockProducer'); // CFG: MINER-NODE-COMMUNICATOR-CLASS $cfg->setConfigEntry('miner_node_communicator_class', 'Org\Shipsimu\Hub\Miner\Communicator\Node\MinerNodeCommunicator'); @@ -1065,8 +1065,11 @@ $cfg->setConfigEntry('hub_coin_miner_mode_class', 'Org\Shipsimu\Hub\Miner\HubCoi // Cruncher configuration /////////////////////////////////////////////////////////////////////////////// -// CFG: CRUNCHER-DEFAULT-MODE (can be only 'mcrypt' at the moment) -$cfg->setConfigEntry('cruncher_default_mode', 'mcrypt'); +// CFG: CRUNCHER-DEFAULT-MODE (can be only 'openssl' at the moment) +$cfg->setConfigEntry('cruncher_default_mode', 'openssl'); + +// CFG: HUB-OPENSSL-CRUNCHER-MODE-CLASS +$cfg->setConfigEntry('hub_openssl_cruncher_mode_class', 'Org\Shipsimu\Hub\Cruncher\OpenSsl\HubOpenSslCruncher'); // CFG: CRUNCHER-BUFFER-STACKER-CLASS $cfg->setConfigEntry('cruncher_buffer_stacker_class', 'Org\Mxchange\CoreFramework\Stacker\FiFoStacker'); @@ -1075,31 +1078,31 @@ $cfg->setConfigEntry('cruncher_buffer_stacker_class', 'Org\Mxchange\CoreFramewor $cfg->setConfigEntry('hub_console_cmd_cruncher_resolver_class', 'Org\Shipsimu\Hub\Resolver\Command\HubConsoleCommandResolver'); // CFG: CRUNCHER-PHP-REQUIREMENTS-FILTER -$cfg->setConfigEntry('cruncher_php_requirements_filter_class', 'CruncherPhpRequirementsFilter'); +$cfg->setConfigEntry('cruncher_php_requirements_filter_class', 'Org\Shipsimu\Hub\Cruncher\Filter\Requirements\CruncherPhpRequirementsFilter'); // CFG: CRUNCHER-INITIALIZER-FILTER -$cfg->setConfigEntry('cruncher_initializer_filter_class', 'CruncherInitializationFilter'); +$cfg->setConfigEntry('cruncher_initializer_filter_class', 'Org\Shipsimu\Hub\Cruncher\Filter\Initialization\CruncherInitializationFilter'); // CFG: CRUNCHER-BOOTSTRAP-TASK-HANDLER-INITIALIZER-FILTER -$cfg->setConfigEntry('cruncher_bootstrap_task_handler_initializer_filter_class', 'CruncherTaskHandlerInitializerFilter'); +$cfg->setConfigEntry('cruncher_bootstrap_task_handler_initializer_filter_class', 'Org\Shipsimu\Hub\Filter\Initializer\Cruncher\Handler\Task\CruncherTaskHandlerInitializerFilter'); // CFG: CRUNCHER-BOOTSTRAP-EXTRA-BOOTSTRAPPING-FILTER -$cfg->setConfigEntry('cruncher_bootstrap_extra_bootstrapping_filter_class', 'CruncherBootstrapExtraBootstrappingFilter'); +$cfg->setConfigEntry('cruncher_bootstrap_extra_bootstrapping_filter_class', 'Org\Shipsimu\Hub\Filter\Bootstrap\Cruncher\Extra\CruncherBootstrapExtraBootstrappingFilter'); // CFG: CRUNCHER-BOOTSTRAP-BUFFER-QUEUE-INITIALIZER-FILTER -$cfg->setConfigEntry('cruncher_bootstrap_buffer_queue_initializer_filter_class', 'CruncherBootstrapBufferQueueInitializerFilter'); +$cfg->setConfigEntry('cruncher_bootstrap_buffer_queue_initializer_filter_class', 'Org\Shipsimu\Hub\Filter\Bootstrap\Cruncher\Queue\CruncherBootstrapBufferQueueInitializerFilter'); // CFG: CRUNCHER-BOOTSTRAP-GENERIC-ACTIVATION-FILTER -$cfg->setConfigEntry('cruncher_bootstrap_generic_activation_filter_class', 'CruncherBootstrapGenericActivationFilter'); +$cfg->setConfigEntry('cruncher_bootstrap_generic_activation_filter_class', 'Org\Shipsimu\Hub\Filter\Bootstrap\Cruncher\Activation\CruncherBootstrapGenericActivationFilter'); // CFG: CRUNCHER-WELCOME-TEASER-FILTER -$cfg->setConfigEntry('cruncher_welcome_teaser_filter_class', 'CruncherWelcomeTeaserFilter'); +$cfg->setConfigEntry('cruncher_welcome_teaser_filter_class', 'Org\Shipsimu\Hub\Cruncher\Filter\WelcomeTeaser\CruncherWelcomeTeaserFilter'); // CFG: CRUNCHER-SHUTDOWN-FILTER -$cfg->setConfigEntry('cruncher_shutdown_filter_class', 'CruncherShutdownFilter'); +$cfg->setConfigEntry('cruncher_shutdown_filter_class', 'Org\Shipsimu\Hub\Filter\Shutdown\Cruncher\CruncherShutdownFilter'); // CFG: CRUNCHER-WORK-UNIT-FETCHER-TASK-CLASS -$cfg->setConfigEntry('cruncher_work_unit_fetcher_task_class', 'CruncherWorkUnitFetcherTask'); +$cfg->setConfigEntry('cruncher_work_unit_fetcher_task_class', 'Org\Shipsimu\Hub\Cruncher\Task\Fetcher\WorkUnit\CruncherWorkUnitFetcherTask'); // CFG: TASK-CRUNCHER-WORK-UNIT-FETCHER-STARTUP-DELAY $cfg->setConfigEntry('task_cruncher_work_unit_fetcher_startup_delay', 1000); @@ -1111,7 +1114,7 @@ $cfg->setConfigEntry('task_cruncher_work_unit_fetcher_interval_delay', 10); $cfg->setConfigEntry('task_cruncher_work_unit_fetcher_max_runs', 0); // CFG: CRUNCHER-TEST-UNIT-PRODUCER-TASK-CLASS -$cfg->setConfigEntry('cruncher_test_unit_producer_task_class', 'CruncherTestUnitProducerTask'); +$cfg->setConfigEntry('cruncher_test_unit_producer_task_class', 'Org\Shipsimu\Hub\Cruncher\Task\Producer\Unit\CruncherTestUnitProducerTask'); // CFG: TASK-CRUNCHER-TEST-UNIT-PRODUCER-STARTUP-DELAY $cfg->setConfigEntry('task_cruncher_test_unit_producer_startup_delay', 500); @@ -1123,7 +1126,7 @@ $cfg->setConfigEntry('task_cruncher_test_unit_producer_interval_delay', 1000*60* $cfg->setConfigEntry('task_cruncher_test_unit_producer_max_runs', 0); // CFG: CRUNCHER-KEY-PRODUCER-TASK-CLASS -$cfg->setConfigEntry('cruncher_key_producer_task_class', 'CruncherKeyProducerTask'); +$cfg->setConfigEntry('cruncher_key_producer_task_class', 'Org\Shipsimu\Hub\Cruncher\Producer\Key\CruncherKeyProducerTask'); // CFG: TASK-CRUNCHER-KEY-PRODUCER-STARTUP-DELAY $cfg->setConfigEntry('task_cruncher_key_producer_startup_delay', 750); @@ -1141,19 +1144,19 @@ $cfg->setConfigEntry('cruncher_test_units_enabled', 'Y'); $cfg->setConfigEntry('cruncher_in_buffer_min_threshold', 3); // CFG: CRUNCHER-TEST-UNIT-GENERATOR-CLASS -$cfg->setConfigEntry('cruncher_test_unit_generator_class', 'CruncherTestUnitHelper'); +$cfg->setConfigEntry('cruncher_test_unit_generator_class', 'Org\Shipsimu\Hub\Cruncher\Helper\WorkUnit\Test\CruncherTestUnitHelper'); // CFG: CRUNCHER-MAX-TEST-UNIT-AMOUNT $cfg->setConfigEntry('cruncher_max_text_unit_amount', 10); // CFG: CRUNCHER-TEST-UNIT-PRODUCER-CLASS -$cfg->setConfigEntry('cruncher_test_unit_producer_class', 'CruncherTestUnitProducer'); +$cfg->setConfigEntry('cruncher_test_unit_producer_class', 'Org\Shipsimu\Hub\Cruncher\Producer\Cruncher\Unit\CruncherTestUnitProducer'); // CFG: CRUNCHER-KEY-PRODUCER-CLASS -$cfg->setConfigEntry('cruncher_key_producer_class', 'CruncherKeyProducer'); +$cfg->setConfigEntry('cruncher_key_producer_class', 'Org\Shipsimu\Hub\Producer\Cruncher\Key\CruncherKeyProducer'); // CFG: CRUNCHER-TEST-UNIT-PRODUCER-TEMPLATE-CLASS -$cfg->setConfigEntry('cruncher_test_unit_producer_template_class', 'XmlCruncherTestUnitTemplateEngine'); +$cfg->setConfigEntry('cruncher_test_unit_producer_template_class', 'Org\Shipsimu\Hub\Cruncher\Template\Engine\Xml\TestUnit\XmlCruncherTestUnitTemplateEngine'); // CFG: CRUNCHER-MESSAGE-TEMPLATE-EXTENSION $cfg->setConfigEntry('cruncher_message_template_extension', '.xml'); @@ -1177,13 +1180,13 @@ $cfg->setConfigEntry('stacker_outgoing_queue_max_size', 2000); $cfg->setConfigEntry('cruncher_test_unit_max_count', 1000); // CFG: CRUNCHER-UNIT-DB-WRAPPER-CLASS -$cfg->setConfigEntry('cruncher_unit_db_wrapper_class', 'CruncherUnitDatabaseWrapper'); +$cfg->setConfigEntry('cruncher_unit_db_wrapper_class', 'Org\Shipsimu\Hub\Database\Frontend\Cruncher\Unit\CruncherUnitDatabaseWrapper'); // CFG: CRUNCHER-RANDOM-SECRET-MESSAGE-LENGTH $cfg->setConfigEntry('random_secret_message_length', 100); // CFG: TEST-UNIT-PRODUCER-KEY-ITERATOR-CLASS -$cfg->setConfigEntry('test_unit_producer_key_iterator_class', 'TestUnitKeyProducerIterator'); +$cfg->setConfigEntry('test_unit_producer_key_iterator_class', 'Org\Shipsimu\Hub\Iterator\Producer\Key\TestUnit\TestUnitKeyProducerIterator'); // CFG: WORK-UNIT-PRODUCER-KEY-ITERATOR-CLASS $cfg->setConfigEntry('work_unit_producer_key_iterator_class', 'WorkUnitKeyProducerIterator'); @@ -1192,16 +1195,16 @@ $cfg->setConfigEntry('work_unit_producer_key_iterator_class', 'WorkUnitKeyProduc $cfg->setConfigEntry('test_unit_random_secret_key_length', 8 * 32); // CFG: TEST-UNIT-SOURCE-CLASS -$cfg->setConfigEntry('test_unit_source_class', 'TestUnitSource'); +$cfg->setConfigEntry('test_unit_source_class', 'Org\Shipsimu\Hub\Crawler\Source\Unit\TestUnitSource'); // CFG: CRYPTO-RANDOM-MESSAGE-HELPER-CLASS -$cfg->setConfigEntry('crypto_random_message_helper_class', 'CryptoRandomUnitMessageHelper'); +$cfg->setConfigEntry('crypto_random_message_helper_class', 'Org\Shipsimu\Hub\Helper\Crypto\Message\RandomUnit\CryptoRandomUnitMessageHelper'); // CFG: CRUNCHER-INIT-STATE-CLASS -$cfg->setConfigEntry('cruncher_init_state_class', 'CruncherInitState'); +$cfg->setConfigEntry('cruncher_init_state_class', 'Org\Shipsimu\Hub\Cruncher\State\Initialization\CruncherInitState'); // CFG: CRUNCHER-VIRGIN-STATE-CLASS -$cfg->setConfigEntry('cruncher_virgin_state_class', 'CruncherVirginState'); +$cfg->setConfigEntry('cruncher_virgin_state_class', 'Org\Shipsimu\Hub\Cruncher\State\Virgin\CruncherVirginState'); // CFG: CRUNCHER-PER-UNIT-KEY-LIMIT $cfg->setConfigEntry('cruncher_per_unit_key_limit', 1000); diff --git a/application/hub/interfaces/producer/keys/class_KeyProducer.php b/application/hub/interfaces/producer/keys/class_KeyProducer.php index 442689922..e6a011797 100644 --- a/application/hub/interfaces/producer/keys/class_KeyProducer.php +++ b/application/hub/interfaces/producer/keys/class_KeyProducer.php @@ -2,6 +2,9 @@ // Own namespace namespace Org\Shipsimu\Hub\Producer\Key; +// Import application-specific stuff +use Org\Shipsimu\Hub\Producer\Producer; + // Import framework stuff use Org\Mxchange\CoreFramework\Executor\Executor; use Org\Mxchange\CoreFramework\State\Stateable; diff --git a/application/hub/interfaces/producer/work_units/class_UnitProducer.php b/application/hub/interfaces/producer/work_units/class_UnitProducer.php index b4cba7371..242af0fa5 100644 --- a/application/hub/interfaces/producer/work_units/class_UnitProducer.php +++ b/application/hub/interfaces/producer/work_units/class_UnitProducer.php @@ -2,6 +2,9 @@ // Own namespace namespace Org\Shipsimu\Hub\Producer\Unit; +// Import application-specific stuff +use Org\Shipsimu\Hub\Producer\Producer; + // Import framework stuff use Org\Mxchange\CoreFramework\Executor\Executor; use Org\Mxchange\CoreFramework\State\Stateable; -- 2.39.5