From ce96a85b1ade2fa562e5f72db0e4efdd9c934107 Mon Sep 17 00:00:00 2001 From: Dhghomon <56599343+Dhghomon@users.noreply.github.com> Date: Thu, 1 Feb 2024 08:41:38 +0900 Subject: [PATCH 1/2] Add IsolationLevel to pub use statement --- edgedb-tokio/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/edgedb-tokio/src/lib.rs b/edgedb-tokio/src/lib.rs index 8bbcf2c7..fdca2288 100644 --- a/edgedb-tokio/src/lib.rs +++ b/edgedb-tokio/src/lib.rs @@ -142,7 +142,7 @@ pub use builder::{Builder, Config, InstanceName, ClientSecurity}; pub use credentials::TlsSecurity; pub use client::Client; pub use errors::Error; -pub use options::{TransactionOptions, RetryOptions, RetryCondition}; +pub use options::{TransactionOptions, RetryOptions, RetryCondition, IsolationLevel}; pub use state::{GlobalsDelta, ConfigDelta}; pub use transaction::Transaction; From 57f67710312bae9e7ed43fa200a6b9b55577afb5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alja=C5=BE=20Mur=20Er=C5=BEen?= Date: Thu, 18 Apr 2024 17:29:14 +0200 Subject: [PATCH 2/2] Remove IsolationLevel At the moment, isolation level of a transaction can only be SERIALIZABLE. It can be specified when opening a connection, but if it is not, it will default to SERIALIZABLE. There is also no plans to support other level soon. IsolationLevel thus serves no purpse and also cannot be set outside of this crate, since it is not public. So there is no harm in removing it. When/if we implement other levels, we can revert this commit. --- edgedb-tokio/src/lib.rs | 2 +- edgedb-tokio/src/options.rs | 16 ---------------- 2 files changed, 1 insertion(+), 17 deletions(-) diff --git a/edgedb-tokio/src/lib.rs b/edgedb-tokio/src/lib.rs index fdca2288..8bbcf2c7 100644 --- a/edgedb-tokio/src/lib.rs +++ b/edgedb-tokio/src/lib.rs @@ -142,7 +142,7 @@ pub use builder::{Builder, Config, InstanceName, ClientSecurity}; pub use credentials::TlsSecurity; pub use client::Client; pub use errors::Error; -pub use options::{TransactionOptions, RetryOptions, RetryCondition, IsolationLevel}; +pub use options::{TransactionOptions, RetryOptions, RetryCondition}; pub use state::{GlobalsDelta, ConfigDelta}; pub use transaction::Transaction; diff --git a/edgedb-tokio/src/options.rs b/edgedb-tokio/src/options.rs index 1e31aebf..9fb18df0 100644 --- a/edgedb-tokio/src/options.rs +++ b/edgedb-tokio/src/options.rs @@ -18,15 +18,6 @@ static IDLE_TIMEOUT_RULE: Lazy = Lazy::new(|| RetryRule { }); -/// Transaction isolation level -/// -/// Only single isolation level is supported for now -#[derive(Debug, Clone)] -pub enum IsolationLevel { - /// Serializable isolation level - Serializable, -} - /// Specific condition for retrying queries /// /// This is used for fine-grained control for retrying queries and transactions @@ -45,7 +36,6 @@ pub enum RetryCondition { /// [`with_transaction_options`](crate::Client::with_transaction_options). #[derive(Debug, Clone)] pub struct TransactionOptions { - isolation: IsolationLevel, read_only: bool, deferrable: bool, } @@ -72,7 +62,6 @@ pub(crate) struct RetryRule { impl Default for TransactionOptions { fn default() -> TransactionOptions { TransactionOptions { - isolation: IsolationLevel::Serializable, read_only: false, deferrable: false, } @@ -80,11 +69,6 @@ impl Default for TransactionOptions { } impl TransactionOptions { - /// Set isolation level for the transaction - pub fn isolation(mut self, isolation: IsolationLevel) -> Self { - self.isolation = isolation; - self - } /// Set whether transaction is read-only pub fn read_only(mut self, read_only: bool) -> Self { self.read_only = read_only;