pub enum StoreConfig {
InMem(),
Disk(Config),
}Expand description
The StoreConfig enum represents configuration options for building a
storage system. It includes different variants for various storage options,
and the availability of these variants depends on compile-time feature
flags.
§Enum Variants
-
InMem: In-memory storage variant. This variant is available when theinmemfeature is enabled. -
AwsS3: AWS S3 storage variant. This variant is available when theaws_s3feature is enabled. It includes a configuration parameter. -
Disk: Disk storage variant. This variant is available when thediskfeature is enabled. It includes a configuration parameter.
Variants§
Implementations§
Source§impl StoreConfig
StoreConfig represents the configuration for creating a store::Store
instance.
impl StoreConfig
StoreConfig represents the configuration for creating a store::Store
instance.
Sourcepub async fn build(self) -> DriverResult<Store>
pub async fn build(self) -> DriverResult<Store>
Builds a store::Store instance based on the configured storage type.
§Examples
use std::path::PathBuf;
use active_storage::StoreConfig;
async fn example() {
let inmem_driver = StoreConfig::InMem().build().await.unwrap();
let file_path = PathBuf::from("test.txt");
inmem_driver
.write(file_path.as_path(), "my content")
.await
.unwrap();
}§Errors
Returns a errors::DriverResult when could not initialize the driver
store
Sourcepub fn with_driver(driver: Box<dyn Driver>) -> Store
pub fn with_driver(driver: Box<dyn Driver>) -> Store
Creates a store::Store instance with the provided storage driver.