Returns information for all indexes for this collection using the
listIndexes command.

@param Server $server
@return IndexInfoIteratorIterator
@throws DriverRuntimeException for other driver errors (e.g. connection errors)
192930
private function executeCommand(Server $server)
    {
        $cmd = ['listIndexes' => $this->collectionName];

        if (isset($this->options['maxTimeMS'])) {
            $cmd['maxTimeMS'] = $this->options['maxTimeMS'];
        }

        try {
            $cursor = $server->executeCommand($this->databaseName, new Command($cmd), $this->createOptions());
        } catch (DriverRuntimeException $e) {
            /* The server may return an error if the collection does not exist.
             * Check for possible error codes (see: SERVER-20463) and return an
             * empty iterator instead of throwing.
             */
            if ($e->getCode() === self::$errorCodeNamespaceNotFound || $e->getCode() === self::$errorCodeDatabaseNotFound) {
                return new IndexInfoIteratorIterator(new EmptyIterator);
            }

            throw $e;
        }

        $cursor->setTypeMap(['root' => 'array', 'document' => 'array']);

        return new IndexInfoIteratorIterator(new CachingIterator($cursor));
    }
1218149
private function createCommand(Server $server)
    {
        $cmd = [
            'mapReduce' => $this->collectionName,
            'map' => $this->map,
            'reduce' => $this->reduce,
            'out' => $this->out,
        ];

        foreach (['finalize', 'jsMode', 'limit', 'maxTimeMS', 'verbose'] as $option) {
            if (isset($this->options[$option])) {
                $cmd[$option] = $this->options[$option];
            }
        }

        foreach (['collation', 'query', 'scope', 'sort'] as $option) {
            if (isset($this->options[$option])) {
                $cmd[$option] = (object) $this->options[$option];
            }
        }

        if (isset($this->options['bypassDocumentValidation']) && \MongoDB\server_supports_feature($server, self::$wireVersionForDocumentLevelValidation)) {
            $cmd['bypassDocumentValidation'] = $this->options['bypassDocumentValidation'];
        }

        return new Command($cmd);
    }
532726
public function initialize(Server $server)
    {
        $this->server = $server;
        $server->on('method:GET', [$this, 'httpGet']);
        $server->on('method:OPTIONS', [$this, 'httpOptions']);
        $server->on('method:HEAD', [$this, 'httpHead']);
        $server->on('method:DELETE', [$this, 'httpDelete']);
        $server->on('method:PROPFIND', [$this, 'httpPropFind']);
        $server->on('method:PROPPATCH', [$this, 'httpPropPatch']);
        $server->on('method:PUT', [$this, 'httpPut']);
        $server->on('method:MKCOL', [$this, 'httpMkcol']);
        $server->on('method:MOVE', [$this, 'httpMove']);
        $server->on('method:COPY', [$this, 'httpCopy']);
        $server->on('method:REPORT', [$this, 'httpReport']);

        $server->on('propPatch', [$this, 'propPatchProtectedPropertyCheck'], 90);
        $server->on('propPatch', [$this, 'propPatchNodeUpdate'], 200);
        $server->on('propFind', [$this, 'propFind']);
        $server->on('propFind', [$this, 'propFindNode'], 120);
        $server->on('propFind', [$this, 'propFindLate'], 200);

        $server->on('exception', [$this, 'exception']);
    }
275855
public function parseCliArgs($server = null)
    {
        $server || $server = $this->_SERVER;

        if (!isset($server['argv'])) {
            throw new \Exception('$_SERVER["argv"] is not available');
        }

        $args = array_slice($server['argv'], 1);

        return $args ? '/' . implode('/', $args) : '';
    }
207730
protected function getIteratorByIndex($index = 0)
    {
        $runningCount = 0;
        foreach ($this->getArrayIterator() as $innerIt) {
            $count = count($innerIt);
            if ($index < $runningCount + $count) {
                return [$innerIt, $index - $runningCount];
            }
            $runningCount += $count;
        }

        return null;
    }
1371473
private function determineHeader(array $server): MapInterface
    {
        $header = new Map();

        foreach ($server as $name => $value) {
            if (strpos($name, 'HTTP_') === 0) {
                $name = substr($name, 5);
                $name = explode('_', $name);
                $name = array_map('strtolower', $name);
                $name = array_map('ucfirst', $name);
                $name = implode('-', $name);

                $header->set($name, $value);
            }
        }

        return new ReadOnlyMap($header);
    }
114076
protected function getServer(string $serverType): string
    {
        if (in_array($serverType, array_keys(config('swoole.servers')), true)) {
            return config("swoole.servers.{$serverType}.driver");
        }

        throw new DomainException("The server type: [{$serverType}] not found");
    }
56681
public function getConnection($connection, $server = null)
    {
        $connectionKey = $this->credentials->sanitizeConnection($connection, $server);
        $handle = $connectionKey->toHandle();

        $connections = $this->getConnections();
        if (!$connections->has($handle)) {
            throw new ConnectionException('Invalid connection: '.$handle);
        }

        return $connections[$handle];
    }
1161105
public function connect(array $servers)
	{
		$memcache = $this->getEngine();

		// For each server in the array, we'll just extract the configuration and add
		// the server to the Memcached connection. Once we have added all of these
		// servers we'll verify the connection is successful and return it back.
		foreach ($servers as $server)
		{
			$memcache->addServer(
				$server['host'], $server['port'], $server['weight']
			);
		}

		if ($memcache->getVersion() === false)
		{
			throw new RuntimeException('Could not establish Memcached connection.');
		}

		// Memcahed has no list keys, we do our own accounting, initialise key index
		if ($memcache->get($this->options['hash'] . '-index') === false)
		{
			$empty = array();
			self::$_db->set($this->oprions['hash'] . '-index', $empty, $this->options['compress'], 0);
		}

		return $memcache;
	}
321456
protected static function connect(array $servers, $memcache = null)
    {
        if (!$memcache) {
            $memcache = new \Memcached();
        }

        foreach ($servers as $server) {
            $memcache->addServer($server['host'], $server['port'], $server['weight']);
        }

        if ($memcache->getVersion() === false) {
            throw new \RuntimeException('could not establish memcached connection!');
        }

        return $memcache;
    }
555389
public List<ServerRedirect> getServerMappings() {
        ArrayList<ServerRedirect> servers = new ArrayList<ServerRedirect>();
        try {
            JSONObject response = new JSONObject(doGet(BASE_SERVER, null));
            JSONArray serverArray = response.getJSONArray("servers");

            for (int i = 0; i < serverArray.length(); i++) {
                JSONObject jsonServer = serverArray.getJSONObject(i);
                ServerRedirect server = getServerRedirectFromJSON(jsonServer);
                if (server != null) {
                    servers.add(server);
                }
            }
        } catch (Exception e) {
            e.printStackTrace();
            return null;
        }
        return servers;
    }
278580
protected static function getWebhooksURL($server)
    {
        if ($server === static::USE_PRODUCTION_SERVER) {
            $url = 'https://api.authorize.net/rest/v1/';
        } else if ($server === static::USE_DEVELOPMENT_SERVER) {
            $url = 'https://apitest.authorize.net/rest/v1/';
        } else {
            throw new AuthnetInvalidServerException('You did not provide a valid server.');
        }
        return $url;
    }
847274
public function server($server = '')
    {
        if (empty($server)) {
            throw new \Exception('Server is not specified');
        }
        $allServers = config('vesta.servers');

        if (!isset($allServers[$server])) {
            throw new \Exception('Specified server not found in config');
        }

        if ($this->keysCheck($server, $allServers)) {
            throw new \Exception('Specified server config does not contain host or key');
        }

        $this->key = (string) $allServers[$server]['key'];
        $this->host = (string) $allServers[$server]['host'];

        return $this;
    }
1133338
def index(self, req, drivers):
        
        result = []
        for driver in drivers:
            result.append(driver.list_network(req.params))
        data = {
                'action': "index",
                'controller': "network",
                'cloud': req.environ['calplus.cloud'],
                'result': result
        }
        return data
396834
public function serverErrors($driver = ''): Collection
    {
        $errors = Collection::make([
            $this->databaseDriverErrors($driver),
            $this->checkPhpExtension('mbstring'),
            $this->checkPhpExtension('iconv'),
            $this->checkPhpExtension('pcre'),
            $this->checkPhpExtension('session'),
            $this->checkPhpExtension('xml'),
            $this->checkPhpFunction('parse_ini_file'),
        ]);

        return $errors
            ->flatten()
            ->filter();
    }
124352
private String[] getMappedServers(final ServerInformationCatalog serverInformationCatalog,
            final Map<String, String> mappedServers) {

        if (serverInformationCatalog.containsServer(HadoopResource.DEFAULT_CLUSTERREFERENCE)) {
            mappedServers.put("(default)", HadoopResource.DEFAULT_CLUSTERREFERENCE);
        }

        final String[] serverNames = serverInformationCatalog.getServerNames();
        for (int i = 0; i < serverNames.length; i++) {
            final String serverName = serverNames[i];
            if (!serverName.equals(HadoopResource.DEFAULT_CLUSTERREFERENCE)) {
                mappedServers.put(serverName, serverName);
            }
        }
        return mappedServers.keySet().toArray(new String[serverNames.length]);
    }
829407
public function getByServer($serverName)
    {
        if(isset($this->cache[$serverName]))
        {
            return $this->cache[$serverName];
        }
        $namespace = ServerManage::getServer($serverName)->getConfig()['namespace'];
        if('\\' !== substr($namespace, -1, 1))
        {
            $namespace .= '\\';
        }
        $result = [];
        foreach(AnnotationManager::getAnnotationPoints($this->controllerAnnotationClass, 'Class') as $className => $option)
        {
            if(Text::startwith($option['class'], $namespace))
            {
                $result[$option['class']] = $option;
            }
        }
        $this->cache[$serverName] = $result;
        return $result;
    }