pub struct WorkerStore<S: Store> { /* private fields */ }Expand description
A store wrapper for worker-specific operations with namespace isolation.
WorkerStore provides a simplified interface for workers to interact with the main store,
automatically applying a consistent namespace prefix to all operations. This ensures that
different workers can operate on isolated sections of the store without conflicts.
Implementations§
Source§impl<S: Store> WorkerStore<S>
impl<S: Store> WorkerStore<S>
Sourcepub fn new<T: Into<String>>(store: &S, prefix: T) -> Self
pub fn new<T: Into<String>>(store: &S, prefix: T) -> Self
Creates a new WorkerStore with the specified store and unique prefix key.
The prefix serves as a namespace that is automatically applied to all store operations, isolating this worker’s data from other parts of the system.
Sourcepub async fn set_asset_info(&self, asset: AssetInfo) -> Result<(), S::Error>
pub async fn set_asset_info(&self, asset: AssetInfo) -> Result<(), S::Error>
Sets the asset information for a specific asset.
This method automatically applies the worker’s namespace prefix when storing the asset information in the underlying store.
§Errors
Returns the underlying store’s error type if the operation fails
Sourcepub async fn set_batch_asset_info(
&self,
assets: Vec<AssetInfo>,
) -> Result<(), S::Error>
pub async fn set_batch_asset_info( &self, assets: Vec<AssetInfo>, ) -> Result<(), S::Error>
Sets multiple asset information entries in a single batch operation.
This method provides an optimized way to store multiple asset entries at once, while automatically applying the worker’s namespace prefix.
§Errors
Returns the underlying store’s error type if the operation fails
Trait Implementations§
Source§impl<S: Clone + Store> Clone for WorkerStore<S>
impl<S: Clone + Store> Clone for WorkerStore<S>
Source§fn clone(&self) -> WorkerStore<S>
fn clone(&self) -> WorkerStore<S>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl<S> Freeze for WorkerStore<S>where
S: Freeze,
impl<S> RefUnwindSafe for WorkerStore<S>where
S: RefUnwindSafe,
impl<S> Send for WorkerStore<S>
impl<S> Sync for WorkerStore<S>
impl<S> Unpin for WorkerStore<S>where
S: Unpin,
impl<S> UnwindSafe for WorkerStore<S>where
S: UnwindSafe,
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> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
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> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request