pub struct ActorStore { /* private fields */ }Expand description
Actor isolated storage handle
Each Actor has an independent SQLite database file, with the path determined by Hyper’s namespace resolver. All read/write operations are confined to this namespace; an Actor cannot access another Actor’s data.
The rusqlite connection is not Send; wrapped in Arc<Mutex<Connection>> for cross-thread sharing.
All blocking I/O is offloaded to the blocking thread pool via tokio::task::spawn_blocking.
Implementations§
Source§impl ActorStore
impl ActorStore
Sourcepub async fn open(db_path: &Path) -> Result<Self, HyperError>
pub async fn open(db_path: &Path) -> Result<Self, HyperError>
Open or create an Actor’s SQLite database
Automatically creates the table on first call. Parent directory is created automatically if missing.
Sourcepub async fn kv_set(&self, key: &str, value: &[u8]) -> Result<(), HyperError>
pub async fn kv_set(&self, key: &str, value: &[u8]) -> Result<(), HyperError>
Generic KV storage: write or update a key-value pair
Sourcepub async fn kv_get(&self, key: &str) -> Result<Option<Vec<u8>>, HyperError>
pub async fn kv_get(&self, key: &str) -> Result<Option<Vec<u8>>, HyperError>
Generic KV storage: read a key’s value, returns None if the key does not exist
Sourcepub async fn kv_delete(&self, key: &str) -> Result<bool, HyperError>
pub async fn kv_delete(&self, key: &str) -> Result<bool, HyperError>
Generic KV storage: delete a key, returns whether a record was actually deleted
Sourcepub async fn kv_list_keys(
&self,
prefix: Option<&str>,
) -> Result<Vec<String>, HyperError>
pub async fn kv_list_keys( &self, prefix: Option<&str>, ) -> Result<Vec<String>, HyperError>
List all keys, optionally filtered by prefix
Trait Implementations§
Source§impl Clone for ActorStore
impl Clone for ActorStore
Source§fn clone(&self) -> ActorStore
fn clone(&self) -> ActorStore
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl KvStore for ActorStore
impl KvStore for ActorStore
Source§fn get<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<Vec<u8>>, PlatformError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<Vec<u8>>, PlatformError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
None if the key does not existSource§fn set<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
key: &'life1 str,
value: &'life2 [u8],
) -> Pin<Box<dyn Future<Output = Result<(), PlatformError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn set<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
key: &'life1 str,
value: &'life2 [u8],
) -> Pin<Box<dyn Future<Output = Result<(), PlatformError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Source§fn delete<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<bool, PlatformError>> + 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<bool, PlatformError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Auto Trait Implementations§
impl Freeze for ActorStore
impl RefUnwindSafe for ActorStore
impl Send for ActorStore
impl Sync for ActorStore
impl Unpin for ActorStore
impl UnsafeUnpin for ActorStore
impl UnwindSafe for ActorStore
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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> ⓘ
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> ⓘ
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