pub struct DurableHandle { /* private fields */ }Expand description
The out-of-band entry point that resolves pending promises.
Cheap to clone (it holds only an Arc to the shared backend) and Send + Sync, so it can be
handed to an operator command handler or an A2A reply path. It deliberately exposes only
resolve: a holder can complete a promise given the matching token but
can neither create nor inspect executions.
Implementations§
Source§impl DurableHandle
impl DurableHandle
Sourcepub fn new(backend: Arc<DurableBackendEnum>) -> Self
pub fn new(backend: Arc<DurableBackendEnum>) -> Self
Build a resolver handle over the shared backend.
Sourcepub async fn resolve<T: Serialize>(
&self,
id: PromiseId,
resolver_token: &[u8; 32],
value: T,
) -> Result<(), DurableError>
pub async fn resolve<T: Serialize>( &self, id: PromiseId, resolver_token: &[u8; 32], value: T, ) -> Result<(), DurableError>
Resolve a promise by presenting its resolver token and the completion value (FR-DE-05).
The token is hashed (domain-separated, bound to (promise_id, execution_id)) and compared in
constant time against the stored hash. On a match the value is sealed and committed and any
in-process waiter is woken; resolving an already-resolved promise with the correct token is a
no-op success. A wrong token is rejected with DurableError::PromiseRejected and leaves the
promise untouched.
§Errors
DurableError::UnknownPromiseif no promise withidexists.DurableError::PromiseRejectedifresolver_tokendoes not authenticate.DurableError::Serializeifvaluecannot be serialized, or a storage error from the backend.
Trait Implementations§
Source§impl Clone for DurableHandle
impl Clone for DurableHandle
Source§fn clone(&self) -> DurableHandle
fn clone(&self) -> DurableHandle
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl !RefUnwindSafe for DurableHandle
impl !UnwindSafe for DurableHandle
impl Freeze for DurableHandle
impl Send for DurableHandle
impl Sync for DurableHandle
impl Unpin for DurableHandle
impl UnsafeUnpin for DurableHandle
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