pub struct Acquired<T> { /* private fields */ }Expand description
A wrapper indicating that a resource has been acquired with a database lock.
This type is returned by database operations that lock rows for update
(e.g., SELECT ... FOR UPDATE). It serves as a compile-time marker that
the wrapped resource was properly locked before being returned, ensuring
that subsequent modifications are safe from race conditions.
§Usage
When you need to modify a database record, first acquire it using a locking
query method. The returned Acquired<T> guarantees the row is locked for
the duration of the transaction.
ⓘ
// Acquire a quote with a row lock
let mut quote: Acquired<MintQuote> = tx.get_mint_quote_for_update("e_id).await?;
// Safely modify the quote (row is locked)
quote.state = QuoteState::Paid;
// Persist the changes
tx.update_mint_quote(&mut quote).await?;§Deref Behavior
Acquired<T> implements Deref and DerefMut, allowing transparent access
to the inner value’s methods and fields.
Implementations§
Trait Implementations§
Auto Trait Implementations§
impl<T> Freeze for Acquired<T>where
T: Freeze,
impl<T> RefUnwindSafe for Acquired<T>where
T: RefUnwindSafe,
impl<T> Send for Acquired<T>where
T: Send,
impl<T> Sync for Acquired<T>where
T: Sync,
impl<T> Unpin for Acquired<T>where
T: Unpin,
impl<T> UnsafeUnpin for Acquired<T>where
T: UnsafeUnpin,
impl<T> UnwindSafe for Acquired<T>where
T: UnwindSafe,
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
Mutably borrows from an owned value. Read more
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<S, T> ScoreLookUp for Twhere
S: ScoreLookUp,
T: Deref<Target = S>,
impl<S, T> ScoreLookUp for Twhere
S: ScoreLookUp,
T: Deref<Target = S>,
Source§type ScoreParams = <S as ScoreLookUp>::ScoreParams
type ScoreParams = <S as ScoreLookUp>::ScoreParams
A configurable type which should contain various passed-in parameters for configuring the scorer,
on a per-routefinding-call basis through to the scorer methods,
which are used to determine the parameters for the suitability of channels for use.
Source§fn channel_penalty_msat(
&self,
candidate: &CandidateRouteHop<'_>,
usage: ChannelUsage,
score_params: &<T as ScoreLookUp>::ScoreParams,
) -> u64
fn channel_penalty_msat( &self, candidate: &CandidateRouteHop<'_>, usage: ChannelUsage, score_params: &<T as ScoreLookUp>::ScoreParams, ) -> u64
Returns the fee in msats willing to be paid to avoid routing
send_amt_msat through the
given channel in the direction from source to target. Read moreSource§impl<S, T> ScoreUpdate for Twhere
S: ScoreUpdate,
T: DerefMut<Target = S>,
impl<S, T> ScoreUpdate for Twhere
S: ScoreUpdate,
T: DerefMut<Target = S>,
Source§fn payment_path_failed(
&mut self,
path: &Path,
short_channel_id: u64,
duration_since_epoch: Duration,
)
fn payment_path_failed( &mut self, path: &Path, short_channel_id: u64, duration_since_epoch: Duration, )
Handles updating channel penalties after failing to route through a channel.
Source§fn payment_path_successful(
&mut self,
path: &Path,
duration_since_epoch: Duration,
)
fn payment_path_successful( &mut self, path: &Path, duration_since_epoch: Duration, )
Handles updating channel penalties after successfully routing along a path.
Source§fn probe_failed(
&mut self,
path: &Path,
short_channel_id: u64,
duration_since_epoch: Duration,
)
fn probe_failed( &mut self, path: &Path, short_channel_id: u64, duration_since_epoch: Duration, )
Handles updating channel penalties after a probe over the given path failed.
Source§fn probe_successful(&mut self, path: &Path, duration_since_epoch: Duration)
fn probe_successful(&mut self, path: &Path, duration_since_epoch: Duration)
Handles updating channel penalties after a probe over the given path succeeded.
Source§fn time_passed(&mut self, duration_since_epoch: Duration)
fn time_passed(&mut self, duration_since_epoch: Duration)
Scorers may wish to reduce their certainty of channel liquidity information over time.
Thus, this method is provided to allow scorers to observe the passage of time - the holder
of this object should call this method regularly (generally via the
lightning-background-processor crate).