This is a prototype implementation of Rust SDK for Restate
Note: This is a work in progress and in rapid development stage. Updates will be posted on the blog
DO NOT USE IN PRODUCTION
- [] API
- [] Service
- [] State
- [] Virtual Object
- [] Workflow
- [] Awakeables
- [] Side Effect
- [] Logger
Run Restate
restate-server
Clean up
rm -rf restate-data
cd examples
cargo run --example <EXAMPLE>
For instance, run the first example
cargo run --example example4
Before running each example
restate dp add --yes http://localhost:3000
or
restate dp add --yes --force http://localhost:3000
curl --http2-prior-knowledge localhost:3000/discover
Basic service
cargo run --example example1
curl -v localhost:8080/Service/service -H 'content-type: application/json' -d '{"test": "test"}'
Manual implementation of traits
Side effects (run)
cargo run --example example3
curl -v localhost:8080/Service/service -H 'content-type: application/json' -d '{"test": "test"}'
External
Sleep and Awakeables
cargo run --example example5
curl -v localhost:8080/Service/service -H 'content-type: application/json' -d '{"test": "test"}'
curl -v localhost:8080/restate/awakeables/prom_1oPf3kPPfX0cBkO0f4USI2VmrwF_rtIFpAAAAAQ/resolve -H 'content-type: application/json' -d '{"test": "next"}'
With idempotency-key
curl -v localhost:8080/Service/service -H 'content-type: application/json' -H 'idempotency-key: example' -d '{"test": "test"}'
Virtual objects and state
cargo run --example object
curl -v localhost:8080/ObjectService/counter/increment -H 'content-type: application/json' -d '{"value": "100"}'
curl -v localhost:8080/ObjectService/counter/count -H 'content-type: application/json' -d '{"value": "100"}'
Workflows
cargo run --example workflow
curl -v localhost:8080/WorkflowService/workflow1/run -H 'content-type: application/json' -d '{"test": "test"}'
curl -v localhost:8080/WorkflowService/workflow1/signal -H 'content-type: application/json' -d '{"test": "await_user1"}'
curl -v localhost:8080/WorkflowService/workflow1/signal -H 'content-type: application/json' -d '{"test": "await_user2"}'
curl -v localhost:8080/WorkflowService/workflow1/signal -H 'content-type: application/json' -d '{"test": "await_user3"}'
curl -v localhost:8080/restate/workflow/WorkflowService/workflow1/attach
curl -v localhost:8080/restate/workflow/WorkflowService/workflow1/output
Combinators: TODO
cargo run --example combinator
curl -v localhost:8080/Service/select -H 'content-type: application/json' -d '{"test": "test"}'
curl -v localhost:8080/Service/join -H 'content-type: application/json' -d '{"test": "test"}'
restate invocations list
restate invocations describe inv_1i8DzzOL6iN178sv2hRPz1aZ32v3lNyhWh
restate invocations cancel --yes inv_1gSomuaZJqT10TzzSN1nTOFycg8aggtPrj
restate sql "SELECT * FROM sys_journal sj WHERE sj.id = 'inv_12fRY4rsDA5q1s8FL2KiWosO8gKLPxgPpT' ORDER BY index LIMIT 100"
curl -v localhost:9070/query -H 'content-type: application/json' -d "{ \"query\" : \"SELECT * FROM sys_journal sj WHERE sj.id = 'inv_1i7mrFgVA6eD1gnGo4q57KH9dzPZwZuBAl' ORDER BY index LIMIT 1000\" }" -o journal
restate sql "SELECT * FROM sys_journal sj WHERE sj.id = 'inv_13WTOp5Lirno0Wq44aUPUYVUhMfeLBElTH' ORDER BY index LIMIT 1000"
cargo +nightly fmt
cargo test test_handle_connection -- --nocapture
cargo test test_query -- --nocapture