pub struct HttpStore { /* private fields */ }Expand description
A passalong-server workspace.
Implementations§
Source§impl HttpStore
impl HttpStore
Sourcepub fn new(
client: Arc<Client>,
sealer: Option<Sealer>,
clock: Arc<dyn Clock>,
) -> Self
pub fn new( client: Arc<Client>, sealer: Option<Sealer>, clock: Arc<dyn Clock>, ) -> Self
The workspace behind client: sealed with sealer, or plaintext.
Sourcepub fn in_partition(
client: Arc<Client>,
sealer: Option<Sealer>,
clock: Arc<dyn Clock>,
partition: Partition,
) -> Self
pub fn in_partition( client: Arc<Client>, sealer: Option<Sealer>, clock: Arc<dyn Clock>, partition: Partition, ) -> Self
The workspace’s partition.
Sourcepub fn id_for(&self, meta: &ItemMeta) -> Result<ItemId, StoreError>
pub fn id_for(&self, meta: &ItemMeta) -> Result<ItemId, StoreError>
The id meta’s item gets in this store: its creation time, and this
store’s content key for its SHA-256.
§Errors
StoreError::Corrupt when meta’s SHA-256 is not one.
Sourcepub async fn import(
&self,
meta: &ItemMeta,
content: BoxRead,
) -> Result<ItemMeta, StoreError>
pub async fn import( &self, meta: &ItemMeta, content: BoxRead, ) -> Result<ItemMeta, StoreError>
Stores another store’s item, with its metadata and creation time,
under the id HttpStore::id_for gives it, and returns its
metadata here. An item already stored under that id is left as it
is. In the staged partition this is a re-encryption’s copy.
§Errors
StoreError::Corrupt when the content does not match meta’s
SHA-256 and size, and the server’s refusals.
Trait Implementations§
Source§impl Store for HttpStore
impl Store for HttpStore
Source§fn key_id(&self) -> Option<KeyId>
fn key_id(&self) -> Option<KeyId>
Id of the data key this store seals items with;
None for a
plaintext store.Source§fn content_key(&self, digest: &ContentDigest) -> ContentKey
fn content_key(&self, digest: &ContentDigest) -> ContentKey
The content key that identifies content with
digest in this
store: the plain ContentDigest::content_key, or a keyed one in an
encrypted store. Use it to look for content already stored.Source§fn put<'life0, 'async_trait>(
&'life0 self,
item: NewItem,
content: BoxRead,
) -> Pin<Box<dyn Future<Output = Result<PutOutcome, StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn put<'life0, 'async_trait>(
&'life0 self,
item: NewItem,
content: BoxRead,
) -> Pin<Box<dyn Future<Output = Result<PutOutcome, StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Stores
content as a new item, streaming it without buffering the
whole content. Identical content already in the store is not stored
again: the existing item is returned with created: false.Source§fn list<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<ItemMeta>, StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn list<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<ItemMeta>, StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Lists every item, newest first.
Source§fn list_after<'life0, 'life1, 'async_trait>(
&'life0 self,
after: Option<&'life1 ItemId>,
) -> Pin<Box<dyn Future<Output = Result<Vec<ItemMeta>, StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn list_after<'life0, 'life1, 'async_trait>(
&'life0 self,
after: Option<&'life1 ItemId>,
) -> Pin<Box<dyn Future<Output = Result<Vec<ItemMeta>, StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Items newer than
after, newest first, or every item for None.
Only those items’ metadata is read, so polling for new items stays
cheap on a large store.Source§fn list_ids<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<ItemId>, StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn list_ids<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<ItemId>, StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Every item’s id, newest first, without reading any metadata. The
default lists every item; backends override it with something
cheaper.
Source§fn get<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 ItemId,
) -> Pin<Box<dyn Future<Output = Result<(ItemMeta, BoxRead), StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 ItemId,
) -> Pin<Box<dyn Future<Output = Result<(ItemMeta, BoxRead), StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Returns an item’s metadata and a stream of its content.
Source§fn get_meta<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 ItemId,
) -> Pin<Box<dyn Future<Output = Result<ItemMeta, StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_meta<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 ItemId,
) -> Pin<Box<dyn Future<Output = Result<ItemMeta, StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
An item’s metadata alone, without opening its content. The default
calls
Store::get and drops the content; backends override it
with a single metadata read. Read moreSource§fn exists<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 ItemId,
) -> Pin<Box<dyn Future<Output = Result<bool, StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn exists<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 ItemId,
) -> Pin<Box<dyn Future<Output = Result<bool, StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Whether an item exists.
Source§fn find_by_content_key<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 ContentKey,
) -> Pin<Box<dyn Future<Output = Result<Option<ItemMeta>, StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn find_by_content_key<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 ContentKey,
) -> Pin<Box<dyn Future<Output = Result<Option<ItemMeta>, StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Finds the oldest item whose content has
key.Source§fn resolve<'life0, 'life1, 'async_trait>(
&'life0 self,
input: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<ItemId, StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn resolve<'life0, 'life1, 'async_trait>(
&'life0 self,
input: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<ItemId, StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Turns what a user typed into one item id. Input without
- is a
prefix of the content key (for example 2cf2); input with - is a
prefix of the full id. Case and surrounding spaces are ignored, and
at least 4 characters are required.Source§fn delete<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 ItemId,
) -> Pin<Box<dyn Future<Output = Result<ItemMeta, StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn delete<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 ItemId,
) -> Pin<Box<dyn Future<Output = Result<ItemMeta, StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Deletes an item and returns its metadata. The item disappears from
listings in one step, even if removing its data then fails.
Source§fn clean_staging<'life0, 'async_trait>(
&'life0 self,
older_than: Duration,
) -> Pin<Box<dyn Future<Output = Result<usize, StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn clean_staging<'life0, 'async_trait>(
&'life0 self,
older_than: Duration,
) -> Pin<Box<dyn Future<Output = Result<usize, StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Removes staging directories that interrupted uploads and deletions
left behind, when older than
older_than, and returns how many were
removed. Younger ones may belong to uploads in progress and stay.Source§fn probe_write<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<WriteProbe, StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn probe_write<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<WriteProbe, StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Checks that the store accepts writes without storing an item: a
probe is written where listings and other devices never look, then
removed. The default reports
WriteProbe::NotSupported. Read moreSource§fn newest_id<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Option<ItemId>, StoreError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
fn newest_id<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Option<ItemId>, StoreError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
👎Deprecated since 0.1.3:
pull mode no longer uses it; use list_ids and take the first
The newest item’s id, or
None for an empty store. The default
lists every item; backends override it with something cheaper.Auto Trait Implementations§
impl !Freeze for HttpStore
impl !RefUnwindSafe for HttpStore
impl !UnwindSafe for HttpStore
impl Send for HttpStore
impl Sync for HttpStore
impl Unpin for HttpStore
impl UnsafeUnpin for HttpStore
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