Enum stronghold_rlu::rlu::RLUStrategy
source · [−]pub enum RLUStrategy {
Abort,
Retry,
RetryWithBreaker(BusyBreaker),
}
Expand description
Additional configuration for RLU
. The internal execution
can be either crate::RLUStrategy::Abort
, if operation failed, crate::RLUStrategy::Retry
again
an unlimited number of times, or crate::RLUStrategy::RetryWithBreaker
with a busy breaker.
Variants
Abort
Abort execution on failure
Retry
Retry executing the calling function repeatedly until it succeeds. A possible used case for this might be to check for a record again and again, until the corresponding write has occured. The number of internal retries should be really small in order to avoid any deadlocks.
RetryWithBreaker(BusyBreaker)
Try with a exponential breaker. Using a breaker that trips after an configurable amount of time is a trade-off between correctness of writes and code that tries to access a value that may not exists yet, but will be written by a future call into RLU augmented data structures. One such situation might occur, when integrating RLU into eg. a Cache data structure, where data is written and read from concurrently. Another calling process might assume the existence of a value, but writes to it might not be finished but will eventually land. This case can be mitigated by a “normal” retry, as the write can eventually be retrieved to be read.
If it is uncertain, that a write has occured a retry with the breaker might give enough time to wait for the write, while not creating an infinite busy wait on the calling thread.
Trait Implementations
sourceimpl Clone for RLUStrategy
impl Clone for RLUStrategy
sourcefn clone(&self) -> RLUStrategy
fn clone(&self) -> RLUStrategy
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
Auto Trait Implementations
impl RefUnwindSafe for RLUStrategy
impl Send for RLUStrategy
impl Sync for RLUStrategy
impl Unpin for RLUStrategy
impl UnwindSafe for RLUStrategy
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more