Skip to main content

StoreFactory

Trait StoreFactory 

Source
pub trait StoreFactory: Send + Sync {
    // Required methods
    fn name(&self) -> &str;
    fn create(
        &self,
        locator: &str,
    ) -> Result<Arc<dyn PersistenceStore + Sync + Send>, PersistenceError>;

    // Provided method
    fn matches_content(&self, _header: &[u8]) -> bool { ... }
}

Required Methods§

Source

fn name(&self) -> &str

Source

fn create( &self, locator: &str, ) -> Result<Arc<dyn PersistenceStore + Sync + Send>, PersistenceError>

Open or create a store at the given locator path.

Implementations that perform async work (e.g. SQLite) must call this from a multi-thread tokio runtime — block_in_place will panic on a current_thread runtime.

Provided Methods§

Source

fn matches_content(&self, _header: &[u8]) -> bool

Dyn Compatibility§

This trait is dyn compatible.

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

Implementations on Foreign Types§

Source§

impl StoreFactory for JsonStoreFactory

Source§

fn name(&self) -> &str

Source§

fn matches_content(&self, header: &[u8]) -> bool

Source§

fn create( &self, locator: &str, ) -> Result<Arc<dyn PersistenceStore + Sync + Send>, PersistenceError>

Source§

impl StoreFactory for SqliteStoreFactory

Source§

fn name(&self) -> &str

Source§

fn matches_content(&self, header: &[u8]) -> bool

Source§

fn create( &self, locator: &str, ) -> Result<Arc<dyn PersistenceStore + Sync + Send>, PersistenceError>

Implementors§