pub struct RelayCatalogReducer;Expand description
Stateless relay catalog reducer.
Implementations§
Source§impl RelayCatalogReducer
impl RelayCatalogReducer
Sourcepub fn reconcile(
current: Vec<RelayCatalogEntry>,
discovered: Vec<DnsRelayRecord>,
refreshed_at: i64,
fallback_url: String,
dns_authenticated: bool,
) -> Result<RelayCatalogPlan, SoftchatError>
pub fn reconcile( current: Vec<RelayCatalogEntry>, discovered: Vec<DnsRelayRecord>, refreshed_at: i64, fallback_url: String, dns_authenticated: bool, ) -> Result<RelayCatalogPlan, SoftchatError>
Reconcile persisted custom/exclusion state with authenticated discovery.
Discovery that is not explicitly authenticated never becomes trusted catalog state. The compiled fallback is used instead.
§Errors
Returns SoftchatError::InvalidRelayCatalog for invalid URLs,
duplicate persisted rows, bounds, timestamps, priorities, weights, or
TTLs.
Sourcepub fn add_custom(
current: Vec<RelayCatalogEntry>,
relay_url: String,
created_at: i64,
) -> Result<Vec<RelayCatalogEntry>, SoftchatError>
pub fn add_custom( current: Vec<RelayCatalogEntry>, relay_url: String, created_at: i64, ) -> Result<Vec<RelayCatalogEntry>, SoftchatError>
Add or reactivate a user-owned relay without discarding DNS metadata.
§Errors
Returns a stable relay-catalog error for malformed state or URL.
Sourcepub fn exclude(
current: Vec<RelayCatalogEntry>,
relay_url: String,
) -> Result<Vec<RelayCatalogEntry>, SoftchatError>
pub fn exclude( current: Vec<RelayCatalogEntry>, relay_url: String, ) -> Result<Vec<RelayCatalogEntry>, SoftchatError>
Exclude an automatic relay or remove the custom ownership of a URL.
§Errors
Returns a stable relay-catalog error for an unknown or active-only URL.
Sourcepub fn restore_automatic(
current: Vec<RelayCatalogEntry>,
) -> Result<Vec<RelayCatalogEntry>, SoftchatError>
pub fn restore_automatic( current: Vec<RelayCatalogEntry>, ) -> Result<Vec<RelayCatalogEntry>, SoftchatError>
Restore every currently discovered automatic relay.
§Errors
Returns a stable relay-catalog error for malformed persisted rows.
Sourcepub fn set_active(
current: Vec<RelayCatalogEntry>,
relay_url: String,
) -> Result<Vec<RelayCatalogEntry>, SoftchatError>
pub fn set_active( current: Vec<RelayCatalogEntry>, relay_url: String, ) -> Result<Vec<RelayCatalogEntry>, SoftchatError>
Select one effective active relay.
§Errors
Returns a stable relay-catalog error for an unknown/excluded target.
Sourcepub fn failover_candidates(
current: Vec<RelayCatalogEntry>,
failed_url: String,
) -> Result<Vec<String>, SoftchatError>
pub fn failover_candidates( current: Vec<RelayCatalogEntry>, failed_url: String, ) -> Result<Vec<String>, SoftchatError>
Return effective failover URLs ordered by DNS priority then stable URL.
The failed URL is moved to the end rather than removed so a caller can continue cycling after every candidate fails.
§Errors
Returns a stable relay-catalog error for malformed persisted rows.
Trait Implementations§
Source§impl Clone for RelayCatalogReducer
impl Clone for RelayCatalogReducer
Source§fn clone(&self) -> RelayCatalogReducer
fn clone(&self) -> RelayCatalogReducer
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for RelayCatalogReducer
impl Debug for RelayCatalogReducer
Source§impl Default for RelayCatalogReducer
impl Default for RelayCatalogReducer
Source§fn default() -> RelayCatalogReducer
fn default() -> RelayCatalogReducer
impl Copy for RelayCatalogReducer
Auto Trait Implementations§
impl Freeze for RelayCatalogReducer
impl RefUnwindSafe for RelayCatalogReducer
impl Send for RelayCatalogReducer
impl Sync for RelayCatalogReducer
impl Unpin for RelayCatalogReducer
impl UnsafeUnpin for RelayCatalogReducer
impl UnwindSafe for RelayCatalogReducer
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T, UT> HandleAlloc<UT> for T
impl<T, UT> HandleAlloc<UT> for T
§fn new_handle(value: Arc<T>) -> Handle
fn new_handle(value: Arc<T>) -> Handle
§unsafe fn clone_handle(handle: Handle) -> Handle
unsafe fn clone_handle(handle: Handle) -> Handle
§unsafe fn consume_handle(handle: Handle) -> Arc<T>
unsafe fn consume_handle(handle: Handle) -> Arc<T>
Arc<> Read more