Struct zksync_dal::Connection
source · pub struct Connection<'a, DB>where
DB: DbMarker,{ /* private fields */ }
Expand description
Storage processor is the main storage interaction point. It holds down the connection (either direct or pooled) to the database and provide methods to obtain different storage schema.
Implementations§
source§impl<'a, DB> Connection<'a, DB>where
DB: DbMarker,
impl<'a, DB> Connection<'a, DB>where
DB: DbMarker,
sourcepub async fn start_transaction(
&mut self,
) -> Result<Connection<'_, DB>, DalError>
pub async fn start_transaction( &mut self, ) -> Result<Connection<'_, DB>, DalError>
Starts a transaction or a new checkpoint within the current transaction.
sourcepub fn transaction_builder(
&mut self,
) -> Result<TransactionBuilder<'_, 'a, DB>, DalError>
pub fn transaction_builder( &mut self, ) -> Result<TransactionBuilder<'_, 'a, DB>, DalError>
Starts building a new transaction with custom settings. Unlike Self::start_transaction()
, this method
will error if called from a transaction; it is a logical error to change transaction settings in the middle of it.
sourcepub fn in_transaction(&self) -> bool
pub fn in_transaction(&self) -> bool
Checks if the Connection
is currently within database transaction.
sourcepub async fn commit(self) -> Result<(), DalError>
pub async fn commit(self) -> Result<(), DalError>
Commits a transactional connection (one which was created by calling Self::start_transaction()
).
If this connection is not transactional, returns an error.
sourcepub async fn rollback(self) -> Result<(), DalError>
pub async fn rollback(self) -> Result<(), DalError>
Rolls back a transactional connection (one which was created by calling Self::start_transaction()
).
If this connection is not transactional, returns an error.
pub fn conn(&mut self) -> &mut PgConnection
Trait Implementations§
source§impl<'a> CoreDal<'a> for Connection<'a, Core>
impl<'a> CoreDal<'a> for Connection<'a, Core>
fn transactions_dal(&mut self) -> TransactionsDal<'_, 'a>
fn transactions_web3_dal(&mut self) -> TransactionsWeb3Dal<'_, 'a>
fn tee_verifier_input_producer_dal( &mut self, ) -> TeeVerifierInputProducerDal<'_, 'a>
fn blocks_dal(&mut self) -> BlocksDal<'_, 'a>
fn blocks_web3_dal(&mut self) -> BlocksWeb3Dal<'_, 'a>
fn consensus_dal(&mut self) -> ConsensusDal<'_, 'a>
fn eth_sender_dal(&mut self) -> EthSenderDal<'_, 'a>
fn events_dal(&mut self) -> EventsDal<'_, 'a>
fn events_web3_dal(&mut self) -> EventsWeb3Dal<'_, 'a>
fn factory_deps_dal(&mut self) -> FactoryDepsDal<'_, 'a>
fn storage_web3_dal(&mut self) -> StorageWeb3Dal<'_, 'a>
fn storage_logs_dal(&mut self) -> StorageLogsDal<'_, 'a>
fn storage_logs_dedup_dal(&mut self) -> StorageLogsDedupDal<'_, 'a>
fn tokens_dal(&mut self) -> TokensDal<'_, 'a>
fn tokens_web3_dal(&mut self) -> TokensWeb3Dal<'_, 'a>
fn contract_verification_dal(&mut self) -> ContractVerificationDal<'_, 'a>
fn protocol_versions_dal(&mut self) -> ProtocolVersionsDal<'_, 'a>
fn protocol_versions_web3_dal(&mut self) -> ProtocolVersionsWeb3Dal<'_, 'a>
fn sync_dal(&mut self) -> SyncDal<'_, 'a>
fn proof_generation_dal(&mut self) -> ProofGenerationDal<'_, 'a>
fn tee_proof_generation_dal(&mut self) -> TeeProofGenerationDal<'_, 'a>
fn system_dal(&mut self) -> SystemDal<'_, 'a>
fn snapshots_dal(&mut self) -> SnapshotsDal<'_, 'a>
fn snapshots_creator_dal(&mut self) -> SnapshotsCreatorDal<'_, 'a>
fn snapshot_recovery_dal(&mut self) -> SnapshotRecoveryDal<'_, 'a>
fn pruning_dal(&mut self) -> PruningDal<'_, 'a>
fn data_availability_dal(&mut self) -> DataAvailabilityDal<'_, 'a>
fn vm_runner_dal(&mut self) -> VmRunnerDal<'_, 'a>
fn base_token_dal(&mut self) -> BaseTokenDal<'_, 'a>
Auto Trait Implementations§
impl<'a, DB> Freeze for Connection<'a, DB>
impl<'a, DB> !RefUnwindSafe for Connection<'a, DB>
impl<'a, DB> Send for Connection<'a, DB>
impl<'a, DB> Sync for Connection<'a, DB>
impl<'a, DB> Unpin for Connection<'a, DB>where
DB: Unpin,
impl<'a, DB> !UnwindSafe for Connection<'a, DB>
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
source§impl<T> FutureExt for T
impl<T> FutureExt for T
source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T
in a tonic::Request