pub struct RapidGossipSync<NG: Deref<Target = NetworkGraph<L>>, L: Deref>where
    L::Target: Logger,{ /* private fields */ }
Expand description

The main Rapid Gossip Sync object.

See crate-level documentation for usage.

Implementations§

source§

impl<NG: Deref<Target = NetworkGraph<L>>, L: Deref> RapidGossipSync<NG, L>where L::Target: Logger,

source

pub fn new(network_graph: NG, logger: L) -> Self

Instantiate a new RapidGossipSync instance.

source

pub fn sync_network_graph_with_file_path( &self, sync_path: &str ) -> Result<u32, GraphSyncError>

Sync gossip data from a file. Returns the last sync timestamp to be used the next time rapid sync data is queried.

network_graph: The network graph to apply the updates to

sync_path: Path to the file where the gossip update data is located

source

pub fn update_network_graph( &self, update_data: &[u8] ) -> Result<u32, GraphSyncError>

Update network graph from binary data. Returns the last sync timestamp to be used the next time rapid sync data is queried.

update_data: &[u8] binary stream that comprises the update data

source

pub fn update_network_graph_no_std( &self, update_data: &[u8], current_time_unix: Option<u64> ) -> Result<u32, GraphSyncError>

Update network graph from binary data. Returns the last sync timestamp to be used the next time rapid sync data is queried.

update_data: &[u8] binary stream that comprises the update data current_time_unix: Option<u64> optional current timestamp to verify data age

source

pub fn network_graph(&self) -> &NG

Gets a reference to the underlying NetworkGraph which was provided in RapidGossipSync::new.

(C-not exported) as bindings don’t support a reference-to-a-reference yet

source

pub fn is_initial_sync_complete(&self) -> bool

Returns whether a rapid gossip sync has completed at least once.

Auto Trait Implementations§

§

impl<NG, L> RefUnwindSafe for RapidGossipSync<NG, L>where L: RefUnwindSafe, NG: RefUnwindSafe,

§

impl<NG, L> Send for RapidGossipSync<NG, L>where L: Send, NG: Send,

§

impl<NG, L> Sync for RapidGossipSync<NG, L>where L: Sync, NG: Sync,

§

impl<NG, L> Unpin for RapidGossipSync<NG, L>where L: Unpin, NG: Unpin,

§

impl<NG, L> UnwindSafe for RapidGossipSync<NG, L>where L: UnwindSafe, NG: UnwindSafe,

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

const: unstable · 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, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

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

The type returned in the event of a conversion error.
const: unstable · source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.