pub struct CacheProvider { /* private fields */ }Expand description
Reloadable runtime cache facade, and the owner of cache.yaml.
CacheRegistry owns driver discovery and candidate construction. This
provider owns the active catalog generation: Congif prepares cache.yaml
before boot and in the reload batch; configure hands the registry its
composition before the sealing boot, and a reload or a prepared source
change asks the sealed registry to build and validate a complete
replacement, then publishes it atomically. Handles resolved before
publication keep their old repository alive; later resolutions see the new
generation. An absent file selects the built-in memory store.
Implementations§
Source§impl CacheProvider
impl CacheProvider
pub fn store(&self, name: &str) -> Result<Arc<CacheRepository>>
pub fn default_store_name(&self) -> Result<String>
pub fn default_store(&self) -> Result<Arc<CacheRepository>>
pub async fn get(&self, key: &str) -> Result<Option<Bytes>>
pub async fn put<'v>( &self, key: &str, value: impl Into<Cow<'v, [u8]>>, ttl: Option<Duration>, ) -> Result<()>
pub async fn get_value(&self, key: &str) -> Result<Option<CacheValue>>
pub async fn put_value( &self, key: &str, value: CacheValue, ttl: Option<Duration>, ) -> Result<()>
pub async fn forget(&self, key: &str) -> Result<()>
pub async fn clear(&self) -> Result<()>
Trait Implementations§
Source§impl Bootable<State> for CacheProvider
impl Bootable<State> for CacheProvider
Source§impl Component<State> for CacheProvider
impl Component<State> for CacheProvider
Source§fn name(&self) -> &'static str
fn name(&self) -> &'static str
Source§fn validate(&self, _state: &AppState) -> Result<()>
fn validate(&self, _state: &AppState) -> Result<()>
Source§fn as_reloadable(&self) -> Option<&dyn Reloadable<AppState>>
fn as_reloadable(&self) -> Option<&dyn Reloadable<AppState>>
Source§fn as_configurable(&self) -> Option<&dyn ConfigRegistration>
fn as_configurable(&self) -> Option<&dyn ConfigRegistration>
Source§fn as_bootable(&self) -> Option<&dyn Bootable<AppState, Self::Deps>>
fn as_bootable(&self) -> Option<&dyn Bootable<AppState, Self::Deps>>
Runnable.Source§fn boot_priority(&self) -> Option<u8>
fn boot_priority(&self) -> Option<u8>
None means priority::NORMAL.Source§fn run_priority(&self) -> Option<u8>
fn run_priority(&self) -> Option<u8>
None means priority::NORMAL.
This grants neither poll priority nor an operational readiness barrier.Source§fn order(&self) -> ComponentOrder
fn order(&self) -> ComponentOrder
Deps.Source§fn as_any(&self) -> &(dyn Any + 'static)where
Self: Sized,
fn as_any(&self) -> &(dyn Any + 'static)where
Self: Sized,
Source§fn as_scoped(&self) -> Option<&dyn Scoped>
fn as_scoped(&self) -> Option<&dyn Scoped>
Scope::Worker. The runtime consults this
before creating local runnable entries; registration is unaffected.Source§fn as_dispatched(&self) -> Option<&dyn Dispatched>
fn as_dispatched(&self) -> Option<&dyn Dispatched>
Dispatch::Each. It applies to runnable execution, not to
construction, boot or configuration.Source§fn as_environmental(&self) -> Option<&dyn Environmental>
fn as_environmental(&self) -> Option<&dyn Environmental>
configure and after a reload; a re-read file
is delivered through Environmental::environment_changed.Source§fn as_finalizable(&self) -> Option<&dyn Finalizable<S>>
fn as_finalizable(&self) -> Option<&dyn Finalizable<S>>
Source§fn as_runnable(self: Arc<Self>) -> Option<Arc<dyn Runnable<S, Self::Deps>>>
fn as_runnable(self: Arc<Self>) -> Option<Arc<dyn Runnable<S, Self::Deps>>>
Deps on every generation.Source§fn runnables(self: Arc<Self>) -> Vec<RunnableInstance<S>>
fn runnables(self: Arc<Self>) -> Vec<RunnableInstance<S>>
Source§impl ConfigObserver for CacheProvider
impl ConfigObserver for CacheProvider
Source§fn config_changed<'life0, 'life1, 'async_trait>(
&'life0 self,
config: &'life1 CacheConfig,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn config_changed<'life0, 'life1, 'async_trait>(
&'life0 self,
config: &'life1 CacheConfig,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Before the registry seals, the newest preparation is what boot builds; after it, a changed file is a new catalog generation.
Source§impl Configurable for CacheProvider
impl Configurable for CacheProvider
Source§fn absent_source(&self) -> Option<CacheConfig>
fn absent_source(&self) -> Option<CacheConfig>
An absent file selects the registry’s built-in memory store.
Source§type Config = CacheConfig
type Config = CacheConfig
Source§fn source(&self) -> ConfigFile
fn source(&self) -> ConfigFile
Source§fn validate_config(&self, config: &CacheConfig) -> Result<()>
fn validate_config(&self, config: &CacheConfig) -> Result<()>
Source§fn configure<'life0, 'life1, 'async_trait>(
&'life0 self,
config: &'life1 CacheConfig,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn configure<'life0, 'life1, 'async_trait>(
&'life0 self,
config: &'life1 CacheConfig,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Source§fn as_config_observer(
&self,
) -> Option<&dyn ConfigObserver<Config = Self::Config>>
fn as_config_observer( &self, ) -> Option<&dyn ConfigObserver<Config = Self::Config>>
Source§fn read_config<'life0, 'life1, 'async_trait>(
&'life0 self,
reader: &'life1 ConfigReader,
) -> Pin<Box<dyn Future<Output = Result<Self::Config, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: Sized + 'static + 'async_trait,
fn read_config<'life0, 'life1, 'async_trait>(
&'life0 self,
reader: &'life1 ConfigReader,
) -> Pin<Box<dyn Future<Output = Result<Self::Config, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: Sized + 'static + 'async_trait,
absent_source. Congif records the includes a
document names and watches them, but opens none of them: an owner whose
document is completed by its includes merges them here, reading each
through ConfigReader::read_include so it is parsed with the owner’s
environment and its own includes are recorded. The merged value is what
equality compares, so a change inside an include is a changed config.Source§fn as_partial_config_observer(
&self,
) -> Option<&dyn PartialConfigObserver<Config = Self::Config>>
fn as_partial_config_observer( &self, ) -> Option<&dyn PartialConfigObserver<Config = Self::Config>>
Source§fn environment(&self) -> Option<&EnvHandle>
fn environment(&self) -> Option<&EnvHandle>
None uses the reader’s application-owned binding, if any. This is not
the environment supplied to a child process or hosted application.Source§fn namespace(&self) -> String
fn namespace(&self) -> String
http instead of http_provider.
Generic arguments do not participate in the default namespace.Source§fn export_config(&self, _config: &Self::Config) -> Result<Option<Value>, Error>
fn export_config(&self, _config: &Self::Config) -> Result<Option<Value>, Error>
congif::export(config) is the one-line body.Source§impl Reloadable<State> for CacheProvider
impl Reloadable<State> for CacheProvider
Source§fn reload<'life0, 'life1, 'async_trait>(
&'life0 self,
state: &'life1 AppState,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn reload<'life0, 'life1, 'async_trait>(
&'life0 self,
state: &'life1 AppState,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Auto Trait Implementations§
impl !Freeze for CacheProvider
impl !RefUnwindSafe for CacheProvider
impl !UnwindSafe for CacheProvider
impl Forget for CacheProvider
impl Move for CacheProvider
impl Send for CacheProvider
impl Sync for CacheProvider
impl Unpin for CacheProvider
impl UnsafeUnpin for CacheProvider
Blanket Implementations§
Source§impl<S, C> AnyComponent<S> for C
impl<S, C> AnyComponent<S> for C
fn name(&self) -> &str
fn boot_priority(&self) -> Option<u8>
fn run_priority(&self) -> Option<u8>
fn order(&self) -> ComponentOrder
Source§fn dependencies(&self) -> Vec<TypeId>
fn dependencies(&self) -> Vec<TypeId>
TypeIds named by the component’s Deps.Source§fn has_bootable(&self) -> bool
fn has_bootable(&self) -> bool
Bootable.Source§fn boot<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
registry: &'life1 Registry<S>,
state: &'life2 S,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
C: 'async_trait,
fn boot<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
registry: &'life1 Registry<S>,
state: &'life2 S,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
C: 'async_trait,
Bootable, if any.fn validate(&self, state: &S) -> Result<(), Error>
fn as_reloadable(&self) -> Option<&dyn Reloadable<S>>
fn as_finalizable(&self) -> Option<&dyn Finalizable<S>>
Source§fn runnables(self: Arc<C>) -> Vec<RunnableInstance<S>>
fn runnables(self: Arc<C>) -> Vec<RunnableInstance<S>>
fn as_configurable(&self) -> Option<&(dyn ConfigRegistration + 'static)>
fn as_environmental(&self) -> Option<&dyn Environmental>
fn as_scoped(&self) -> Option<&dyn Scoped>
fn as_dispatched(&self) -> Option<&dyn Dispatched>
Source§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
Source§type ArchivedMetadata = ()
type ArchivedMetadata = ()
Source§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> ConfigRegistration for Twhere
T: Configurable + 'static,
impl<T> ConfigRegistration for Twhere
T: Configurable + 'static,
fn source(&self) -> ConfigFile
fn configure<'life0, 'life1, 'async_trait>(
&'life0 self,
config: &'life1 (dyn Any + Send + Sync + 'static),
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
T: 'async_trait,
fn observes_config(&self) -> bool
fn partial_sources( &self, reader: &ConfigReader, ) -> Result<Option<Vec<PathBuf>>, Error>
fn prepare_partial_config<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
reader: &'life1 ConfigReader,
sources: &'life2 [PathBuf],
) -> Pin<Box<dyn Future<Output = Result<Arc<dyn Any + Send + Sync>, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
T: 'async_trait,
fn partial_config_changed<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
config: &'life1 (dyn Any + Send + Sync + 'static),
sources: &'life2 [PathBuf],
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
T: 'async_trait,
fn environment(&self) -> Option<&EnvHandle>
fn config_changed<'life0, 'life1, 'async_trait>(
&'life0 self,
config: &'life1 (dyn Any + Send + Sync + 'static),
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
T: 'async_trait,
fn exported_config( &self, config: &(dyn Any + Send + Sync + 'static), ) -> Result<Option<(String, Value)>, Error>
fn same_config( &self, previous: &(dyn Any + Send + Sync + 'static), candidate: &(dyn Any + Send + Sync + 'static), ) -> bool
fn prepare_config<'life0, 'life1, 'async_trait>(
&'life0 self,
reader: &'life1 ConfigReader,
) -> Pin<Box<dyn Future<Output = Result<Arc<dyn Any + Send + Sync>, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
T: 'async_trait,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> LayoutRaw for T
impl<T> LayoutRaw for T
Source§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
Source§impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
Source§unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
Source§fn resolve_niched(out: Place<NichedOption<T, N1>>)
fn resolve_niched(out: Place<NichedOption<T, N1>>)
out indicating that a T is niched.