[][src]Struct splinter::registry::RemoteYamlRegistry

pub struct RemoteYamlRegistry { /* fields omitted */ }

A remote, read-only registry.

The RemoteYamlRegistry provides access to a remote registry YAML file over HTTP(S). The remote registry file must be a YAML sequence of nodes, where each node is valid (see Node for validity criteria). Read operations are provided by the RegistryReader implementation.

The remote YAML file is cached locally by saving it to the filesystem. This ensures that the registry will remain available even if the remote file becomes unreachable. The on-disk location of the local cache is determined by the cache_dir argument of the registry's constructor.

On initialization, the RemoteYamlRegistry will attempt to immediately fetch and cache the remote file. If this fails, the registry will log an error message and attempt to fetch/cache the remote file every time a read query is made on the registry (through one of the RegistryReader methods) until the file is successfully cached. Until the registry has a local cache, it will behave as an empty registry. Once the remote file has been successfully cached for the first time, the registry will always provide data from the cache.

If an automatic_refresh_period is provided to the registry's constructor, the registry will attempt to automatically refresh the cache in the background after the given time since the last automatic refresh attempt has elapsed.

If a forced_refresh_period is provided to the registry's constructor, the registry will attempt to cache the remote file on each read after the given time since the last successful cache attempt has elapsed.

If a forced or automatic cache refresh fails for any reason, an error message will be logged and the previously cached registry values will continue to be used. The next time the registry is read, it will try again to refresh the cache.


impl RemoteYamlRegistry[src]

pub fn new(
    url: &str,
    cache_dir: &str,
    automatic_refresh_period: Option<Duration>,
    forced_refresh_period: Option<Duration>
) -> Result<Self, RegistryError>

Construct a new RemoteYamlRegistry.


  • url - URL of the registry's backing YAML file.
  • cache_dir - Directory that the local registry cache will be stored in.
  • automatic_refresh_period - Amount of time between attempts to automatically fetch and cache the remote YAML file in the background. If None, background refreshes will be disabled. The automatic refresh occurs with a tolerance of +/- 1 second.
  • forced_refresh_period - Amount of time since the last successful cache refresh before attempting to refresh on every read operation. If None, forced refreshes will be disabled.

pub fn shutdown_handle(&self) -> ShutdownHandle[src]

Get a copy of the registry's ShutdownHandle.

Trait Implementations

impl RegistryReader for RemoteYamlRegistry[src]

Auto Trait Implementations

Blanket Implementations

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

impl<T> Borrow<T> for T where
    T: ?Sized

impl<T> BorrowMut<T> for T where
    T: ?Sized

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

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

impl<P, N> IntoBytes<P> for N where
    P: Message + FromNative<N>, 

impl<N, P> IntoNative<N> for P where
    N: FromProto<P>, 

impl<N, P> IntoProto<P> for N where
    P: FromNative<N>, 

impl<T> IntoSql for T

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 

type Error = Infallible

The type returned in the event of a conversion error.

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

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

The type returned in the event of a conversion error.

impl<T> Typeable for T where
    T: Any

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