pub trait SyncPathManager {
// Required methods
fn register_path(
&self,
src: IsdAsn,
dst: IsdAsn,
now: DateTime<Utc>,
path: Path<Bytes>,
);
fn try_cached_path(
&self,
src: IsdAsn,
dst: IsdAsn,
now: DateTime<Utc>,
) -> Result<Option<Path<Bytes>>>;
}Expand description
Trait for active path management with sync interface. Implementors of this trait should be able to be used in sync and async context. The functions must not block.
Required Methods§
Sourcefn register_path(
&self,
src: IsdAsn,
dst: IsdAsn,
now: DateTime<Utc>,
path: Path<Bytes>,
)
fn register_path( &self, src: IsdAsn, dst: IsdAsn, now: DateTime<Utc>, path: Path<Bytes>, )
Add a path to the path cache. This can be used to register reverse paths.
Sourcefn try_cached_path(
&self,
src: IsdAsn,
dst: IsdAsn,
now: DateTime<Utc>,
) -> Result<Option<Path<Bytes>>>
fn try_cached_path( &self, src: IsdAsn, dst: IsdAsn, now: DateTime<Utc>, ) -> Result<Option<Path<Bytes>>>
Returns a path to the destination from the path cache. If the path is not in the cache, it returns Ok(None), possibly causing the path to be fetched in the background. If the cache is locked an io error WouldBlock is returned.