[][src]Struct routinator::origins::OriginsHistory

pub struct OriginsHistory(_);

A shareable history of address orgins.

A value of this type allows access to the currently valid list of address origins and a list of diffs from earlier versions. The latter list is limited to a certain length. Older diffs are dropped.

These things are all hidden away behind an arc and a lock so you can copy and share values relatively cheaply and in a safe way.

Implementations

impl OriginsHistory[src]

pub fn new(config: &Config) -> Self[src]

Creates a new history from the given initial data.

pub fn is_active(&self) -> bool[src]

Returns whether the history is active already.

pub fn current(&self) -> Option<Arc<AddressOrigins>>[src]

Returns a reference to the current list of address origins.

pub fn refresh_wait(&self) -> Duration[src]

Returns the duration until the next refresh should start.

pub fn update_wait(&self) -> Duration[src]

Returns the duration until a new set of data is available.

pub fn get(&self, serial: Serial) -> Option<Arc<OriginsDiff>>[src]

Returns a diff from the given serial number.

The serial is what the requestor has last seen. The method produces a diff from that version to the current version if it can. If it can’t, either because it doesn’t have enough history data or because the serial is actually in the future.

pub fn serial(&self) -> Serial[src]

Returns the serial number of the current version of the origin list.

pub fn current_and_serial(&self) -> Option<(Arc<AddressOrigins>, Serial)>[src]

Returns the current list of address origins and its serial number.

pub fn current_and_metrics(&self) -> Option<(Arc<AddressOrigins>, Arc<Metrics>)>[src]

pub fn metrics(&self) -> Option<Arc<Metrics>>[src]

pub fn server_metrics(&self) -> Arc<ServerMetrics>[src]

pub fn update_times(&self) -> (Instant, Option<Instant>, Option<Duration>)[src]

pub fn update(
    &self,
    report: OriginsReport,
    metrics: Metrics,
    exceptions: &LocalExceptions
) -> bool
[src]

Updates the history.

Produces a new list of address origins based on the route origins and local exceptions. If this list differs from the current list of address origins, adds a new version to the history.

The method returns whether it added a new version.

Note also that the method has to acquire the write lock on the history.

pub fn mark_update_start(&self)[src]

Marks the beginning of an update cycle.

pub fn mark_update_done(&self)[src]

Marks the end of an update cycle.

Trait Implementations

impl Clone for OriginsHistory[src]

impl Debug for OriginsHistory[src]

impl VrpSource for OriginsHistory[src]

type FullIter = AddressOriginsIter

An iterator over the complete set of VRPs.

type DiffIter = DiffIter

An iterator over a difference between two sets of VRPs.

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

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