pub struct Batch(/* private fields */);Expand description
A group of statements that are executed as a single batch. Note: Batches are not supported by the binary protocol version 1.
Implementations§
Source§impl Batch
impl Batch
Sourcepub async fn execute(self) -> Result<CassResult>
pub async fn execute(self) -> Result<CassResult>
Executes this batch.
Sourcepub fn set_consistency(&mut self, consistency: Consistency) -> Result<&mut Self>
pub fn set_consistency(&mut self, consistency: Consistency) -> Result<&mut Self>
Sets the batch’s consistency level
Sourcepub fn set_serial_consistency(
&mut self,
consistency: Consistency,
) -> Result<&mut Self>
pub fn set_serial_consistency( &mut self, consistency: Consistency, ) -> Result<&mut Self>
Sets the batch’s serial consistency level.
Default: Not set
Sourcepub fn set_timestamp(&mut self, timestamp: i64) -> Result<&Self>
pub fn set_timestamp(&mut self, timestamp: i64) -> Result<&Self>
Sets the batch’s timestamp.
Sourcepub fn set_request_timeout(
&mut self,
timeout: Option<Duration>,
) -> Result<&mut Self>
pub fn set_request_timeout( &mut self, timeout: Option<Duration>, ) -> Result<&mut Self>
Sets the batch’s request timeout — how long the driver waits for a
response before failing the batch with LIB_REQUEST_TIMED_OUT.
Some(Duration::from_millis(0)) means no timeout; None disables the
per-batch override so the cluster-level request timeout applies.
This is the ONLY timeout that governs batch execution: the DataStax
C++ driver ignores the per-statement request timeouts set on the
statements added to a batch — cass_session_execute_batch reads the
timeout from the batch itself. Without this, a batch always uses the
cluster default (12s) regardless of any member-statement timeout. See
CHANGES.local.md.
Sourcepub fn set_tracing(&mut self, enabled: bool) -> Result<&mut Self>
pub fn set_tracing(&mut self, enabled: bool) -> Result<&mut Self>
Enables or disables server-side query tracing for this batch
(cass_batch_set_tracing). The batch is a statement type like any
other, so it carries the same tracing aspect a single statement does.
See CHANGES.local.md.
Sourcepub fn set_retry_policy(
&mut self,
retry_policy: RetryPolicy,
) -> Result<&mut Self>
pub fn set_retry_policy( &mut self, retry_policy: RetryPolicy, ) -> Result<&mut Self>
Sets the batch’s retry policy.
Sourcepub fn set_custom_payload(
&mut self,
custom_payload: CustomPayload,
) -> Result<&mut Self>
pub fn set_custom_payload( &mut self, custom_payload: CustomPayload, ) -> Result<&mut Self>
Sets the batch’s custom payload.
Sourcepub fn add_statement(&mut self, statement: Statement) -> Result<&Self>
pub fn add_statement(&mut self, statement: Statement) -> Result<&Self>
Adds a statement to a batch.