Skip to content

Commit

Permalink
Only use marking and no focus on use case pages
Browse files Browse the repository at this point in the history
  • Loading branch information
gvdongen committed Jun 11, 2024
1 parent 21f08ac commit 257005a
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 24 deletions.
4 changes: 1 addition & 3 deletions code_snippets/ts/src/use_cases/signup_workflow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import * as restate from "@restatedev/restate-sdk";
import {TerminalError, WorkflowContext, WorkflowSharedContext} from "@restatedev/restate-sdk";

// <start_here>
const signUpWorkflow = restate.workflow({
export default restate.workflow({
name: "sign-up-workflow",
handlers: {
run: async (ctx: WorkflowContext, user: User) => {
Expand Down Expand Up @@ -41,8 +41,6 @@ const signUpWorkflow = restate.workflow({
});
// <end_here>

export type SignUpWorkflow = typeof signUpWorkflow;

type KafkaEvent = { topic: string, message: string };
export type User = { id: string, name: string, email: string };

Expand Down
16 changes: 5 additions & 11 deletions docs/use-cases/event-processing.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ Restate pushes the events to your function.
Here, we postpone processing for 5 seconds if the user profile is not ready yet.


```ts user_updates.ts focus=6:11 mark=9
```ts user_updates.ts mark=9
CODE_LOAD::ts/src/use_cases/event_processing.ts
```

Expand All @@ -109,7 +109,7 @@ Restate pushes the events to your function.

The results of interactions with external systems are tracked and recovered after failures. This simplifies writing flows that keep multiple systems in sync.

```ts user_updates.ts focus=7,10,13:14 mark=7,10,13:14
```ts user_updates.ts mark=7,10,13:14
CODE_LOAD::ts/src/use_cases/event_processing.ts
```

Expand All @@ -121,7 +121,7 @@ Restate pushes the events to your function.
Each event craft its own path through the code
and builds up its own recovery log.

```ts user_updates.ts focus=6:14
```ts user_updates.ts mark=8:14
CODE_LOAD::ts/src/use_cases/event_processing.ts
```

Expand All @@ -140,15 +140,9 @@ Restate pushes the events to your function.

## Stateful event processing with Restate

<CH.Scrollycoding className={"workflows-scroller"}>

Implement stateful event handlers with Restate.
Implement stateful event handlers with Restate.

```ts profile_service.ts
CODE_LOAD::ts/src/use_cases/events_state.ts
```
---
<CH.Scrollycoding className={"workflows-scroller"}>

### K/V State
Store state in Restate and access it from other handlers.
Expand Down
8 changes: 4 additions & 4 deletions docs/use-cases/microservice-orchestration.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ Turn functions into durable handlers with the Restate SDK.
Restate makes them distributed and durable out-of-the-box.


```ts role_updater.ts mark=1,4 focus=1:4,25
```ts role_updater.ts mark=1,4
CODE_LOAD::ts/src/use_cases/role_updater.ts
```

Expand All @@ -60,7 +60,7 @@ Turn functions into durable handlers with the Restate SDK.
Other updates to the same user are queued and processed in order.
Updates either succeed or fail, but never leave the user in an inconsistent state.

```ts role_updater.ts mark=4 focus=1:4,25
```ts role_updater.ts mark=4
CODE_LOAD::ts/src/use_cases/role_updater.ts
```

Expand All @@ -71,7 +71,7 @@ Turn functions into durable handlers with the Restate SDK.
Store results of interaction with external systems or non-deterministic actions.
On retries, the action does not get re-executed but the previous result will be returned.

```ts role_updater.ts focus=1:5,24,7,8,13:14 mark=7,8,13:14
```ts role_updater.ts mark=7,8,13:14
CODE_LOAD::ts/src/use_cases/role_updater.ts
```

Expand All @@ -84,7 +84,7 @@ Turn functions into durable handlers with the Restate SDK.

Here, we update the users role in multiple systems. If one fails, we rollback the changes in the other systems.

```ts role_updater.ts focus=10:24 mark=12:16,18
```ts role_updater.ts mark=12:16,18
CODE_LOAD::ts/src/use_cases/role_updater.ts
```

Expand Down
12 changes: 6 additions & 6 deletions docs/use-cases/workflows.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ Implement the `run` function of your workflow, using the Restate SDK.
A workflow runs exactly one time.
Restate makes sure that duplicate requests do not lead to duplicate execution.

```ts user_sign_up_flow.ts focus=1:4,25 mark=1:4,25
```ts user_sign_up_flow.ts mark=1:4,25
CODE_LOAD::ts/src/use_cases/signup_workflow.ts
```

Expand All @@ -60,7 +60,7 @@ Implement the `run` function of your workflow, using the Restate SDK.
This lets you execute the steps of your workflows durably.

<CH.Code>
```ts user_sign_up_flow.ts focus=1:4,24,8,11,12 mark=8,11,12
```ts user_sign_up_flow.ts mark=8,11,12
CODE_LOAD::ts/src/use_cases/signup_workflow.ts
```
</CH.Code>
Expand All @@ -72,7 +72,7 @@ Implement the `run` function of your workflow, using the Restate SDK.
Use Restates built-in key-value store to store workflow state.
Restate guarantees that it is consistent and persistent, since state updates are tracked together with the rest of the execution progress.

```ts user_sign_up_flow.ts focus=1:4,24,8,11,12,7,10,20,23 mark=7,10,20,23
```ts user_sign_up_flow.ts mark=7,10,20,23
CODE_LOAD::ts/src/use_cases/signup_workflow.ts
```

Expand All @@ -82,7 +82,7 @@ Implement the `run` function of your workflow, using the Restate SDK.

Retrieve the current state of the workflow from within other handlers and expose it to external clients.

```ts user_sign_up_flow.ts focus=1:4,24,8,11,12,7,10,20,23,27 mark=27
```ts user_sign_up_flow.ts mark=27
CODE_LOAD::ts/src/use_cases/signup_workflow.ts
```

Expand All @@ -93,7 +93,7 @@ Implement the `run` function of your workflow, using the Restate SDK.
Make Promises/Futures resilient by registering them in Restate.
Share them and wait until other functions resolve them.

```ts user_sign_up_flow.ts focus=1:4,24,8,11,12,7,10,20,23,26:28,15 mark=15
```ts user_sign_up_flow.ts mark=15
CODE_LOAD::ts/src/use_cases/signup_workflow.ts
```

Expand All @@ -104,7 +104,7 @@ Implement the `run` function of your workflow, using the Restate SDK.
Notify the workflow of external signals, callbacks or Kafka events.
Resolve or reject shared promises on which the workflow is waiting. The workflow handles the outcome.

```ts user_sign_up_flow.ts focus=1:4,24,8,11,12,7,10,20,23,26:28,15,29:37 mark=29:35
```ts user_sign_up_flow.ts mark=29:35
CODE_LOAD::ts/src/use_cases/signup_workflow.ts
```

Expand Down

0 comments on commit 257005a

Please sign in to comment.