Skip to content

Commit

Permalink
Remove IsolationLevel
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
aljazerzen committed Apr 18, 2024
1 parent ce96a85 commit 57f6771
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 17 deletions.
2 changes: 1 addition & 1 deletion edgedb-tokio/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
16 changes: 0 additions & 16 deletions edgedb-tokio/src/options.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,6 @@ static IDLE_TIMEOUT_RULE: Lazy<RetryRule> = 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
Expand All @@ -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,
}
Expand All @@ -72,19 +62,13 @@ pub(crate) struct RetryRule {
impl Default for TransactionOptions {
fn default() -> TransactionOptions {
TransactionOptions {
isolation: IsolationLevel::Serializable,
read_only: false,
deferrable: false,
}
}
}

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;
Expand Down

0 comments on commit 57f6771

Please sign in to comment.