Trait restate_sdk_shared_core::VM
source · pub trait VM: Sized {
Show 27 methods
// Required methods
fn new(request_headers: impl HeaderMap) -> VMResult<Self>;
fn get_response_head(&self) -> ResponseHead;
fn notify_input(&mut self, buffer: Bytes);
fn notify_input_closed(&mut self);
fn notify_error(
&mut self,
message: Cow<'static, str>,
description: Cow<'static, str>,
next_retry_delay: Option<Duration>,
);
fn take_output(&mut self) -> TakeOutputResult;
fn is_ready_to_execute(&self) -> Result<bool, VMError>;
fn notify_await_point(&mut self, handle: AsyncResultHandle);
fn take_async_result(
&mut self,
handle: AsyncResultHandle,
) -> Result<Option<Value>, SuspendedOrVMError>;
fn sys_input(&mut self) -> VMResult<Input>;
fn sys_state_get(&mut self, key: String) -> VMResult<AsyncResultHandle>;
fn sys_state_get_keys(&mut self) -> VMResult<AsyncResultHandle>;
fn sys_state_set(&mut self, key: String, value: Bytes) -> VMResult<()>;
fn sys_state_clear(&mut self, key: String) -> VMResult<()>;
fn sys_state_clear_all(&mut self) -> VMResult<()>;
fn sys_sleep(&mut self, duration: Duration) -> VMResult<AsyncResultHandle>;
fn sys_call(
&mut self,
target: Target,
input: Bytes,
) -> VMResult<AsyncResultHandle>;
fn sys_send(
&mut self,
target: Target,
input: Bytes,
delay: Option<Duration>,
) -> VMResult<()>;
fn sys_awakeable(&mut self) -> VMResult<(String, AsyncResultHandle)>;
fn sys_complete_awakeable(
&mut self,
id: String,
value: NonEmptyValue,
) -> VMResult<()>;
fn sys_get_promise(&mut self, key: String) -> VMResult<AsyncResultHandle>;
fn sys_peek_promise(&mut self, key: String) -> VMResult<AsyncResultHandle>;
fn sys_complete_promise(
&mut self,
key: String,
value: NonEmptyValue,
) -> VMResult<AsyncResultHandle>;
fn sys_run_enter(&mut self, name: String) -> VMResult<RunEnterResult>;
fn sys_run_exit(
&mut self,
value: RunExitResult,
retry_policy: RetryPolicy,
) -> VMResult<AsyncResultHandle>;
fn sys_write_output(&mut self, value: NonEmptyValue) -> VMResult<()>;
fn sys_end(&mut self) -> VMResult<()>;
}Required Methods§
fn new(request_headers: impl HeaderMap) -> VMResult<Self>
fn get_response_head(&self) -> ResponseHead
fn notify_input(&mut self, buffer: Bytes)
fn notify_input_closed(&mut self)
fn notify_error( &mut self, message: Cow<'static, str>, description: Cow<'static, str>, next_retry_delay: Option<Duration>, )
fn take_output(&mut self) -> TakeOutputResult
fn is_ready_to_execute(&self) -> Result<bool, VMError>
fn notify_await_point(&mut self, handle: AsyncResultHandle)
sourcefn take_async_result(
&mut self,
handle: AsyncResultHandle,
) -> Result<Option<Value>, SuspendedOrVMError>
fn take_async_result( &mut self, handle: AsyncResultHandle, ) -> Result<Option<Value>, SuspendedOrVMError>
Ok(None) means the result is not ready.
fn sys_input(&mut self) -> VMResult<Input>
fn sys_state_get(&mut self, key: String) -> VMResult<AsyncResultHandle>
fn sys_state_get_keys(&mut self) -> VMResult<AsyncResultHandle>
fn sys_state_set(&mut self, key: String, value: Bytes) -> VMResult<()>
fn sys_state_clear(&mut self, key: String) -> VMResult<()>
fn sys_state_clear_all(&mut self) -> VMResult<()>
fn sys_sleep(&mut self, duration: Duration) -> VMResult<AsyncResultHandle>
fn sys_call( &mut self, target: Target, input: Bytes, ) -> VMResult<AsyncResultHandle>
fn sys_send( &mut self, target: Target, input: Bytes, delay: Option<Duration>, ) -> VMResult<()>
fn sys_awakeable(&mut self) -> VMResult<(String, AsyncResultHandle)>
fn sys_complete_awakeable( &mut self, id: String, value: NonEmptyValue, ) -> VMResult<()>
fn sys_get_promise(&mut self, key: String) -> VMResult<AsyncResultHandle>
fn sys_peek_promise(&mut self, key: String) -> VMResult<AsyncResultHandle>
fn sys_complete_promise( &mut self, key: String, value: NonEmptyValue, ) -> VMResult<AsyncResultHandle>
fn sys_run_enter(&mut self, name: String) -> VMResult<RunEnterResult>
fn sys_run_exit( &mut self, value: RunExitResult, retry_policy: RetryPolicy, ) -> VMResult<AsyncResultHandle>
fn sys_write_output(&mut self, value: NonEmptyValue) -> VMResult<()>
fn sys_end(&mut self) -> VMResult<()>
Object Safety§
This trait is not object safe.