pub struct HostedStore { /* private fields */ }Expand description
Local body store rooted at pluginDir/hosted.
Implementations§
Source§impl HostedStore
impl HostedStore
Sourcepub fn new(plugin_dir: impl Into<PathBuf>) -> Self
pub fn new(plugin_dir: impl Into<PathBuf>) -> Self
Create a store rooted at <plugin_dir>/hosted.
Sourcepub async fn write(&self, hex: &str, body: &[u8]) -> Result<String, ForgeError>
pub async fn write(&self, hex: &str, body: &[u8]) -> Result<String, ForgeError>
Persist body for owner hex, returning its hosted:<hex>/<uuid>
resource ref. The file is written 0600 (owner-only) on Unix.
Sourcepub async fn read(
&self,
hex: &str,
uuid: &str,
max_bytes: usize,
) -> Result<Option<Vec<u8>>, ForgeError>
pub async fn read( &self, hex: &str, uuid: &str, max_bytes: usize, ) -> Result<Option<Vec<u8>>, ForgeError>
Read a stored body by (hex, uuid), bounded to max_bytes.
Trait Implementations§
Source§impl Clone for HostedStore
impl Clone for HostedStore
Source§fn clone(&self) -> HostedStore
fn clone(&self) -> HostedStore
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for HostedStore
impl Debug for HostedStore
Source§impl HostedReader for HostedStore
impl HostedReader for HostedStore
Source§fn read_hosted<'life0, 'life1, 'async_trait>(
&'life0 self,
resource_ref: &'life1 str,
max_bytes: usize,
) -> Pin<Box<dyn Future<Output = FetchResult> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn read_hosted<'life0, 'life1, 'async_trait>(
&'life0 self,
resource_ref: &'life1 str,
max_bytes: usize,
) -> Pin<Box<dyn Future<Output = FetchResult> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Read a hosted body identified by its
resource_url ref.Auto Trait Implementations§
impl Freeze for HostedStore
impl RefUnwindSafe for HostedStore
impl Send for HostedStore
impl Sync for HostedStore
impl Unpin for HostedStore
impl UnsafeUnpin for HostedStore
impl UnwindSafe for HostedStore
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