#NEWLINE# def endure( self , key , persist_to = ( - 1 ) , replicate_to = ( - 1 ) , cas = 0 , check_removed = False , timeout = 5.0 , interval = 0.01 ) : #NEWLINE# #INDENT# 'Wait until a key has been distributed to one or more nodes\n\n        By default, when items are stored to Couchbase, the operation is\n        considered successful if the vBucket master (i.e. the "primary"\n        node) for the key has successfully stored the item in its\n        memory.\n\n        In most situations, this is sufficient to assume that the item\n        has successfully been stored. However the possibility remains\n        that the "master" server will go offline as soon as it sends\n        back the successful response and the data is lost.\n\n        The ``endure`` function allows you to provide stricter criteria\n        for success. The criteria may be expressed in terms of number of\n        nodes for which the item must exist in that node\'s RAM and/or on\n        that node\'s disk. Ensuring that an item exists in more than one\n        place is a safer way to guarantee against possible data loss.\n\n        We call these requirements `Durability Constraints`, and thus\n        the method is called `endure`.\n\n        :param string key: The key to endure.\n        :param int persist_to: The minimum number of nodes which must\n            contain this item on their disk before this function\n            returns. Ensure that you do not specify too many nodes;\n            otherwise this function will fail. Use the\n            :attr:`server_nodes` to determine how many nodes exist in\n            the cluster.\n\n            The maximum number of nodes an item can reside on is\n            currently fixed to 4 (i.e. the "master" node, and up to\n            three "replica" nodes). This limitation is current as of\n            Couchbase Server version 2.1.0.\n\n            If this parameter is set to a negative value, the maximum\n            number of possible nodes the key can reside on will be used.\n\n        :param int replicate_to: The minimum number of replicas which\n            must contain this item in their memory for this method to\n            succeed. As with ``persist_to``, you may specify a negative\n            value in which case the requirement will be set to the\n            maximum number possible.\n\n        :param float timeout: A timeout value in seconds before this\n            function fails with an exception. Typically it should take\n            no longer than several milliseconds on a functioning cluster\n            for durability requirements to be satisfied (unless\n            something has gone wrong).\n\n        :param float interval: The polling interval in seconds to use\n            for checking the key status on the respective nodes.\n            Internally, ``endure`` is implemented by polling each server\n            individually to see if the key exists on that server\'s disk\n            and memory. Once the status request is sent to all servers,\n            the client will check if their replies are satisfactory; if\n            they are then this function succeeds, otherwise the client\n            will wait a short amount of time and try again. This\n            parameter sets this "wait time".\n\n        :param bool check_removed: This flag inverts the check. Instead\n            of checking that a given key *exists* on the nodes, this\n            changes the behavior to check that the key is *removed* from\n            the nodes.\n\n        :param long cas: The CAS value to check against. It is possible\n            for an item to exist on a node but have a CAS value from a\n            prior operation. Passing the CAS ensures that only replies\n            from servers with a CAS matching this parameter are accepted.\n\n        :return: A :class:`~.OperationResult`\n        :raise: see :meth:`upsert` and :meth:`get` for possible errors\n\n        .. seealso:: :meth:`upsert`, :meth:`endure_multi`\n        ' #NEWLINE# kv = { #NEWLINE# #INDENT# key : cas , #NEWLINE# #UNINDENT# } #NEWLINE# rvs = self . endure_multi ( keys = kv , persist_to = replicate_to , replicate_to = replicate_to , check_removed = check_removed , timeout = timeout , interval = interval ) #NEWLINE# return rvs [ key ]