pub struct Storage { /* private fields */ }Expand description
Storage Manager (Facade) untuk mengelola berbagai disk penyimpanan.
Implementations§
Source§impl Storage
impl Storage
pub fn new(default_disk: &str) -> Storage
Sourcepub fn set_global(storage: Arc<Storage>)
pub fn set_global(storage: Arc<Storage>)
Registrasi instance global Storage Facade.
Sourcepub fn add_disk(&mut self, name: &str, driver: Arc<dyn StorageDriver>)
pub fn add_disk(&mut self, name: &str, driver: Arc<dyn StorageDriver>)
Daftarkan disk baru.
Sourcepub fn disk(&self, name: &str) -> Arc<dyn StorageDriver> ⓘ
pub fn disk(&self, name: &str) -> Arc<dyn StorageDriver> ⓘ
Ambil disk spesifik dari instance.
Sourcepub fn default(&self) -> Arc<dyn StorageDriver> ⓘ
pub fn default(&self) -> Arc<dyn StorageDriver> ⓘ
Ambil disk default dari instance.
Sourcepub fn disk_named(name: &str) -> Arc<dyn StorageDriver> ⓘ
pub fn disk_named(name: &str) -> Arc<dyn StorageDriver> ⓘ
Akses disk spesifik melalui Static Facade (misal: Storage::disk_named("s3")).
Sourcepub async fn put_file(path: &str, contents: &[u8]) -> Result<(), String>
pub async fn put_file(path: &str, contents: &[u8]) -> Result<(), String>
Simpan data ke disk default secara statis.
Sourcepub async fn get_file(path: &str) -> Result<Vec<u8>, String>
pub async fn get_file(path: &str) -> Result<Vec<u8>, String>
Ambil data dari disk default secara statis.
pub async fn put(&self, path: &str, contents: &[u8]) -> Result<(), String>
pub async fn get(&self, path: &str) -> Result<Vec<u8>, String>
pub async fn exists(&self, path: &str) -> bool
pub async fn delete(&self, path: &str) -> Result<(), String>
pub fn url(&self, path: &str) -> String
pub fn temporary_url(&self, path: &str, ttl: Duration) -> Result<String, String>
Auto Trait Implementations§
impl !RefUnwindSafe for Storage
impl !UnwindSafe for Storage
impl Forget for Storage
impl Freeze for Storage
impl Move for Storage
impl Send for Storage
impl Sync for Storage
impl Unpin for Storage
impl UnsafeUnpin for Storage
Blanket Implementations§
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
Mutably borrows from an owned value. Read more
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> ⓘ
Converts
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> ⓘ
Converts
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 more