Struct ObjectRef
pub struct ObjectRef { /* private fields */ }Expand description
A key of an object type, to call from outside workflow code.
Implementations§
§impl ObjectRef
impl ObjectRef
pub fn key(&self) -> &str
pub fn call<'a, A: Serialize + 'a, R: DeserializeOwned + 'a>(
&'a self,
handler: &'a str,
arg: &'a A,
) -> Op<CallOptions, impl Make<CallOptions, Output = Result<R>, Fut = impl Future<Output = Result<R>> + 'a> + 'a> ⓘ
pub fn call<'a, A: Serialize + 'a, R: DeserializeOwned + 'a>( &'a self, handler: &'a str, arg: &'a A, ) -> Op<CallOptions, impl Make<CallOptions, Output = Result<R>, Fut = impl Future<Output = Result<R>> + 'a> + 'a> ⓘ
Calls a handler and waits for its durable result. Without an ID a
retry is a new call; with .id(id), calls with the same ID run
once, and every one gets the recorded result.
pub async fn call_raw( &self, handler: &str, arg: Payload, id: &str, ) -> Result<(Status, Payload)>
pub fn send<'a, A: Serialize + 'a>(
&'a self,
handler: &'a str,
arg: &'a A,
) -> Op<CallOptions, impl Make<CallOptions, Output = Result<()>, Fut = impl Future<Output = Result<()>> + 'a> + 'a> ⓘ
pub fn send<'a, A: Serialize + 'a>( &'a self, handler: &'a str, arg: &'a A, ) -> Op<CallOptions, impl Make<CallOptions, Output = Result<()>, Fut = impl Future<Output = Result<()>> + 'a> + 'a> ⓘ
Calls a handler without waiting for its result: resolves once the
call is accepted (durable, and its handler started). .id(id) makes
a retried send run once.
pub async fn edit_state(&self, edit: &Value) -> Result<Value>
pub async fn edit_state(&self, edit: &Value) -> Result<Value>
Edits the state from outside its handlers (edit): an exclusive
call, so it waits for the key and commits as a handler’s writes do.
Returns {"version", "changed"}.
pub async fn set_state<V: Serialize>(
&self,
field: &str,
value: &V,
) -> Result<Value>
pub async fn set_state<V: Serialize>( &self, field: &str, value: &V, ) -> Result<Value>
Sets one field of the state.
pub async fn patch_state(&self, ops: &Value) -> Result<Value>
pub async fn patch_state(&self, ops: &Value) -> Result<Value>
Applies a JSON Patch (RFC 6902) to the state as one JSON object.
pub async fn clear_state(&self, field: Option<&str>) -> Result<Value>
pub async fn clear_state(&self, field: Option<&str>) -> Result<Value>
Clears one field, or (None) the whole state; the key remains.
pub async fn state(&self) -> Result<Value>
pub async fn state(&self) -> Result<Value>
The committed state, a JSON object ({} for a key never called).
Answered once it is durable.
pub async fn describe(&self) -> Result<RunDetail>
pub async fn describe(&self) -> Result<RunDetail>
The key’s run: its journal, state and pending calls.
Error::NotFound for a key never called.