1 Star 0 Fork 0

TarsPHP/tars-utils

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README

tars-utils


tars-utils 是 phptars的辅助类库,主要提供如下几个功能:

  • 配置文件解析并缓存(swoole table)
  • 主控地址解析
  • node上报配置解析

@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)

node上报配置解析,示例:

$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
]

Changelog

v0.3.0(2019-06-21)

  • 支持多个servant

空文件

简介

tars utils目录 展开 收起
取消

发行版

暂无发行版

贡献者

全部

近期动态

不能加载更多了
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
PHP
1
https://gitee.com/TarsPHP/tars-utils.git
git@gitee.com:TarsPHP/tars-utils.git
TarsPHP
tars-utils
tars-utils
master

搜索帮助