pub struct MediaReupload<'a> { /* private fields */ }Implementations§
Source§impl<'a> MediaReupload<'a>
impl<'a> MediaReupload<'a>
Sourcepub async fn request(
&self,
req: &MediaReuploadRequest<'_>,
) -> Result<MediaRetryResult, MediaReuploadError>
pub async fn request( &self, req: &MediaReuploadRequest<'_>, ) -> Result<MediaRetryResult, MediaReuploadError>
Request the server to re-upload media for a message with an expired URL.
Returns the new directPath on success, or an error variant indicating
why the reupload failed.
§Protocol flow
- Encrypt
ServerErrorReceiptprotobuf with HKDF-derived key from media key - Send
<receipt type="server-error">with encrypted payload +<rmr>metadata - Wait for
<notification type="mediaretry">response - Decrypt response and extract new
directPath
Sourcepub async fn request_many(
&self,
reqs: &[MediaReuploadRequest<'_>],
) -> Vec<Result<MediaRetryResult, MediaReuploadError>>
pub async fn request_many( &self, reqs: &[MediaReuploadRequest<'_>], ) -> Vec<Result<MediaRetryResult, MediaReuploadError>>
Request reupload for several messages at once, concurrently.
Each request registers its own notification waiter and awaits it
independently, so a bulk recovery — e.g. many expired-URL media after a
long offline period — runs MEDIA_REUPLOAD_CONCURRENCY at a time instead
of paying the serial sum of per-item waits. A batch larger than that runs
in waves, so the worst case is ceil(len / MEDIA_REUPLOAD_CONCURRENCY)
MEDIA_RETRY_TIMEOUT windows. Results are returned in the
same order as reqs; each entry carries that item’s success or error
(one item failing never aborts the others).
Duplicate msg_ids in one batch are rejected (past the first occurrence)
with MediaReuploadError::InvalidRequest. The mediaretry waiter
filters on message id alone and resolve_waiters wakes every match, so
two same-id waiters would cross-resolve. Serializing them isn’t enough:
once the first waiter times out it lingers in node_waiters (canceled
waiters are purged only lazily), so its late notification could still
resolve a same-id retry with the wrong payload. Requiring unique ids means
no two waiters ever share a filter — a message id is unique per message,
so a duplicate is a caller mistake, not a real recovery target.
Auto Trait Implementations§
impl<'a> !RefUnwindSafe for MediaReupload<'a>
impl<'a> !UnwindSafe for MediaReupload<'a>
impl<'a> Freeze for MediaReupload<'a>
impl<'a> Send for MediaReupload<'a>
impl<'a> Sync for MediaReupload<'a>
impl<'a> Unpin for MediaReupload<'a>
impl<'a> UnsafeUnpin for MediaReupload<'a>
Blanket Implementations§
Source§impl<T> AggregateExpressionMethods for T
impl<T> AggregateExpressionMethods for T
Source§fn aggregate_distinct(self) -> Self::Outputwhere
Self: DistinctDsl,
fn aggregate_distinct(self) -> Self::Outputwhere
Self: DistinctDsl,
DISTINCT modifier for aggregate functions Read moreSource§fn aggregate_all(self) -> Self::Outputwhere
Self: AllDsl,
fn aggregate_all(self) -> Self::Outputwhere
Self: AllDsl,
ALL modifier for aggregate functions Read moreSource§fn aggregate_filter<P>(self, f: P) -> Self::Output
fn aggregate_filter<P>(self, f: P) -> Self::Output
Source§fn aggregate_order<O>(self, o: O) -> Self::Outputwhere
Self: OrderAggregateDsl<O>,
fn aggregate_order<O>(self, o: O) -> Self::Outputwhere
Self: OrderAggregateDsl<O>,
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> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSend for T
impl<T> DowncastSend for T
Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> IntoSql for T
impl<T> IntoSql for T
Source§fn into_sql<T>(self) -> Self::Expression
fn into_sql<T>(self) -> Self::Expression
self to an expression for Diesel’s query builder. Read moreSource§fn as_sql<'a, T>(&'a self) -> <&'a Self as AsExpression<T>>::Expression
fn as_sql<'a, T>(&'a self) -> <&'a Self as AsExpression<T>>::Expression
&self to an expression for Diesel’s query builder. Read more