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,

source

pub async fn start_transaction( &mut self, ) -> Result<Connection<'_, DB>, DalError>

Starts a transaction or a new checkpoint within the current transaction.

source

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.

source

pub fn in_transaction(&self) -> bool

Checks if the Connection is currently within database transaction.

source

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.

source

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.

source

pub fn conn(&mut self) -> &mut PgConnection

source

pub fn conn_and_tags(&mut self) -> (&mut PgConnection, Option<&ConnectionTags>)

Trait Implementations§

source§

impl<'a> CoreDal<'a> for Connection<'a, Core>

source§

fn transactions_dal(&mut self) -> TransactionsDal<'_, 'a>

source§

fn transactions_web3_dal(&mut self) -> TransactionsWeb3Dal<'_, 'a>

source§

fn tee_verifier_input_producer_dal( &mut self, ) -> TeeVerifierInputProducerDal<'_, 'a>

source§

fn blocks_dal(&mut self) -> BlocksDal<'_, 'a>

source§

fn blocks_web3_dal(&mut self) -> BlocksWeb3Dal<'_, 'a>

source§

fn consensus_dal(&mut self) -> ConsensusDal<'_, 'a>

source§

fn eth_sender_dal(&mut self) -> EthSenderDal<'_, 'a>

source§

fn events_dal(&mut self) -> EventsDal<'_, 'a>

source§

fn events_web3_dal(&mut self) -> EventsWeb3Dal<'_, 'a>

source§

fn factory_deps_dal(&mut self) -> FactoryDepsDal<'_, 'a>

source§

fn storage_web3_dal(&mut self) -> StorageWeb3Dal<'_, 'a>

source§

fn storage_logs_dal(&mut self) -> StorageLogsDal<'_, 'a>

source§

fn storage_logs_dedup_dal(&mut self) -> StorageLogsDedupDal<'_, 'a>

source§

fn tokens_dal(&mut self) -> TokensDal<'_, 'a>

source§

fn tokens_web3_dal(&mut self) -> TokensWeb3Dal<'_, 'a>

source§

fn contract_verification_dal(&mut self) -> ContractVerificationDal<'_, 'a>

source§

fn protocol_versions_dal(&mut self) -> ProtocolVersionsDal<'_, 'a>

source§

fn protocol_versions_web3_dal(&mut self) -> ProtocolVersionsWeb3Dal<'_, 'a>

source§

fn sync_dal(&mut self) -> SyncDal<'_, 'a>

source§

fn proof_generation_dal(&mut self) -> ProofGenerationDal<'_, 'a>

source§

fn tee_proof_generation_dal(&mut self) -> TeeProofGenerationDal<'_, 'a>

source§

fn system_dal(&mut self) -> SystemDal<'_, 'a>

source§

fn snapshots_dal(&mut self) -> SnapshotsDal<'_, 'a>

source§

fn snapshots_creator_dal(&mut self) -> SnapshotsCreatorDal<'_, 'a>

source§

fn snapshot_recovery_dal(&mut self) -> SnapshotRecoveryDal<'_, 'a>

source§

fn pruning_dal(&mut self) -> PruningDal<'_, 'a>

source§

fn data_availability_dal(&mut self) -> DataAvailabilityDal<'_, 'a>

source§

fn vm_runner_dal(&mut self) -> VmRunnerDal<'_, 'a>

source§

fn base_token_dal(&mut self) -> BaseTokenDal<'_, 'a>

source§

impl<'a, DB> Debug for Connection<'a, DB>
where DB: Debug + DbMarker,

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more

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> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> FutureExt for T

source§

fn with_context(self, otel_cx: Context) -> WithContext<Self>

Attaches the provided Context to this type, returning a WithContext wrapper. Read more
source§

fn with_current_context(self) -> WithContext<Self>

Attaches the current Context to this type, returning a WithContext wrapper. Read more
source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> IntoEither for T

source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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 more
source§

impl<T> IntoRequest<T> for T

source§

fn into_request(self) -> Request<T>

Wrap the input message T in a tonic::Request
source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

source§

fn vzip(self) -> V

source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more