phptars/tars-registry

There is no license information available for the latest version (0.1.7) of this package.

tars的php主控寻址相关

0.1.7 2019-03-20 11:17 UTC

This package is auto-updated.

Last update: 2024-10-21 01:37:40 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