phptars / tars-registry
tars的php主控寻址相关
Installs: 11 599
Dependents: 4
Suggesters: 0
Security: 0
Stars: 0
Watchers: 5
Forks: 2
Open Issues: 1
pkg:composer/phptars/tars-registry
Requires
- php: >=5.6
- phptars/tars-utils: ~0.1
This package is auto-updated.
Last update: 2025-10-21 03:36:11 UTC
README
Module description
The tar registry service of the tar s platform provides the function of service discovery.
This module provides PHP with the ability of master addressing (service discovery).
Document description:
├── composer.json
├── src
│   ├── client  //Client code requesting the master service
│   │   ├── Code.php
│   │   ├── CodeRegistry.php
│   │   ├── CommunicatorConfig.php
│   │   ├── CommunicatorFactory.php
│   │   ├── Communicator.php
│   │   ├── CommunicatorRegistry.php
│   │   ├── Consts.php
│   │   ├── RequestPacket.php
│   │   ├── RequestPacketRegistry.php
│   │   ├── ResponsePacket.php
│   │   ├── ResponsePacketRegistry.php
│   │   ├── TUPAPIWrapper.php
│   │   └── TUPAPIWrapperRegistry.php
│   ├── EndpointF.php       //struct EndpointF 的php类
│   ├── QueryFServant.php   //Direct request for master service
│   ├── QueryFWrapper.php   //The priority is to find the service address from memory, and then from the master address
│   ├── RouteTable.php      //Save the service address in the swoole table
│   └── tars   //Protocol file            
│       ├── EndpointF.tars 
│       └── QueryF.tars 
└── tests
    └── demo.php
Use example:
        //从tarsregistryService search service address
        $wrapper = new \Tars\registry\QueryFWrapper("tars.tarsregistry.QueryObj@tcp -h 172.16.0.161 -p 17890",1,60000);
        $result = $wrapper->findObjectById("PHPTest.PHPServer.obj");
        var_dump($result);
        //The priority is to find the service address from memory, and then from the master address
        \Tars\registry\RouteTable::getInstance();
        $result = \Tars\registry\RouteTable::getRouteInfo("PHPTest.PHPServer.obj");
        echo "result:\n";
        var_dump($result);
Changelog
v0.1.7 (2019-03-20)
- Master addressing cache interface, convenient to customize cache mode, default to use swoole table