Skip to main content

PairingStore

Struct PairingStore 

Source
pub struct PairingStore { /* private fields */ }

Implementations§

Source§

impl PairingStore

Source

pub async fn open(path: &str) -> Result<Self, PairingError>

Source

pub async fn open_memory() -> Result<Self, PairingError>

Source

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.

Source

pub async fn list_pending( &self, channel: Option<&str>, ) -> Result<Vec<PendingRequest>, PairingError>

Source

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).

Source

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.

Source

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”).

Source

pub async fn is_allowed( &self, channel: &str, account_id: &str, sender_id: &str, ) -> Result<bool, PairingError>

Source

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.

Source

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.

Source

pub async fn purge_expired(&self) -> Result<u64, PairingError>

Auto Trait Implementations§

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> 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> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

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

Source§

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>,

Source§

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