pub struct CrlCache { /* private fields */ }Expand description
Process-wide CRL cache.
Implementations§
Source§impl CrlCache
impl CrlCache
pub fn new(fetcher: Arc<dyn CrlFetcher>) -> Arc<Self>
Sourcepub fn ensure_loaded(
&self,
sources: &[(CrlSourceId, CrlFetchFailure)],
) -> Result<(), String>
pub fn ensure_loaded( &self, sources: &[(CrlSourceId, CrlFetchFailure)], ) -> Result<(), String>
Synchronous link-time loader. Each source is fetched with a
30-second timeout. On success, parses nextUpdate and stores
the bytes. On failure, behavior depends on policy:
CrlFetchFailure::Tolerate— record the failure and continue. SubsequentSelf::snapshotcalls for this source silently drop it until a refresh succeeds.CrlFetchFailure::Reject— propagate the error so the caller can fail link.
§Panics
Must be called from within a multi-thread tokio runtime — uses
block_in_place + Handle::current().block_on. Single-thread
runtimes panic.
§Errors
String description of the first reject-policy source that
failed to load. Tolerate-policy failures are kept silent at
link time (logged as transitions, but Ok returned).
Sourcepub fn snapshot(
&self,
sources: &[CrlSourceId],
) -> Result<Vec<Arc<CertificateRevocationListDer<'static>>>, String>
pub fn snapshot( &self, sources: &[CrlSourceId], ) -> Result<Vec<Arc<CertificateRevocationListDer<'static>>>, String>
Read-only handshake-time accessor. Returns the latest CRL bytes
for each requested source. Sources whose policy is tolerate
and whose entry has never successfully loaded are silently
dropped from the result. Sources whose policy is reject and
whose entry is currently unavailable cause this function to
return Err — wrappers turn that into a handshake failure.
§Errors
Returns the first reject-policy source whose state is
Unavailable.
Sourcepub fn ensure_loaded_new(
&self,
sources: &[(CrlSourceId, CrlFetchFailure)],
) -> Result<(), String>
pub fn ensure_loaded_new( &self, sources: &[(CrlSourceId, CrlFetchFailure)], ) -> Result<(), String>
Reload-friendly variant of Self::ensure_loaded: only fetches
sources whose entry is not already registered. Useful from the
reload path so an unchanged URL source doesn’t re-block on a
cold fetch every time the watcher fires.
File sources are always re-fetched (their bytes are local).
§Panics
Same multi-thread runtime requirement as Self::ensure_loaded.
§Errors
Sourcepub fn spawn_refresher(self: &Arc<Self>, shutdown: &CancellationToken)
pub fn spawn_refresher(self: &Arc<Self>, shutdown: &CancellationToken)
Spawn the background refresh loop. One tokio task per URL
source — file sources don’t refresh here (callers re-read them
via Self::ensure_loaded on reload). Cancellation token lets
the host stop the workers at shutdown.