Struct thingvellir::DataLoadRequest
source · pub struct DataLoadRequest<'a, Key: Send + 'static, Data: ServiceData> { /* private fields */ }
Expand description
The data load request is passed to LoadFromUpstream::load
handler.
It contains methods to notify the shard that the data has finished loading, or has failed to load.
If the DataLoadRequest is dropped, without sending a result, the shard will
receive an UpstreamError::OperationAborted
for the given key being loaded.
This prevents leaking load requests due to code error, where a code-path did
not use the data load request.
Implementations§
source§impl<'a, Key: Send, Data: ServiceData> DataLoadRequest<'a, Key, Data>
impl<'a, Key: Send, Data: ServiceData> DataLoadRequest<'a, Key, Data>
pub fn take_key(&mut self) -> Key
sourcepub fn reject<E: Into<UpstreamError>>(self, error: E)
pub fn reject<E: Into<UpstreamError>>(self, error: E)
Rejects the data load request with a given error. The error must be able to
be converted into an UpstreamError
.
source§impl<'a, Data: ServiceData, Key: Send + 'static> DataLoadRequest<'a, Key, Data>
impl<'a, Data: ServiceData, Key: Send + 'static> DataLoadRequest<'a, Key, Data>
source§impl<'a, Key: Send, Data: ServiceData + Default> DataLoadRequest<'a, Key, Data>
impl<'a, Key: Send, Data: ServiceData + Default> DataLoadRequest<'a, Key, Data>
sourcepub fn spawn_default<F: Future<Output = Result<Data, UpstreamError>> + Send + 'static>(
self,
fut: F,
)
pub fn spawn_default<F: Future<Output = Result<Data, UpstreamError>> + Send + 'static>( self, fut: F, )
Similar to spawn
, however, in event of encountering a UpstreamError::KeyNotFound
, error
will resolve with the value of Data::default
.
Trait Implementations§
source§impl<'a, Key: Send, Data: ServiceData> Drop for DataLoadRequest<'a, Key, Data>
impl<'a, Key: Send, Data: ServiceData> Drop for DataLoadRequest<'a, Key, Data>
Auto Trait Implementations§
impl<'a, Key, Data> Freeze for DataLoadRequest<'a, Key, Data>where
Key: Freeze,
impl<'a, Key, Data> !RefUnwindSafe for DataLoadRequest<'a, Key, Data>
impl<'a, Key, Data> Send for DataLoadRequest<'a, Key, Data>
impl<'a, Key, Data> Sync for DataLoadRequest<'a, Key, Data>where
Key: Sync,
impl<'a, Key, Data> Unpin for DataLoadRequest<'a, Key, Data>where
Key: Unpin,
impl<'a, Key, Data> !UnwindSafe for DataLoadRequest<'a, Key, Data>
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