Package-level declarations

Types

Link copied to clipboard
sealed interface AnyAwaitable : Awaitable<Any>
Link copied to clipboard
sealed interface Awaitable<T>

An Awaitable 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 Awakeable<T> : Awaitable<T>

An Awakeable is a special type of Awaitable 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 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 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
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, syscalls: Syscalls) : 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.

Functions

Link copied to clipboard
suspend fun <T> Client.IdempotentInvocationHandle<T>.attachSuspend(options: RequestOptions = RequestOptions.DEFAULT): T
suspend fun <T> Client.InvocationHandle<T>.attachSuspend(options: RequestOptions = RequestOptions.DEFAULT): T
suspend fun <T> Client.WorkflowHandle<T>.attachSuspend(options: RequestOptions = RequestOptions.DEFAULT): T
Link copied to clipboard
suspend fun <T> awaitAll(vararg awaitables: Awaitable<T>): List<T>

Like kotlinx.coroutines.awaitAll, but for Awaitable.

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

Like kotlinx.coroutines.awaitAll, but for Awaitable.

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

Create an Awakeable using KtSerdes.json deserializer, addressable through Awakeable.id.

Link copied to clipboard
suspend fun <Req, Res> Client.callSuspend(target: Target, reqSerde: Serde<Req>, resSerde: Serde<Res>, req: Req, options: RequestOptions = RequestOptions.DEFAULT): Res
Link copied to clipboard
suspend fun <T> Client.IdempotentInvocationHandle<T>.getOutputSuspend(options: RequestOptions = RequestOptions.DEFAULT): Output<T>
suspend fun <T> Client.InvocationHandle<T>.getOutputSuspend(options: RequestOptions = RequestOptions.DEFAULT): Output<T>
suspend fun <T> Client.WorkflowHandle<T>.getOutputSuspend(options: RequestOptions = RequestOptions.DEFAULT): Output<T>
Link copied to clipboard
suspend fun Client.AwakeableHandle.rejectSuspend(reason: String, options: RequestOptions = RequestOptions.DEFAULT)
Link copied to clipboard
inline suspend fun <T : Any> AwakeableHandle.resolve(payload: T)

Complete with success the Awakeable using KtSerdes.json serializer.

Link copied to clipboard
suspend fun <T : Any> Client.AwakeableHandle.resolveSuspend(serde: Serde<T>, payload: T, options: RequestOptions = RequestOptions.DEFAULT)
Link copied to clipboard
Link copied to clipboard
inline suspend fun <T : Any> Context.runBlock(name: String = "", noinline block: suspend () -> T): T

Execute a non-deterministic closure, recording the result value in the journal using KtSerdes.json. 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. Use this feature if you want to perform non-deterministic operations.

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

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

Link copied to clipboard
suspend fun <Req> Client.sendSuspend(target: Target, reqSerde: Serde<Req>, req: Req, delay: Duration = Duration.ZERO, options: RequestOptions = RequestOptions.DEFAULT): SendResponse