From: Roland Haeder Date: Mon, 31 Mar 2014 22:00:50 +0000 (+0200) Subject: Block and WU producers are two different producer classes. X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=cbe4b5bac3149e25e8a13b476054f1e36ad38d2a;p=hub.git Block and WU producers are two different producer classes. Signed-off-by: Roland Haeder --- diff --git a/application/hub/interfaces/producer/block/.htaccess b/application/hub/interfaces/producer/block/.htaccess new file mode 100644 index 000000000..3a4288278 --- /dev/null +++ b/application/hub/interfaces/producer/block/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/application/hub/interfaces/producer/block/class_BlockProducer.php b/application/hub/interfaces/producer/block/class_BlockProducer.php new file mode 100644 index 000000000..2c61358d1 --- /dev/null +++ b/application/hub/interfaces/producer/block/class_BlockProducer.php @@ -0,0 +1,36 @@ + + * @version 0.0.0 + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2012 Hub Developer Team + * @license GNU GPL 3.0 or any newer version + * @link http://www.shipsimu.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 . + */ +interface BlockProducer extends Producer, Executor { + /** + * Prepares the produces of some work/test units and pushes them onto the queue + * + * @param $stateInstance An instance of a Stateable instance + * @return void + */ + function prepareBlockProduction (Stateable $stateInstance); +} + +// [EOF] +?> diff --git a/application/hub/main/producer/miner/blocks/class_MinerTestGenesisBlockProducer.php b/application/hub/main/producer/miner/blocks/class_MinerTestGenesisBlockProducer.php index 44ac83e6d..d67cdd66e 100644 --- a/application/hub/main/producer/miner/blocks/class_MinerTestGenesisBlockProducer.php +++ b/application/hub/main/producer/miner/blocks/class_MinerTestGenesisBlockProducer.php @@ -21,7 +21,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -class MinerTestGenesisBlockProducer extends BaseUnitProducer implements UnitProducer, Registerable { +class MinerTestGenesisBlockProducer extends BaseBlockProducer implements BlockProducer, Registerable { /** * Protected constructor * @@ -63,7 +63,7 @@ class MinerTestGenesisBlockProducer extends BaseUnitProducer implements UnitProd * @return void * @todo 0% done */ - public function prepareUnitProduction (Stateable $stateInstance) { + public function prepareBlockProduction (Stateable $stateInstance) { $this->partialStub('Please implement this method, stateInstance=' . $stateInstance->__toString()); } } diff --git a/application/hub/main/states/miner/init/class_MinerInitState.php b/application/hub/main/states/miner/init/class_MinerInitState.php index 02d353209..14caefed5 100644 --- a/application/hub/main/states/miner/init/class_MinerInitState.php +++ b/application/hub/main/states/miner/init/class_MinerInitState.php @@ -60,7 +60,7 @@ class MinerInitState extends BaseMinerState implements Stateable { */ public function executeState (Executor $executorInstance) { // Now prepare the unit production to maybe become 'virgin' or 'active' if work/test units are there - $executorInstance->prepareUnitProduction($this); + $executorInstance->prepareBlockProduction($this); } /**