Package-level declarations

Types

Link copied to clipboard
sealed interface Awakeable<T> : DurableFuture<T>

An Awakeable is a special type of DurableFuture which can be arbitrarily completed by another service, by addressing it with its id.

Link copied to clipboard
sealed interface AwakeableHandle

This class represents a handle to an Awakeable created in another service.

Link copied to clipboard
sealed interface CallDurableFuture<T> : DurableFuture<T>

The DurableFuture returned by a Context.call.

Link copied to clipboard
sealed interface Context

This interface exposes the Restate functionalities to Restate services. It can be used to interact with other Restate services, record non-deterministic closures, execute timers and synchronize with external systems.

Link copied to clipboard
sealed interface DurableFuture<T>

A DurableFuture allows to await an asynchronous result. Once await is called, the execution waits until the asynchronous result is available.

Link copied to clipboard
sealed interface DurablePromise<T>

A DurablePromise is a durable, distributed version of a Kotlin's Deferred, or more commonly of a future/promise. Restate keeps track of the DurablePromise across restarts/failures.

Link copied to clipboard
sealed interface DurablePromiseHandle<T>

This class represents a handle to a DurablePromise created in another service.

Link copied to clipboard
Link copied to clipboard
sealed interface InvocationHandle<Res>

An invocation handle, that can be used to interact with a running invocation.

Link copied to clipboard
Link copied to clipboard
object KtSerdes
Link copied to clipboard
object KtStateKey
Link copied to clipboard

This interface can be used only within exclusive handlers of virtual objects. It extends Context adding access to the virtual object instance key-value state storage.

Link copied to clipboard
class RestateRandom(seed: Long) : Random
Link copied to clipboard
data class RetryPolicy(val initialDelay: Duration, val exponentiationFactor: Float, val maxDelay: Duration? = null, val maxAttempts: Int? = null, val maxDuration: Duration? = null)

Retry policy configuration.

Link copied to clipboard
sealed interface SelectBuilder<in R>
Link copied to clipboard
sealed interface SelectClause<T>
Link copied to clipboard
sealed interface SharedObjectContext : Context

This interface can be used only within shared handlers of virtual objects. It extends Context adding access to the virtual object instance key-value state storage.

Link copied to clipboard

This interface can be used only within shared handlers of workflow. It extends Context adding access to the workflow instance key-value state storage and to the DurablePromise API.

Link copied to clipboard

Opt-in annotation to use the preview of new context features.

Link copied to clipboard

This interface can be used only within workflow handlers of workflow. It extends Context adding access to the workflow instance key-value state storage and to the DurablePromise API.

Properties

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

Functions

Link copied to clipboard
suspend fun <T> awaitAll(vararg durableFutures: DurableFuture<T>): List<T>

Like kotlinx.coroutines.awaitAll, but for DurableFuture.

Link copied to clipboard
suspend fun <T> Collection<DurableFuture<T>>.awaitAll(): List<T>

Like kotlinx.coroutines.awaitAll, but for DurableFuture.

Link copied to clipboard
inline suspend fun <T : Any> Context.awakeable(): Awakeable<T>

Create an Awakeable, addressable through Awakeable.id.

Link copied to clipboard
suspend fun <Req, Res> Request<Req, Res>.call(context: Context): CallDurableFuture<Res>

Shorthand for Context.call

Link copied to clipboard
Link copied to clipboard
inline suspend fun <T : Any> SharedObjectContext.get(key: String): T?
Link copied to clipboard
inline fun <Res> Context.invocationHandle(invocationId: String): InvocationHandle<Res>

Get an InvocationHandle for an already existing invocation. This will let you interact with a running invocation, for example to cancel it or retrieve its result.

Link copied to clipboard
inline suspend fun <T : Any> AwakeableHandle.resolve(payload: T)

Complete with success the Awakeable.

Link copied to clipboard
Link copied to clipboard
inline suspend fun <T : Any> Context.runAsync(name: String = "", retryPolicy: RetryPolicy? = null, noinline block: suspend () -> T): DurableFuture<T>

Execute a closure asynchronously. This is like runBlock, but it returns a DurableFuture that you can combine and select.

Link copied to clipboard
inline suspend fun <T : Any> Context.runBlock(name: String = "", retryPolicy: RetryPolicy? = null, noinline block: suspend () -> T): T

Execute a closure, recording the result value in the journal. The result value will be re-played in case of re-invocation (e.g. because of failure recovery or suspension point) without re-executing the closure.

Link copied to clipboard
inline suspend fun <R> select(crossinline builder: SelectBuilder<R>.() -> Unit): DurableFuture<R>

Like kotlinx.coroutines.selects.select, but for DurableFuture

Link copied to clipboard
suspend fun <Req, Res> Request<Req, Res>.send(context: Context, delay: Duration? = null): InvocationHandle<Res>

Shorthand for Context.send

Link copied to clipboard
inline suspend fun <T : Any> ObjectContext.set(key: String, value: T)
Link copied to clipboard
inline fun <T> stateKey(name: String): StateKey<T>