pub struct PairingStore { /* private fields */ }Implementations§
Source§impl PairingStore
impl PairingStore
pub async fn open(path: &str) -> Result<Self, PairingError>
pub async fn open_memory() -> Result<Self, PairingError>
Sourcepub async fn upsert_pending(
&self,
channel: &str,
account_id: &str,
sender_id: &str,
meta: Value,
) -> Result<UpsertOutcome, PairingError>
pub async fn upsert_pending( &self, channel: &str, account_id: &str, sender_id: &str, meta: Value, ) -> Result<UpsertOutcome, PairingError>
Insert (or refresh created_at on) a pending request. Enforces
TTL prune + max-pending per (channel, account). Returns the
active code (existing or new) and created=true when this
call inserted a fresh row.
pub async fn list_pending( &self, channel: Option<&str>, ) -> Result<Vec<PendingRequest>, PairingError>
Sourcepub async fn list_allow(
&self,
channel: Option<&str>,
include_revoked: bool,
) -> Result<Vec<AllowedSender>, PairingError>
pub async fn list_allow( &self, channel: Option<&str>, include_revoked: bool, ) -> Result<Vec<AllowedSender>, PairingError>
Dump every row from pairing_allow_from. include_revoked=false
hides soft-deleted rows; true returns them too with
revoked_at populated. channel filters when Some(_). The
nexo pair list --all operator surface relies on this to make
seeded senders visible (the legacy list_pending only shows
in-flight challenges, which left operators unable to confirm a
pair seed actually landed).
Sourcepub async fn approve(
&self,
code_value: &str,
) -> Result<ApprovedRequest, PairingError>
pub async fn approve( &self, code_value: &str, ) -> Result<ApprovedRequest, PairingError>
Approve a pending request by its code. Moves the row from
pairing_pending into pairing_allow_from atomically.
Sourcepub async fn revoke(
&self,
channel: &str,
sender_id: &str,
) -> Result<bool, PairingError>
pub async fn revoke( &self, channel: &str, sender_id: &str, ) -> Result<bool, PairingError>
Soft-delete by setting revoked_at. The row stays for audit.
Returns true if a row was updated (caller decides whether to
surface “already revoked / not found”).
pub async fn is_allowed( &self, channel: &str, account_id: &str, sender_id: &str, ) -> Result<bool, PairingError>
Sourcepub async fn seed(
&self,
channel: &str,
account_id: &str,
sender_ids: &[String],
) -> Result<usize, PairingError>
pub async fn seed( &self, channel: &str, account_id: &str, sender_ids: &[String], ) -> Result<usize, PairingError>
Bulk insert (idempotent) — preload allow-from from a known list of senders, e.g. when migrating from a non-pairing setup.
Sourcepub async fn refresh_pending_gauge(&self) -> Result<(), PairingError>
pub async fn refresh_pending_gauge(&self) -> Result<(), PairingError>
Resync the pairing_requests_pending gauge from the database.
Call after process restart (the gauge is in-memory state and
resets to 0, so without a refresh it under-reports until the
next upsert_pending). Channels that had a value but no longer
have any pending rows are clamped to 0 to avoid ghost gauges.
pub async fn purge_expired(&self) -> Result<u64, PairingError>
Auto Trait Implementations§
impl Freeze for PairingStore
impl !RefUnwindSafe for PairingStore
impl Send for PairingStore
impl Sync for PairingStore
impl Unpin for PairingStore
impl UnsafeUnpin for PairingStore
impl !UnwindSafe for PairingStore
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> 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 more