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 + Send + Sync>, 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 + Send + Sync>, 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

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 + Send + Sync>, 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 + Send + Sync>, PersistenceError>

Implementors§