pub enum StorageTask {
Load {
key: StorageKey,
},
LoadRange {
prefix: StorageKey,
},
Put {
key: StorageKey,
value: Vec<u8>,
},
Delete {
key: StorageKey,
},
}Expand description
Represents storage operations that can be performed by both the main Samod instance and document actors.
StorageTask defines the common interface for all storage operations:
- Single value operations (Load, Put, Delete)
- Bulk operations (LoadRange)
This enum is used in two contexts:
- As part of
IoAction::Storage(StorageTask)for the main Samod instance - As part of
DocumentIoTaskfor document actors
§Storage Model
Storage operations work with a simple key-value model:
- Keys are represented by
StorageKey - Values are arbitrary byte arrays
- Range queries are supported via prefix matching
Variants§
Load
Load a single value from storage by its key.
This operation should retrieve the value associated with the given key
from persistent storage. If the key doesn’t exist, the operation should
complete successfully with a None result.
§Fields
key- The storage key to look up
Fields
key: StorageKeyLoadRange
Load all key-value pairs that have keys starting with the given prefix.
This operation performs a range query over the storage, returning all entries whose keys begin with the specified prefix. This is used for efficient bulk operations and queries over related data.
§Fields
prefix- The key prefix to match against
Fields
prefix: StorageKeyPut
Store a key-value pair in persistent storage.
This operation should persist the given key-value pair to storage, replacing any existing value for the same key.
§Fields
key- The storage keyvalue- The data to store
Delete
Remove a key-value pair from persistent storage.
This operation should remove the entry for the given key from storage. If the key doesn’t exist, the operation should complete successfully as a no-op.
§Fields
key- The storage key to remove
Fields
key: StorageKeyTrait Implementations§
Source§impl Clone for StorageTask
impl Clone for StorageTask
Source§fn clone(&self) -> StorageTask
fn clone(&self) -> StorageTask
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for StorageTask
impl RefUnwindSafe for StorageTask
impl Send for StorageTask
impl Sync for StorageTask
impl Unpin for StorageTask
impl UnwindSafe for StorageTask
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
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