Skip to main content

SessionStoreFactory

Trait SessionStoreFactory 

Source
pub trait SessionStoreFactory: Send + Sync {
    // Required methods
    fn kind(&self) -> &str;
    fn build(
        &self,
        config: &Value,
    ) -> Result<Arc<dyn SessionStore>, Box<dyn Error + Send + Sync>>;
}
Expand description

Factory the visitor consults when it encounters a global.apl.session_store block in the unified config. Mirrors apl_core::step::PdpFactory: each factory advertises a kind() string matching the YAML block’s kind: field, and build turns the block into a live store. Registered up front via crate::AplOptions::session_store_factories; the visitor selects the active store from config during its global-config walk, before any route handler captures the store.

build errors are construction-time (bad config, unresolvable endpoint) and surface as a config-load failure — distinct from the request-time SessionStoreError the trait methods return.

Required Methods§

Source

fn kind(&self) -> &str

The kind: discriminator this factory builds (e.g. "valkey").

Source

fn build( &self, config: &Value, ) -> Result<Arc<dyn SessionStore>, Box<dyn Error + Send + Sync>>

Build a store from its config block. The whole global.apl.session_store mapping is passed so the factory can read its own keys (endpoint, TLS, auth, prefix, TTL, …).

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§