Struct scylla_proxy::RequestReaction
source · pub struct RequestReaction {
pub to_addressee: Option<Action<RequestFrame, RequestFrame>>,
pub to_sender: Option<Action<RequestFrame, ResponseFrame>>,
pub drop_connection: Option<Option<Duration>>,
pub feedback_channel: Option<UnboundedSender<(RequestFrame, Option<TargetShard>)>>,
}
Fields§
§to_addressee: Option<Action<RequestFrame, RequestFrame>>
§to_sender: Option<Action<RequestFrame, ResponseFrame>>
§drop_connection: Option<Option<Duration>>
§feedback_channel: Option<UnboundedSender<(RequestFrame, Option<TargetShard>)>>
Implementations§
source§impl RequestReaction
impl RequestReaction
pub fn forge_with_error_lazy( gen_error: Box<dyn Fn() -> DbError + Send + Sync>, ) -> Self
sourcepub fn forge_with_error_lazy_delay(
gen_error: Box<dyn Fn() -> DbError + Send + Sync>,
delay: Option<Duration>,
) -> Self
pub fn forge_with_error_lazy_delay( gen_error: Box<dyn Fn() -> DbError + Send + Sync>, delay: Option<Duration>, ) -> Self
A convenient shortcut for forging a various error-type responses, useful e.g. for testing retries. Errors are computed on-demand by the provided closure.
pub fn forge_with_error(error: DbError) -> Self
sourcepub fn forge_with_error_and_message(error: DbError, msg: Option<String>) -> Self
pub fn forge_with_error_and_message(error: DbError, msg: Option<String>) -> Self
A convenient shortcut for forging a various error-type responses, useful e.g. for testing retries.
pub fn forge() -> ResponseForger
Trait Implementations§
source§impl Clone for RequestReaction
impl Clone for RequestReaction
source§fn clone(&self) -> RequestReaction
fn clone(&self) -> RequestReaction
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for RequestReaction
impl Debug for RequestReaction
source§impl Reaction for RequestReaction
impl Reaction for RequestReaction
type Incoming = RequestFrame
type Returning = ResponseFrame
source§fn drop_frame() -> Self
fn drop_frame() -> Self
Drops frame, i.e. passes it into void.
source§fn forge_response(
f: Arc<dyn Fn(Self::Incoming) -> Self::Returning + Send + Sync>,
) -> Self
fn forge_response( f: Arc<dyn Fn(Self::Incoming) -> Self::Returning + Send + Sync>, ) -> Self
Instead of passing the frame to the addressee, returns the forged frame back to the addresser.
source§fn forge_response_with_delay(
time: Duration,
f: Arc<dyn Fn(Self::Incoming) -> Self::Returning + Send + Sync>,
) -> Self
fn forge_response_with_delay( time: Duration, f: Arc<dyn Fn(Self::Incoming) -> Self::Returning + Send + Sync>, ) -> Self
The same as forge_response, but with specified delay.
source§fn drop_connection() -> Self
fn drop_connection() -> Self
Drops the frame AND drops the connection with both the driver and the cluster.
source§fn drop_connection_with_delay(time: Duration) -> Self
fn drop_connection_with_delay(time: Duration) -> Self
The same as drop_connection, but with specified delay.
source§fn with_feedback_when_performed(
self,
tx: UnboundedSender<(Self::Incoming, Option<TargetShard>)>,
) -> Self
fn with_feedback_when_performed( self, tx: UnboundedSender<(Self::Incoming, Option<TargetShard>)>, ) -> Self
Adds sending the matching frame as feedback using the provided channel.
Modifies the existing
Reaction
.Auto Trait Implementations§
impl Freeze for RequestReaction
impl !RefUnwindSafe for RequestReaction
impl Send for RequestReaction
impl Sync for RequestReaction
impl Unpin for RequestReaction
impl !UnwindSafe for RequestReaction
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)