Pushes one server to cluster.

@param string                       $hostname
@param \Tinderbox\Clickhouse\Server $server

@throws \Tinderbox\Clickhouse\Exceptions\ClusterException
778946
public function addServer(string $hostname, Server $server)
    {
        if (isset($this->servers[$hostname])) {
            throw ClusterException::serverHostnameDuplicate($hostname);
        }

        $this->servers[$hostname] = $server;
    }
962788
public function setHostname(string $hostname)
    {
        $this->hostname = $hostname;

        $this->raw = array_merge($this->raw, ['Hostname' => $hostname]);

        return $this;
    }
196050
private ServerPod []buildClusterServers(ClusterHeartbeat cluster,
                                          int serverCount)
  {
    ArrayList<ServerPod> serversPod = new ArrayList<>();
    
    for (ServerHeartbeat server : cluster.getServers()) {
      ServerPod serverPod = new ServerPod(serversPod.size());
      serversPod.add(serverPod);
      
      // XXX: need to manage seed servers
      // serverPod.setHintServerId(server.getId());
    }
    
    /*
    if (cluster == _serverSelf.getCluster()) {
      if (serversPod.size() < serverCount && ! isServerPresent(serversPod)) {
        ServerPod serverPod = new ServerPod(serversPod.size());
        serversPod.add(serverPod);
      
        serverPod.setServer(_serverSelf);
      }
    }
    */
    
    while (serversPod.size() < serverCount) {
      serversPod.add(new ServerPod(serversPod.size()));
    }
    
    ServerPod []serverArray = new ServerPod[serverCount];
    for (int i = 0; i < serverCount; i++) {
      serverArray[i] = serversPod.get(i);
    }
    
    return serverArray;
  }
1049514
public function execute(Server $server)
    {
        $inTransaction = isset($this->options['session']) && $this->options['session']->isInTransaction();
        if ($inTransaction && isset($this->options['readConcern'])) {
            throw UnsupportedException::readConcernNotSupportedInTransaction();
        }

        return new ChangeStream($this->executeAggregate($server), $this->resumeCallable);
    }
1300439
public function push($fid,$msg){
        if( $this->server->server->exist($fid)){
            $this->server->server->push($fid,$msg);
        }
    }
917087
protected function createClusterClient(string $server): Redis
	{
		[$server, $port] = explode(':', $server, 2);

		$isPersistent = $this->connection->isPersistent();

		$timeout = $this->connection->getTimeout();

		$name = $this->connection->getName();

		$connection = new Connection($server, $port, $isPersistent, $timeout, $name);

		return new static($connection, ['password' => $this->password, 'database' => $this->database]);
	}
95105
protected function buildClusterSeed($server)
    {
        $parameters = [];

        foreach (['database', 'timeout', 'prefix'] as $parameter) {
            if (! empty($server[$parameter])) {
                $parameters[$parameter] = $server[$parameter];
            }
        }

        if (! empty($server['password'])) {
            $parameters['auth'] = $server['password'];
        }

        return $server['host'].':'.$server['port'].'?'.http_build_query($parameters);
    }
619728
public void removeHostName(String hostName) {
		if(logger.isDebugEnabled()) {
			logger.debug("Removing hostname "+ hostName);
		}
		hostNames.remove(hostName);
		if(dnsServerLocator != null) {
			dnsServerLocator.removeLocalHostName(hostName);
		}
	}
379613
public void addVirtualHost(String hostname)
    {
        // Note that null hosts are also added.
        if (!_vhosts.contains(hostname))
        {
            _vhosts.add(hostname);
            _contextName=null;

            if (_httpServer!=null)
            {
                if (_vhosts.size()==1)
                    _httpServer.removeMapping(null,this);
                _httpServer.addMapping(hostname,this);
            }
            _vhostsArray=null;
        }
    }
141582
public function addServers(array $servers): self
    {
        foreach ($servers as $hostname => $server) {
            if (!$server instanceof Server && is_array($server)) {
                $host = $server['host'];
                $port = $server['port'] ?? null;
                $database = $server['database'] ?? null;
                $username = $server['username'] ?? null;
                $password = $server['password'] ?? null;
                $options = $server['options'] ?? null;

                $server = new Server($host, $port, $database, $username, $password, $options);
            }

            /* @var Server $server */
            if (!is_string($hostname)) {
                $hostname = $server->getHost();
            }

            $this->addServer($hostname, $server);
        }

        return $this;
    }
924038
public static function call(Server $server, $input)
    {
        $message = self::readMessage($input);

        if ($message === null) {
            return null;
        }

        /**
         * @var string
         */
        $method = $message->method;
        /**
         * @var \stdClass
         */
        $params = $message->params;

        $result = $server->call($method, $params);

        $response = new FromObject();
        $response->appendJson('result', $result);

        return self::createMessage($response->get());
    }
359172
public function __start(\swoole\Server $server) {
        $pid = posix_getpid();
        file_put_contents($this->options['enable_pid'], $pid);

        if(method_exists($this->callback,'start')) {
            $this->callback->start($server);
        }
    }
562717
public final void addServer(final String server, final int port, int weight) throws IOException {
    if (weight <= 0) {
      throw new IllegalArgumentException("weight<=0");
    }
    this.checkServerPort(server, port);
    this.connect(new InetSocketAddressWrapper(this.newSocketAddress(server, port),
        this.serverOrderCount.incrementAndGet(), weight, null));
  }
1034877
public function deactivateCommand($hostname)
    {
        $domains = $this->findDomainsByHostnamePattern($hostname);
        if (empty($domains)) {
            $this->outputLine('<error>No domain found for hostname-pattern "%s".</error>', [$hostname]);
            $this->quit(1);
        }
        foreach ($domains as $domain) {
            $domain->setActive(false);
            $this->domainRepository->update($domain);
            $this->outputLine('Domain entry "%s" was deactivated.', [$domain->getHostname()]);
        }
    }
9836
protected void setServerName(String serverName) {

        if (CmsStringUtil.isEmpty(serverName) || (WILDCARD.equals(serverName))) {
            m_serverName = WILDCARD;
        } else {
            m_serverName = serverName.trim();
        }
    }
184855
public function move(string $sourceInterface, string $sourceName, string $targetInterface, string $targetName)
    {
        $sourceIndex = $sourceInterface . '-' . $sourceName;
        if (! isset($this->container[$sourceIndex])) {
            throw $this->unbound($sourceIndex);
        }
        $targetIndex = $targetInterface . '-' . $targetName;
        $this->container[$targetIndex] = $this->container[$sourceIndex];
        unset($this->container[$sourceIndex]);
    }
692753
private void updateClusterRoot()
  {
    ArrayList<ServerHeartbeat> serverList = new ArrayList<>();
    
    for (ServerHeartbeat server : _serverSelf.getCluster().getServers()) {
      serverList.add(server);
    }
    
    Collections.sort(serverList, (x,y)->compareClusterRoot(x,y));
    
    UpdatePodBuilder builder = new UpdatePodBuilder();
    builder.name("cluster_root");
    builder.cluster(_serverSelf.getCluster());
    builder.type(PodType.solo);
    builder.depth(16);
    
    for (ServerHeartbeat server : serverList) {
      builder.server(server.getAddress(), server.port());
    }
    
    long sequence = CurrentTime.currentTime();
    
    sequence = Math.max(sequence, _clusterRoot.getSequence() + 1);
    
    builder.sequence(sequence);

    UpdatePod update = builder.build();
    
    updatePodProxy(update);
  }