Struct Awakeable<T>
- Namespace
- Restate.Sdk
- Assembly
- Restate.Sdk.dll
A durable promise that can be completed from outside the current invocation.
The awakeable is itself an IDurableFuture<T>, so it composes with All<T>(params ReadOnlySpan<IDurableFuture<T>>), Race<T>(params ReadOnlySpan<IDurableFuture<T>>), Any<T>(params ReadOnlySpan<IDurableFuture<T>>), AllSettled<T>(params ReadOnlySpan<IDurableFuture<T>>) and WaitAll(params IDurableFuture[]) without unwrapping Future.
public readonly record struct Awakeable<T> : IDurableFuture<T>, IDurableFuture, IEquatable<Awakeable<T>>
Type Parameters
T
- Implements
-
IEquatable<Awakeable<T>>
- Inherited Members
Properties
Future
The durable future that settles when the awakeable is resolved or rejected. The payload is deserialized on the first await of it or of Value, not when the runtime delivers it.
public required IDurableFuture<T> Future { get; init; }
Property Value
Id
The unique identifier for this awakeable. Pass this to an external system so it can resolve the awakeable when ready.
public required string Id { get; init; }
Property Value
InvocationId
The invocation id of the invocation this future started, or null.
Non-null only on a future returned by a call operation — CallFuture or a
future-returning typed client method — and only once the server has delivered the
id. Reading never blocks, so it is null between starting the call and the
notification arriving; awaiting the future is enough to make the id available.
Always null for futures that start no invocation: timers, side effects
(RunAsync), awakeables and signals. One-way sends do not return a future;
they hand back an InvocationHandle that always carries the id.
public string? InvocationId { get; }
Property Value
Remarks
Always null: an awakeable starts no invocation.
Value
The value that will be available once the awakeable is resolved.
public required ValueTask<T> Value { get; init; }
Property Value
- ValueTask<T>
Remarks
This value must only be awaited once.
Methods
GetResult()
Awaits the awakeable's value, forwarding to Future. Safe to await more than once: every await observes the same outcome and the same decoded value.
public ValueTask<T> GetResult()
Returns
- ValueTask<T>