From 161ae8a78069ce3411aeb1ca91a95c995f04d20c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Wojciech=20Przytu=C5=82a?= Date: Thu, 2 Jan 2025 15:24:34 +0100 Subject: [PATCH] statement: remove per-statement custom timestamp setting A timestamp is something related to a single execution of a statement, not to the statement itself. Also, setting a timestamp on a statement inside the Batch would not set a timestamp on a Batch itself, which has shown to be a pitfall. This commit finishes the migration to the new per-execution timestamp API by removing timestamp settings from statements. --- scylla/src/statement/batch.rs | 12 ------------ scylla/src/statement/mod.rs | 1 - scylla/src/statement/prepared_statement.rs | 13 ------------- scylla/src/statement/query.rs | 13 ------------- 4 files changed, 39 deletions(-) diff --git a/scylla/src/statement/batch.rs b/scylla/src/statement/batch.rs index 209ead20a2..7712ee3f82 100644 --- a/scylla/src/statement/batch.rs +++ b/scylla/src/statement/batch.rs @@ -109,18 +109,6 @@ impl Batch { self.config.tracing } - /// Sets the default timestamp for this batch in microseconds. - /// If not None, it will replace the server side assigned timestamp as default timestamp for - /// all the statements contained in the batch. - pub fn set_timestamp(&mut self, timestamp: Option) { - self.config.timestamp = timestamp - } - - /// Gets the default timestamp for this batch in microseconds. - pub fn get_timestamp(&self) -> Option { - self.config.timestamp - } - /// Set the retry policy for this batch, overriding the one from execution profile if not None. #[inline] pub fn set_retry_policy(&mut self, retry_policy: Option>) { diff --git a/scylla/src/statement/mod.rs b/scylla/src/statement/mod.rs index 33d220ef04..427d7a5f79 100644 --- a/scylla/src/statement/mod.rs +++ b/scylla/src/statement/mod.rs @@ -33,7 +33,6 @@ pub(crate) struct StatementConfig { pub(crate) skip_result_metadata: bool, pub(crate) tracing: bool, - pub(crate) timestamp: Option, pub(crate) request_timeout: Option, pub(crate) history_listener: Option>, diff --git a/scylla/src/statement/prepared_statement.rs b/scylla/src/statement/prepared_statement.rs index 698288f8a1..77aa404465 100644 --- a/scylla/src/statement/prepared_statement.rs +++ b/scylla/src/statement/prepared_statement.rs @@ -370,19 +370,6 @@ impl PreparedStatement { self.config.skip_result_metadata } - /// Sets the default timestamp for this statement in microseconds. - /// If not None, it will replace the server side assigned timestamp as default timestamp - /// If a statement contains a `USING TIMESTAMP` clause, calling this method won't change - /// anything - pub fn set_timestamp(&mut self, timestamp: Option) { - self.config.timestamp = timestamp - } - - /// Gets the default timestamp for this statement in microseconds. - pub fn get_timestamp(&self) -> Option { - self.config.timestamp - } - /// Sets the client-side timeout for this statement. /// If not None, the driver will stop waiting for the request /// to finish after `timeout` passed. diff --git a/scylla/src/statement/query.rs b/scylla/src/statement/query.rs index 58d1ec0099..dbc3e157c3 100644 --- a/scylla/src/statement/query.rs +++ b/scylla/src/statement/query.rs @@ -103,19 +103,6 @@ impl Query { self.config.tracing } - /// Sets the default timestamp for this statement in microseconds. - /// If not None, it will replace the server side assigned timestamp as default timestamp - /// If a statement contains a `USING TIMESTAMP` clause, calling this method won't change - /// anything - pub fn set_timestamp(&mut self, timestamp: Option) { - self.config.timestamp = timestamp - } - - /// Gets the default timestamp for this statement in microseconds. - pub fn get_timestamp(&self) -> Option { - self.config.timestamp - } - /// Sets the client-side timeout for this statement. /// If not None, the driver will stop waiting for the request /// to finish after `timeout` passed.