Trait stateright::semantics::ConsistencyTester
source · pub trait ConsistencyTester<T, RefObj>where
RefObj: SequentialSpec,
T: Copy,{
// Required methods
fn on_invoke(
&mut self,
thread_id: T,
op: RefObj::Op
) -> Result<&mut Self, String>;
fn on_return(
&mut self,
thread_id: T,
ret: RefObj::Ret
) -> Result<&mut Self, String>;
fn is_consistent(&self) -> bool;
// Provided method
fn on_invret(
&mut self,
thread_id: T,
op: RefObj::Op,
ret: RefObj::Ret
) -> Result<&mut Self, String> { ... }
}
Expand description
An implementation of this trait tests the consistency of a concurrent system with respect to
a “reference sequential specification” SequentialSpec
. The interface for doing so involves
recording operation invocations and returns.
Currently Stateright includes implementations in the form of a LinearizabilityTester
and
SequentialConsistencyTester
.
Required Methods§
sourcefn on_invoke(
&mut self,
thread_id: T,
op: RefObj::Op
) -> Result<&mut Self, String>
fn on_invoke( &mut self, thread_id: T, op: RefObj::Op ) -> Result<&mut Self, String>
Indicates that a thread invoked an operation. Returns Ok(...)
if the
history is valid, even if it is not consistent.
sourcefn on_return(
&mut self,
thread_id: T,
ret: RefObj::Ret
) -> Result<&mut Self, String>
fn on_return( &mut self, thread_id: T, ret: RefObj::Ret ) -> Result<&mut Self, String>
Indicates that a thread’s earlier operation invocation returned. Returns
Ok(...)
if the history is valid, even if it is not consistent.
sourcefn is_consistent(&self) -> bool
fn is_consistent(&self) -> bool
Indicates whether the recorded history is consistent with the semantics expected by the tester.