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. 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.

Get a copy of the registry’s ShutdownHandle.

Trait Implementations

Returns the node with the given identity, if it exists in the registry. Read more

Returns an iterator over the nodes in the registry. Read more

Returns the count of nodes in the registry. Read more

Determines whether or not the node exists in the registry. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Performs the conversion.

Convert self to an expression for Diesel’s query builder. Read more

Convert &self to an expression for Diesel’s query builder. Read more

Should always be Self

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

Get the TypeId of this object.

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more