當前位置: 首頁>>代碼示例>>Python>>正文


Python Topology.get_arbiters方法代碼示例

本文整理匯總了Python中pymongo.topology.Topology.get_arbiters方法的典型用法代碼示例。如果您正苦於以下問題:Python Topology.get_arbiters方法的具體用法?Python Topology.get_arbiters怎麽用?Python Topology.get_arbiters使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在pymongo.topology.Topology的用法示例。


在下文中一共展示了Topology.get_arbiters方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: MongoClient

# 需要導入模塊: from pymongo.topology import Topology [as 別名]
# 或者: from pymongo.topology.Topology import get_arbiters [as 別名]

#.........這裏部分代碼省略.........

        Returns ``None`` if this client is not connected to a replica set,
        there is no primary, or this client was created without the
        `replicaSet` option.

        .. versionadded:: 3.0
           MongoClient gained this property in version 3.0 when
           MongoReplicaSetClient's functionality was merged in.
        """
        return self._topology.get_primary()

    @property
    def secondaries(self):
        """The secondary members known to this client.

        A sequence of (host, port) pairs. Empty if this client is not
        connected to a replica set, there are no visible secondaries, or this
        client was created without the `replicaSet` option.

        .. versionadded:: 3.0
           MongoClient gained this property in version 3.0 when
           MongoReplicaSetClient's functionality was merged in.
        """
        return self._topology.get_secondaries()

    @property
    def arbiters(self):
        """Arbiters in the replica set.

        A sequence of (host, port) pairs. Empty if this client is not
        connected to a replica set, there are no arbiters, or this client was
        created without the `replicaSet` option.
        """
        return self._topology.get_arbiters()

    @property
    def is_primary(self):
        """If this client if connected to a server that can accept writes.

        True if the current server is a standalone, mongos, or the primary of
        a replica set.
        """
        return self._server_property('is_writable', False)

    @property
    def is_mongos(self):
        """If this client is connected to mongos.
        """
        return self._server_property('server_type') == SERVER_TYPE.Mongos

    @property
    def max_pool_size(self):
        """The maximum number of sockets the pool will open concurrently.

        When the pool has reached `max_pool_size`, operations block waiting for
        a socket to be returned to the pool. If ``waitQueueTimeoutMS`` is set,
        a blocked operation will raise :exc:`~pymongo.errors.ConnectionFailure`
        after a timeout. By default ``waitQueueTimeoutMS`` is not set.
        """
        return self.__options.pool_options.max_pool_size

    @property
    def nodes(self):
        """Set of all currently connected servers.

        .. warning:: When connected to a replica set the value of :attr:`nodes`
開發者ID:ToontownBattlefront,項目名稱:Toontown-Battlefront,代碼行數:70,代碼來源:mongo_client.py


注:本文中的pymongo.topology.Topology.get_arbiters方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。