-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
797a81e
commit 9ed9341
Showing
5 changed files
with
84 additions
and
88 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 <[email protected]> | ||
* @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 | ||
* | ||
* <pre> | ||
* [ | ||
* '127.0.0.1:88', | ||
* '127.0.0.1:88' | ||
* ] | ||
* </pre> | ||
* | ||
* @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; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 <[email protected]> | ||
* @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 | ||
* | ||
* <pre> | ||
* [ | ||
* '127.0.0.1:88', | ||
* '127.0.0.1:88' | ||
* ] | ||
* </pre> | ||
* | ||
* @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; | ||
} | ||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 <[email protected]> | ||
* @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 | ||
* | ||
* <pre> | ||
* [ | ||
* '127.0.0.1:88', | ||
* '127.0.0.1:88' | ||
* ] | ||
* </pre> | ||
* | ||
* @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; | ||
} | ||
} |
Oops, something went wrong.