pub struct InMemoryCloudHome { /* private fields */ }Expand description
In-memory CloudHome backed by a HashMap. Thread-safe; cheap to share
between simulated devices via Arc.
Implementations§
Source§impl InMemoryCloudHome
impl InMemoryCloudHome
pub fn new() -> Self
Sourcepub fn keys(&self) -> Vec<String>
pub fn keys(&self) -> Vec<String>
Snapshot of every key currently in the cloud. Useful for assertions that don’t want to hold the lock across an await.
Sourcepub fn get(&self, key: &str) -> Option<Vec<u8>>
pub fn get(&self, key: &str) -> Option<Vec<u8>>
Snapshot of the bytes at key, or None if absent. Cloned so the
caller can hold the result across await points without retaining
the internal lock.
Sourcepub fn deletes_seen(&self) -> Vec<String>
pub fn deletes_seen(&self) -> Vec<String>
Snapshot of every delete that’s been requested, in arrival order.
Trait Implementations§
Source§impl CloudHome for InMemoryCloudHome
impl CloudHome for InMemoryCloudHome
Source§fn write<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 str,
data: Vec<u8>,
) -> Pin<Box<dyn Future<Output = Result<(), CloudHomeError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn write<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 str,
data: Vec<u8>,
) -> Pin<Box<dyn Future<Output = Result<(), CloudHomeError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Write bytes to a key, creating or overwriting.
Source§fn read<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<u8>, CloudHomeError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn read<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<u8>, CloudHomeError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Read the full contents of a key.
Source§fn read_range<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 str,
start: u64,
end: u64,
) -> Pin<Box<dyn Future<Output = Result<Vec<u8>, CloudHomeError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn read_range<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 str,
start: u64,
end: u64,
) -> Pin<Box<dyn Future<Output = Result<Vec<u8>, CloudHomeError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Read a byte range from a key.
start is inclusive, end is exclusive.Source§fn list<'life0, 'life1, 'async_trait>(
&'life0 self,
prefix: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<String>, CloudHomeError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn list<'life0, 'life1, 'async_trait>(
&'life0 self,
prefix: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<String>, CloudHomeError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
List all keys under a prefix.
Source§fn delete<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<(), CloudHomeError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn delete<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<(), CloudHomeError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Delete a key. Not an error if the key does not exist.
Source§fn exists<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<bool, CloudHomeError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn exists<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<bool, CloudHomeError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Check whether a key exists.
Source§fn grant_access<'life0, 'life1, 'async_trait>(
&'life0 self,
_member_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<CloudHomeJoinInfo, CloudHomeError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn grant_access<'life0, 'life1, 'async_trait>(
&'life0 self,
_member_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<CloudHomeJoinInfo, CloudHomeError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Grant access to a member and return connection info for the cloud home.
For S3 this ignores
member_id and returns bucket/region/endpoint
(access is managed externally via IAM/pre-shared credentials).
For consumer clouds this shares the folder with the member’s account.Source§fn revoke_access<'life0, 'life1, 'async_trait>(
&'life0 self,
_member_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<(), CloudHomeError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn revoke_access<'life0, 'life1, 'async_trait>(
&'life0 self,
_member_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<(), CloudHomeError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Revoke a previously granted access. No-op for backends where access
is controlled externally (e.g. S3 with pre-shared credentials).
Source§fn probe<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<(), CloudHomeError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn probe<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<(), CloudHomeError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Verify the backend is reachable with the configured credentials.
Setup flows call this before persisting credentials, so a typo or
missing bucket fails fast at setup time instead of via a delayed
reconnect banner. Default implementation issues a no-op list against
a sentinel prefix — backends override with cheaper provider-specific
auth checks (e.g. S3 HeadBucket) where available.
Auto Trait Implementations§
impl !Freeze for InMemoryCloudHome
impl RefUnwindSafe for InMemoryCloudHome
impl Send for InMemoryCloudHome
impl Sync for InMemoryCloudHome
impl Unpin for InMemoryCloudHome
impl UnwindSafe for InMemoryCloudHome
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
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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 moreCreates a shared type from an unshared type.