Skip to main content

RelayCatalogReducer

Struct RelayCatalogReducer 

Source
pub struct RelayCatalogReducer;
Expand description

Stateless relay catalog reducer.

Implementations§

Source§

impl RelayCatalogReducer

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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

Source§

fn clone(&self) -> RelayCatalogReducer

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for RelayCatalogReducer

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for RelayCatalogReducer

Source§

fn default() -> RelayCatalogReducer

Returns the “default value” for a type. Read more
Source§

impl Copy for RelayCatalogReducer

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T, UT> HandleAlloc<UT> for T
where T: Send + Sync,

§

fn new_handle(value: Arc<T>) -> Handle

Create a new handle for an Arc value Read more
§

unsafe fn clone_handle(handle: Handle) -> Handle

Clone a handle Read more
§

unsafe fn consume_handle(handle: Handle) -> Arc<T>

Consume a handle, getting back the initial Arc<> Read more
§

unsafe fn get_arc(handle: Handle) -> Arc<Self>

Get a clone of the Arc<> using a “borrowed” handle. 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> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,