Esempio n. 1
0
 def _set_serial_consistency_level(self, serial_consistency_level):
     if (serial_consistency_level is not None and
             not ConsistencyLevel.is_serial(serial_consistency_level)):
         raise ValueError(
             "serial_consistency_level must be either ConsistencyLevel.SERIAL "
             "or ConsistencyLevel.LOCAL_SERIAL")
     self._serial_consistency_level = serial_consistency_level
Esempio n. 2
0
 def _set_serial_consistency_level(self, serial_consistency_level):
     if (serial_consistency_level is not None and
             not ConsistencyLevel.is_serial(serial_consistency_level)):
         raise ValueError(
             "serial_consistency_level must be either ConsistencyLevel.SERIAL "
             "or ConsistencyLevel.LOCAL_SERIAL")
     self._serial_consistency_level = serial_consistency_level
Esempio n. 3
0
 def on_unavailable(self, query, consistency, required_replicas, alive_replicas, retry_num):
     if retry_num != 0:
         return self.RETHROW, None
     elif ConsistencyLevel.is_serial(consistency):
         # failed at the paxos phase of a LWT, retry on the next host
         return self.RETRY_NEXT_HOST, None
     else:
         return self._pick_consistency(alive_replicas)
Esempio n. 4
0
 def on_read_timeout(self, query, consistency, required_responses,
                     received_responses, data_retrieved, retry_num):
     if retry_num != 0:
         return self.RETHROW, None
     elif ConsistencyLevel.is_serial(consistency):
         # Downgrading does not make sense for a CAS read query
         return self.RETHROW, None
     elif received_responses < required_responses:
         return self._pick_consistency(received_responses)
     elif not data_retrieved:
         return self.RETRY, consistency
     else:
         return self.RETHROW, None