Zookeeper example


class ZookeeperStoreTest extends AbstractStoreTestCase
{
    use UnserializableTestTrait;

    public function getStore(): ZookeeperStore
    {
        $zookeeper_server = getenv('ZOOKEEPER_HOST').':2181';

        $zookeeper = new \Zookeeper($zookeeper_server);

        return StoreFactory::createStore($zookeeper);
    }

    /** * @dataProvider provideValidConnectionString */
    public function testCreateConnection(string $connectionString)
    {
        $this->assertInstanceOf(\Zookeeper::class, ZookeeperStore::createConnection($connectionString));
    }

    


        $host = $params['host'] ?? '';
        $hosts = explode(',', $host);

        foreach ($hosts as $index => $host) {
            if (isset($params['port'])) {
                $hosts[$index] = $host.':'.$params['port'];
            }
        }

        return new \Zookeeper(implode(',', $hosts));
    }

    /** * @return void */
    public function save(Key $key)
    {
        if ($this->exists($key)) {
            return;
        }

        
Home | Imprint | This part of the site doesn't use cookies.