tars-utils
is an auxiliary library for phptars, which mainly provides the following functions:
Take QDPHP.TARSServer.config.conf as an example, parse the conf
file into an array
$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);
The results are as follows:
[
'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' => ''
]
]
]
$locatorString = "tars.tarsnode.ServerObj@tcp -h 127.0.0.1 -p 2345 -t 10000";
$nodeInfo = \Tars\Utils::parseNodeInfo($locatorString);
The results are as follows:
[
'objName' => 'tars.tarsnode.ServerObj',
'mode' => 'tcp',
'host' => '127.0.0.1',
'port' => 2345,
'timeout' => 1,
'sIp' => '',
'iPort' => 2345
]