phptars / tars-utils
此包的最新版本(0.3.2)没有可用的许可证信息。
tars的php辅助文件
0.3.2
2022-04-23 08:14 UTC
Requires
- php: >=5.3
Requires (Dev)
- phpunit/phpunit: ^9
This package is auto-updated.
Last update: 2024-09-24 07:02:10 UTC
README
tars-utils
是 phptars 的辅助类库,主要提供以下功能
-
配置解析和缓存(swoole 表)
-
主地址解析
-
节点报告配置分析
@parseFile($configPath)
对于配置文件解析,以 qdphp.Tarsserver.Config.Conf
为例,解析 conf
文件为数组形式
@getLocatorInfo($locatorString)
地址解析,示例
$locatorString = "tars.tarsregistry.QueryObj@tcp -h 127.0.0.1 -p 17890:tcp -h 127.0.0.1 -p 17890"; $locatorInfo = \Tars\Utils::getLocatorInfo($locatorString);
结果如下:
[ 'locatorName' => 'tars.tarsregistry.QueryObj', 'routeInfo' => [ [ 'sHost' => '127.0.0.1', 'sProtocol' => 'tcp', 'iPort' => 17890, 'iTimeout' => '', 'bIp' => '', 'sIp' => '' ], [ 'sHost' => '127.0.0.1', 'sProtocol' => 'tcp', 'iPort' => 17890, 'iTimeout' => '', 'bIp' => '', 'sIp' => '' ] ] ]
@parseNodeInfo($nodeInfo)
节点报告配置解析,例如
$locatorString = "tars.tarsnode.ServerObj@tcp -h 127.0.0.1 -p 2345 -t 10000"; $nodeInfo = \Tars\Utils::parseNodeInfo($locatorString);
结果如下
[ 'objName' => 'tars.tarsnode.ServerObj', 'mode' => 'tcp', 'host' => '127.0.0.1', 'port' => 2345, 'timeout' => 1, 'sIp' => '', 'iPort' => 2345 ]
变更日志
v0.3.0(2019-06-21)
- 支持多服务