Struct SignalHandle<T>
- Namespace
- Restate.Sdk
- Assembly
- Restate.Sdk.dll
A handle to an unnamed signal a handler awaits: the Index that addresses it on this invocation, and the durable future that settles when the signal is resolved or rejected. Pass Index together with the invocation id — the one an InvocationHandle carries — to ResolveSignal<T>(string, int, T) or RejectSignal(string, int, string).
The handle 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 SignalHandle<T> : IDurableFuture<T>, IDurableFuture, IEquatable<SignalHandle<T>>
Type Parameters
T
- Implements
- Inherited Members
Constructors
SignalHandle(int, IDurableFuture<T>)
A handle to an unnamed signal a handler awaits: the Index that addresses it on this invocation, and the durable future that settles when the signal is resolved or rejected. Pass Index together with the invocation id — the one an InvocationHandle carries — to ResolveSignal<T>(string, int, T) or RejectSignal(string, int, string).
The handle 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 SignalHandle(int Index, IDurableFuture<T> Future)
Parameters
IndexintThe signal index this invocation allocated. It addresses the signal on this invocation and is unique within it; indices below the first user index are reserved for built-in signals.
FutureIDurableFuture<T>The durable future that settles when the signal is resolved or rejected.
Properties
Future
The durable future that settles when the signal is resolved or rejected.
public IDurableFuture<T> Future { get; init; }
Property Value
Index
The signal index this invocation allocated. It addresses the signal on this invocation and is unique within it; indices below the first user index are reserved for built-in signals.
public int Index { 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
Methods
GetResult()
Awaits the signal'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>