Struct splinter::registry::RemoteYamlRegistry [−][src]
pub struct RemoteYamlRegistry { /* fields omitted */ }
Expand description
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.
Implementations
Construct a new RemoteYamlRegistry
.
Arguments
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. IfNone
, 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. IfNone
, forced refreshes will be disabled.
Trait Implementations
Returns the node with the given identity, if it exists in the registry. Read more
fn list_nodes<'a, 'b: 'a>(
&'b self,
predicates: &'a [MetadataPredicate]
) -> Result<NodeIter<'a>, RegistryError>
fn list_nodes<'a, 'b: 'a>(
&'b self,
predicates: &'a [MetadataPredicate]
) -> Result<NodeIter<'a>, RegistryError>
Returns an iterator over the nodes in the registry. Read more
Returns the count of nodes in the registry. Read more
Auto Trait Implementations
impl !RefUnwindSafe for RemoteYamlRegistry
impl Send for RemoteYamlRegistry
impl Sync for RemoteYamlRegistry
impl Unpin for RemoteYamlRegistry
impl !UnwindSafe for RemoteYamlRegistry
Blanket Implementations
Mutably borrows from an owned value. Read more
Instruments this type with the provided Span
, returning an
Instrumented
wrapper. Read more
Instruments this type with the provided Span
, returning an
Instrumented
wrapper. Read more
Convert self
to an expression for Diesel’s query builder. Read more
fn as_sql<'a, T>(&'a self) -> <&'a Self as AsExpression<T>>::Expression where
&'a Self: AsExpression<T>,
fn as_sql<'a, T>(&'a self) -> <&'a Self as AsExpression<T>>::Expression where
&'a Self: AsExpression<T>,
Convert &self
to an expression for Diesel’s query builder. Read more
type Output = T
type Output = T
Should always be Self