Skip to content

Commit cdea04e

Browse files
First pass at a select statement
1 parent 1a6a3a9 commit cdea04e

File tree

3 files changed

+10
-2
lines changed

3 files changed

+10
-2
lines changed

src/context/macro_support.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ use crate::endpoint::ContextInternal;
22
use restate_sdk_shared_core::NotificationHandle;
33

44
// Sealed future trait, used by select statement
5+
#[doc(hidden)]
56
pub trait SealedDurableFuture {
67
fn inner_context(&self) -> ContextInternal;
78
fn handle(&self) -> NotificationHandle;

src/context/select.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
// Thanks tokio for the help!
2+
// https://github.com/tokio-rs/tokio/blob/a258bff7018940b438e5de3fb846588454df4e4d/tokio/src/macros/select.rs
3+
// MIT License
4+
15
/// Select macro, alike tokio::select:
26
///
37
/// ```rust

test-services/src/virtual_object_command_interpreter.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,10 @@ impl VirtualObjectCommandInterpreter for VirtualObjectCommandInterpreterImpl {
106106
Command::AwaitAnySuccessful { .. } => Err(anyhow!(
107107
"AwaitAnySuccessful is currently unsupported in the Rust SDK"
108108
))?,
109-
Command::AwaitAwakeableOrTimeout { awakeable_key, timeout_millis } => {
109+
Command::AwaitAwakeableOrTimeout {
110+
awakeable_key,
111+
timeout_millis,
112+
} => {
110113
let (awakeable_id, awk_fut) = context.awakeable::<String>();
111114
context.set::<String>(&format!("awk-{awakeable_key}"), awakeable_id);
112115

@@ -118,7 +121,7 @@ impl VirtualObjectCommandInterpreter for VirtualObjectCommandInterpreterImpl {
118121
Err(TerminalError::new("await-timeout"))
119122
}
120123
}?;
121-
},
124+
}
122125
Command::AwaitOne { command } => {
123126
last_result = match command {
124127
AwaitableCommand::CreateAwakeable { awakeable_key } => {

0 commit comments

Comments
 (0)