pub trait Policy {
// Required methods
fn priority(&self) -> &Priority;
fn timeout(&self) -> Option<Duration>;
fn max_retries(&self) -> Option<usize>;
fn sleep_between_retries(&self) -> Option<Duration>;
fn consistency_level(&self) -> &ConsistencyLevel;
}
Expand description
Trait implemented by most policy types; policies that implement this trait typically encompass
an instance of BasePolicy
.
Required Methods§
sourcefn timeout(&self) -> Option<Duration>
fn timeout(&self) -> Option<Duration>
Total transaction timeout for both client and server. The timeout is tracked on the client and also sent to the server along with the transaction in the wire protocol. The client will most likely timeout first, but the server has the capability to timeout the transaction as well.
The timeout is also used as a socket timeout. Default: 0 (no timeout).
sourcefn max_retries(&self) -> Option<usize>
fn max_retries(&self) -> Option<usize>
Maximum number of retries before aborting the current transaction. A retry may be attempted
when there is a network error. If max_retries
is exceeded, the abort will occur even if
the timeout has not yet been exceeded.
sourcefn sleep_between_retries(&self) -> Option<Duration>
fn sleep_between_retries(&self) -> Option<Duration>
Time to sleep between retries. Set to zero to skip sleep. Default: 500ms.
sourcefn consistency_level(&self) -> &ConsistencyLevel
fn consistency_level(&self) -> &ConsistencyLevel
How replicas should be consulted in read operations to provide the desired consistency guarantee.