diff --git a/src/Pool/Config/DbSlavePoolConfig.php b/src/Pool/Config/DbSlavePoolConfig.php index d08d587..ee54e9f 100644 --- a/src/Pool/Config/DbSlavePoolConfig.php +++ b/src/Pool/Config/DbSlavePoolConfig.php @@ -5,8 +5,6 @@ use Swoft\Bean\Annotation\Bean; use Swoft\Bean\Annotation\Value; use Swoft\Db\Driver\Driver; -use Swoft\Sg\BalancerSelector; -use Swoft\Sg\ProviderSelector; /** * the slave config of database @@ -85,7 +83,7 @@ class DbSlavePoolConfig extends DbPoolProperties * @Value(name="${config.db.slave.balancer}", env="${DB_SLAVE_BALANCER}") * @var string */ - protected $balancer = BalancerSelector::TYPE_RANDOM; + protected $balancer = 'random'; /** * the default provider is consul provider @@ -93,7 +91,7 @@ class DbSlavePoolConfig extends DbPoolProperties * @Value(name="${config.db.slave.provider}", env="${DB_SLAVE_PROVIDER}") * @var string */ - protected $provider = ProviderSelector::TYPE_CONSUL; + protected $provider = 'consul'; /** * the default driver is mysql diff --git a/test/Testing/Pool/DbEnvPoolConfig.php b/test/Testing/Pool/DbEnvPoolConfig.php index fc62e5a..95bd91d 100644 --- a/test/Testing/Pool/DbEnvPoolConfig.php +++ b/test/Testing/Pool/DbEnvPoolConfig.php @@ -4,98 +4,97 @@ use Swoft\Bean\Annotation\Bean; use Swoft\Bean\Annotation\Value; -use Swoft\Sg\BalancerSelector; use Swoft\Pool\PoolProperties; -use Swoft\Sg\ProviderSelector; /** * db env pool config - * * @Bean() - * @uses DbEnvPoolConfig - * @version 2017年12月18日 - * @author stelin - * @copyright Copyright 2010-2016 swoft software - * @license PHP Version 7.x {@link http://www.php.net/license/3_0.txt} */ class DbEnvPoolConfig extends PoolProperties { /** * the name of pool - * * @Value(env="${DB_NAME}") + * * @var string */ - protected $name = ""; + protected $name = ''; /** * the maximum number of idle connections - * * @Value(env="${DB_MAX_IDEL}") + * * @var int */ protected $maxIdel = 6; /** * the maximum number of active connections - * * @Value(env="${DB_MAX_ACTIVE}") + * * @var int */ protected $maxActive = 50; /** * the maximum number of wait connections - * * @Value(env="${DB_MAX_WAIT}") + * * @var int */ protected $maxWait = 100; /** * the time of connect timeout - * * @Value(env="${DB_TIMEOUT}") + * * @var int */ protected $timeout = 200; /** * the addresses of connection - * *
      * [
      *  '127.0.0.1:88',
      *  '127.0.0.1:88'
      * ]
      * 
- * * @Value(env="${DB_URI}") + * * @var array */ protected $uri = []; /** * whether to user provider(consul/etcd/zookeeper) - * * @Value(env="${DB_USE_PROVIDER}") + * * @var bool */ protected $useProvider = false; /** * the default balancer is random balancer - * * @Value(env="${DB_BALANCER}") + * * @var string */ - protected $balancer = BalancerSelector::TYPE_RANDOM; + protected $balancer = 'random'; /** * the default provider is consul provider - * * @Value(env="${DB_PROVIDER}") + * * @var string */ - protected $provider = ProviderSelector::TYPE_CONSUL; + protected $provider = 'consul'; + + /** + * @return int + */ + public function getMaxIdel(): int + { + return $this->maxIdel; + } } diff --git a/test/Testing/Pool/DbPptPoolConfig.php b/test/Testing/Pool/DbPptPoolConfig.php index 00b6bcb..19acd9e 100644 --- a/test/Testing/Pool/DbPptPoolConfig.php +++ b/test/Testing/Pool/DbPptPoolConfig.php @@ -4,98 +4,99 @@ use Swoft\Bean\Annotation\Bean; use Swoft\Bean\Annotation\Value; -use Swoft\Sg\BalancerSelector; use Swoft\Pool\PoolProperties; -use Swoft\Sg\ProviderSelector; /** * db properties pool config - * * @Bean() - * @uses DbPptPoolConfig - * @version 2017年12月18日 - * @author stelin - * @copyright Copyright 2010-2016 swoft software - * @license PHP Version 7.x {@link http://www.php.net/license/3_0.txt} */ class DbPptPoolConfig extends PoolProperties { /** * the name of pool - * * @Value(name="${config.db.master.name}") + * * @var string */ - protected $name = ""; + protected $name = ''; /** * the maximum number of idle connections - * * @Value(name="${config.db.master.maxIdel}") + * * @var int */ protected $maxIdel = 6; /** * the maximum number of active connections - * * @Value(name="${config.db.master.maxActive}") + * * @var int */ protected $maxActive = 50; /** * the maximum number of wait connections - * * @Value(name="${config.db.master.maxWait}") + * * @var int */ protected $maxWait = 100; /** * the time of connect timeout - * * @Value(name="${config.db.master.timeout}") + * * @var int */ protected $timeout = 200; /** * the addresses of connection - * *
      * [
      *  '127.0.0.1:88',
      *  '127.0.0.1:88'
      * ]
      * 
- * * @Value(name="${config.db.master.uri}") + * * @var array */ protected $uri = []; /** * whether to user provider(consul/etcd/zookeeper) - * * @Value(name="${config.db.master.useProvider}") + * * @var bool */ protected $useProvider = false; /** * the default balancer is random balancer - * * @Value(name="${config.db.master.balancer}") + * * @var string */ - protected $balancer = BalancerSelector::TYPE_RANDOM; + protected $balancer = 'random'; /** * the default provider is consul provider - * * @Value(name="${config.db.master.provider}") + * * @var string */ - protected $provider = ProviderSelector::TYPE_CONSUL; + protected $provider = 'consul'; + + /** + * @return int + */ + public function getMaxIdel(): int + { + return $this->maxIdel; + } + + } diff --git a/test/Testing/Pool/DbSlaveEnvPoolConfig.php b/test/Testing/Pool/DbSlaveEnvPoolConfig.php index 0ee8248..4f3034b 100644 --- a/test/Testing/Pool/DbSlaveEnvPoolConfig.php +++ b/test/Testing/Pool/DbSlaveEnvPoolConfig.php @@ -4,98 +4,97 @@ use Swoft\Bean\Annotation\Bean; use Swoft\Bean\Annotation\Value; -use Swoft\Sg\BalancerSelector; use Swoft\Pool\PoolProperties; -use Swoft\Sg\ProviderSelector; /** * db slave env pool config - * * @Bean() - * @uses DbSlaveEnvPoolConfig - * @version 2017年12月18日 - * @author stelin - * @copyright Copyright 2010-2016 swoft software - * @license PHP Version 7.x {@link http://www.php.net/license/3_0.txt} */ class DbSlaveEnvPoolConfig extends PoolProperties { /** * the name of pool - * * @Value(env="${DB_SLAVE_NAME}") + * * @var string */ - protected $name = ""; + protected $name = ''; /** * the maximum number of idle connections - * * @Value(env="${DB_SLAVE_MAX_IDEL}") + * * @var int */ protected $maxIdel = 6; /** * the maximum number of active connections - * * @Value(env="${DB_SLAVE_MAX_ACTIVE}") + * * @var int */ protected $maxActive = 50; /** * the maximum number of wait connections - * * @Value(env="${DB_SLAVE_MAX_WAIT}") + * * @var int */ protected $maxWait = 100; /** * the time of connect timeout - * * @Value(env="${DB_SLAVE_TIMEOUT}") + * * @var int */ protected $timeout = 200; /** * the addresses of connection - * *
      * [
      *  '127.0.0.1:88',
      *  '127.0.0.1:88'
      * ]
      * 
- * * @Value(env="${DB_SLAVE_URI}") + * * @var array */ protected $uri = []; /** * whether to user provider(consul/etcd/zookeeper) - * * @Value(env="${DB_SLAVE_USE_PROVIDER}") + * * @var bool */ protected $useProvider = false; /** * the default balancer is random balancer - * * @Value(env="${DB_SLAVE_BALANCER}") + * * @var string */ - protected $balancer = BalancerSelector::TYPE_RANDOM; + protected $balancer = 'random'; /** * the default provider is consul provider - * * @Value(env="${DB_SLAVE_PROVIDER}") + * * @var string */ - protected $provider = ProviderSelector::TYPE_CONSUL; + protected $provider = 'consul'; + + /** + * @return int + */ + public function getMaxIdel(): int + { + return $this->maxIdel; + } } diff --git a/test/Testing/Pool/DbSlavePptConfig.php b/test/Testing/Pool/DbSlavePptConfig.php index 915e71e..48f474a 100644 --- a/test/Testing/Pool/DbSlavePptConfig.php +++ b/test/Testing/Pool/DbSlavePptConfig.php @@ -4,98 +4,97 @@ use Swoft\Bean\Annotation\Bean; use Swoft\Bean\Annotation\Value; -use Swoft\Sg\BalancerSelector; use Swoft\Pool\PoolProperties; -use Swoft\Sg\ProviderSelector; /** * db salve properties pool config - * * @Bean() - * @uses DbSlavePptConfig - * @version 2017年12月18日 - * @author stelin - * @copyright Copyright 2010-2016 swoft software - * @license PHP Version 7.x {@link http://www.php.net/license/3_0.txt} */ class DbSlavePptConfig extends PoolProperties { /** * the name of pool - * * @Value(name="${config.db.slave.name}") + * * @var string */ - protected $name = ""; + protected $name = ''; /** * the maximum number of idle connections - * * @Value(name="${config.db.slave.maxIdel}") + * * @var int */ protected $maxIdel = 6; /** * the maximum number of active connections - * * @Value(name="${config.db.slave.maxActive}") + * * @var int */ protected $maxActive = 50; /** * the maximum number of wait connections - * * @Value(name="${config.db.slave.maxWait}") + * * @var int */ protected $maxWait = 100; /** * the time of connect timeout - * * @Value(name="${config.db.slave.timeout}") + * * @var int */ protected $timeout = 200; /** * the addresses of connection - * *
      * [
      *  '127.0.0.1:88',
      *  '127.0.0.1:88'
      * ]
      * 
- * * @Value(name="${config.db.slave.uri}") + * * @var array */ protected $uri = []; /** * whether to user provider(consul/etcd/zookeeper) - * * @Value(name="${config.db.slave.useProvider}") + * * @var bool */ protected $useProvider = false; /** * the default balancer is random balancer - * * @Value(name="${config.db.slave.balancer}") + * * @var string */ - protected $balancer = BalancerSelector::TYPE_RANDOM; + protected $balancer = 'random'; /** * the default provider is consul provider - * * @Value(name="${config.db.slave.provider}") + * * @var string */ - protected $provider = ProviderSelector::TYPE_CONSUL; + protected $provider = 'consul'; + + /** + * @return int + */ + public function getMaxIdel(): int + { + return $this->maxIdel; + } }