Skip to content

Commit

Permalink
Feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
slinkydeveloper committed May 29, 2024
1 parent d95ee4c commit 2eedc30
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 24 deletions.
24 changes: 10 additions & 14 deletions sdk-api-kotlin/src/main/kotlin/dev/restate/sdk/kotlin/api.kt
Original file line number Diff line number Diff line change
Expand Up @@ -244,8 +244,8 @@ suspend inline fun <reified T : Any> Context.awakeable(): Awakeable<T> {
}

/**
* This interface extends [Context] adding access to the virtual object instance key-value state
* storage.
* 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.
*/
sealed interface SharedObjectContext : Context {

Expand All @@ -270,8 +270,8 @@ sealed interface SharedObjectContext : Context {
}

/**
* This interface extends [Context] adding access to the virtual object instance key-value state
* storage.
* 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.
*/
sealed interface ObjectContext : SharedObjectContext {

Expand All @@ -295,10 +295,8 @@ sealed interface ObjectContext : SharedObjectContext {
}

/**
* This interface extends [Context] adding access to the workflow instance key-value state storage
* and to the [DurablePromise] API.
*
* This interface can be used only within shared handlers of workflow classes/interfaces.
* 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.
*
* NOTE: This interface MUST NOT be accessed concurrently since it can lead to different orderings
* of user actions, corrupting the execution of the invocation.
Expand Down Expand Up @@ -327,10 +325,8 @@ sealed interface SharedWorkflowContext : SharedObjectContext {
}

/**
* This interface extends [Context] adding access to the workflow instance key-value state storage
* and to the [DurablePromise] API.
*
* This interface can be used only within workflow handlers of workflow classes/interfaces.
* 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.
*
* NOTE: This interface MUST NOT be accessed concurrently since it can lead to different orderings
* of user actions, corrupting the execution of the invocation.
Expand All @@ -348,7 +344,7 @@ class RestateRandom(seed: Long, private val syscalls: Syscalls) : Random() {
return r.nextBits(bitCount)
}

/** Generate a UUID */
/** Generate a UUID that is stable across retries and replays. */
fun nextUUID(): UUID {
return UUID(this.nextLong(), this.nextLong())
}
Expand All @@ -361,7 +357,7 @@ class RestateRandom(seed: Long, private val syscalls: Syscalls) : Random() {
* The result can be either a success or a failure. In case of a failure, [await] will throw a
* [dev.restate.sdk.core.TerminalException].
*
* @param T type of the awaitable result
* @param T type o1f the awaitable result
*/
sealed interface Awaitable<T> {
suspend fun await(): T
Expand Down
4 changes: 2 additions & 2 deletions sdk-api/src/main/java/dev/restate/sdk/ObjectContext.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
import org.jspecify.annotations.NonNull;

/**
* This interface extends {@link Context} adding access to the virtual object instance key-value
* state storage
* This interface can be used only within exclusive handlers of virtual objects. It extends {@link
* Context} adding access to the virtual object instance key-value state storage.
*
* <p>NOTE: This interface MUST NOT be accessed concurrently since it can lead to different
* orderings of user actions, corrupting the execution of the invocation.
Expand Down
2 changes: 1 addition & 1 deletion sdk-api/src/main/java/dev/restate/sdk/RestateRandom.java
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public synchronized void setSeed(long seed) {
}

/**
* @return a UUID generated using this RNG.
* @return a UUID generated using this RNG that is stable across retries and replays.
*/
public UUID nextUUID() {
return new UUID(this.nextLong(), this.nextLong());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
import java.util.Optional;

/**
* This interface extends {@link Context} adding access to the virtual object instance key-value
* state storage
* This interface can be used only within shared handlers of virtual objects. It extends {@link
* Context} adding access to the virtual object instance key-value state storage.
*
* <p>NOTE: This interface MUST NOT be accessed concurrently since it can lead to different
* orderings of user actions, corrupting the execution of the invocation.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@
import dev.restate.sdk.common.DurablePromiseKey;

/**
* This interface extends {@link Context} adding access to the workflow instance key-value state
* storage and to the {@link DurablePromise} API.
* This interface can be used only within shared handlers of workflow. It extends {@link Context}
* adding access to the workflow instance key-value state storage and to the {@link DurablePromise}
* API.
*
* <p>NOTE: This interface MUST NOT be accessed concurrently since it can lead to different
* orderings of user actions, corrupting the execution of the invocation.
Expand Down
5 changes: 3 additions & 2 deletions sdk-api/src/main/java/dev/restate/sdk/WorkflowContext.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@
package dev.restate.sdk;

/**
* This interface extends {@link Context} adding access to the workflow instance key-value state
* storage and to the {@link DurablePromise} API.
* This interface can be used only within workflow handlers of workflow. It extends {@link Context}
* adding access to the workflow instance key-value state storage and to the {@link DurablePromise}
* API.
*
* <p>NOTE: This interface MUST NOT be accessed concurrently since it can lead to different
* orderings of user actions, corrupting the execution of the invocation.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,12 @@

/**
* Defines a method as a Shared handler. It can be used only on methods of either {@link
* VirtualObject} or {@link Workflow}. This implies the annotation {@link Handler}.
* VirtualObject} or {@link Workflow}.
*
* <p>Shared handlers can execute concurrently with the other handlers of Virtual Objects or
* Workflows. They can therefore not set or clear state.
*
* <p>This implies the annotation {@link Handler}.
*/
@Target(ElementType.METHOD)
@Retention(RetentionPolicy.SOURCE)
Expand Down

0 comments on commit 2eedc30

Please sign in to comment.