pub struct CachingSenderKeys<K> { /* private fields */ }Expand description
SenderKeys that keeps each key inner gives for ttl after loading
it, so that it is not loaded again for every delivery it signs.
A post fans out to thousands of inboxes signed with one key; loading it
for each — from a database, decrypting it, parsing its PEM — costs as
many queries and as much work, and with many deliveries in flight can
hold every connection an application has. A key replaced at its source is
signed with once its ttl has run out. Only keys are kept: a sender with
none, and an error, are asked about again next time. Whether a sender is
gone is always asked of inner.
Implementations§
Trait Implementations§
Source§impl<K: SenderKeys> SenderKeys for CachingSenderKeys<K>
impl<K: SenderKeys> SenderKeys for CachingSenderKeys<K>
Source§async fn key(&self, sender: &str) -> Result<Option<SenderKey>, QueueError>
async fn key(&self, sender: &str) -> Result<Option<SenderKey>, QueueError>
The key
sender signs with, or None when there is no such sender.Source§async fn gone(&self, sender: &str) -> bool
async fn gone(&self, sender: &str) -> bool
Whether
sender is gone for good, so that a status
DelivererConfig::permanent_if_sender_gone names will not change:
Mastodon gives up at once on a 401 to a delivery from an account that
is deleted or suspended with nothing left to undo
(unsalvageable_authorization_failure?). Asked only after such a
status; no sender is gone unless the application says so.Auto Trait Implementations§
impl<K> !Freeze for CachingSenderKeys<K>
impl<K> RefUnwindSafe for CachingSenderKeys<K>where
K: RefUnwindSafe,
impl<K> Send for CachingSenderKeys<K>where
K: Send,
impl<K> Sync for CachingSenderKeys<K>where
K: Sync,
impl<K> Unpin for CachingSenderKeys<K>where
K: Unpin,
impl<K> UnsafeUnpin for CachingSenderKeys<K>where
K: UnsafeUnpin,
impl<K> UnwindSafe for CachingSenderKeys<K>where
K: 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