Struct Client
pub struct Client { /* private fields */ }Expand description
A connection that sends calls to whichever worker holds the shards.
Implementations§
§impl Client
impl Client
pub fn connect(addr: &str) -> Result<Self>
pub fn connect(addr: &str) -> Result<Self>
Connects to addr (host:port, unix:/path.sock or
replicas://..., with optional connection options such as
?ca=ca.pem&token-file=token; see
Security::from_options).
pub fn connect_with(addr: &str, security: &Security) -> Result<Self>
pub fn connect_with(addr: &str, security: &Security) -> Result<Self>
Like connect, with security given separately.
pub fn in_process(server: &Arc<Server>) -> Result<Self>
pub fn in_process(server: &Arc<Server>) -> Result<Self>
A client of server in this process, over a socket pair: no TLS or
token (nothing leaves the process), a client’s scope (calls, no
shards). The server’s side runs on the current Tokio runtime.
pub fn is_closed(&self) -> bool
pub fn is_closed(&self) -> bool
Whether the connection is gone: the server closed it, or it broke. Calls on a closed client fail at once.
pub fn call(&self, method: &str, args: &Value) -> Result<Value, Error>
pub fn call(&self, method: &str, args: &Value) -> Result<Value, Error>
Sends a call and waits for the worker’s answer.
pub fn complete(&self, token: &str, value: &Value) -> Result<(), Error>
pub fn complete(&self, token: &str, value: &Value) -> Result<(), Error>
Finishes an async completion from its token.
pub fn fail(&self, token: &str, error: &str) -> Result<(), Error>
pub fn start(&self, wtype: &str, id: &str, input: &Value) -> Result<(), Error>
pub fn start_with(
&self,
wtype: &str,
id: &str,
input: &Value,
options: &StartOptions,
) -> Result<(), Error>
pub fn start_with( &self, wtype: &str, id: &str, input: &Value, options: &StartOptions, ) -> Result<(), Error>
Starts or attaches to a workflow with the same options as an embedded worker.
pub fn update_with_start( &self, wtype: &str, id: &str, input: &Value, options: &StartOptions, name: &str, update_id: &str, arg: &Value, ) -> Result<Value, Error>
pub fn list_where(&self, filter: &Value, limit: usize) -> Result<Value, Error>
pub fn list_where(&self, filter: &Value, limit: usize) -> Result<Value, Error>
Runs matching filter, up to limit per shard, from every worker
holding shards, in shard order. Fails at once if a shard has no
holder right now.
pub fn list(&self, limit: usize) -> Result<Value, Error>
pub fn list(&self, limit: usize) -> Result<Value, Error>
Runs, up to limit per shard, as list_where
without a filter.
pub fn reset( &self, id: &str, before_step: &str, reapply_signals: bool, ) -> Result<(), Error>
pub fn signal(&self, id: &str, name: &str, value: &Value) -> Result<(), Error>
pub fn update( &self, id: &str, name: &str, update_id: &str, arg: &Value, ) -> Result<Value, Error>
pub fn query(&self, id: &str, name: &str, arg: &Value) -> Result<Value, Error>
pub fn object_call(
&self,
wtype: &str,
key: &str,
handler: &str,
arg: &Value,
call_id: &str,
) -> Result<Value, Error>
pub fn object_call( &self, wtype: &str, key: &str, handler: &str, arg: &Value, call_id: &str, ) -> Result<Value, Error>
Calls handler handler of key key of object type wtype (see
fusee::object) and waits for its durable result. Calls with the
same call_id (empty: none) run once and get the recorded result.
pub fn object_send(
&self,
wtype: &str,
key: &str,
handler: &str,
arg: &Value,
call_id: &str,
) -> Result<(), Error>
pub fn object_send( &self, wtype: &str, key: &str, handler: &str, arg: &Value, call_id: &str, ) -> Result<(), Error>
object_call without waiting for the result:
returns once the call is accepted.
pub fn object_state(&self, wtype: &str, key: &str) -> Result<Value, Error>
pub fn object_state(&self, wtype: &str, key: &str) -> Result<Value, Error>
The committed state of key key of object type wtype ({} for a
key never called).
pub fn result(&self, id: &str) -> Result<Value, Error>
pub fn cancel(&self, id: &str, reason: &str) -> Result<(), Error>
pub fn resume(&self, id: &str) -> Result<(), Error>
pub fn resume(&self, id: &str) -> Result<(), Error>
Resumes a paused run: its step runs again with a fresh retry budget.
pub fn terminate(&self, id: &str, reason: &str) -> Result<(), Error>
pub fn stream_read(
&self,
id: &str,
run: Option<u64>,
name: &str,
from: u64,
wait_ms: u64,
) -> Result<StreamBatch, Error>
pub fn stream_read( &self, id: &str, run: Option<u64>, name: &str, from: u64, wait_ms: u64, ) -> Result<StreamBatch, Error>
One read of stream name of workflow id from offset from: the
durable chunks there are, else those appended within wait_ms (at
most a minute), and the end once the read has every chunk. run
keeps reading the run an earlier read named. The worker holding the
ID’s shard answers.
pub fn stream(&self, id: &str, name: &str, from: u64) -> ClientStream ⓘ
pub fn stream(&self, id: &str, name: &str, from: u64) -> ClientStream ⓘ
A reader of stream name of workflow id from offset from: an
iterator of chunks that blocks until each is durable and ends once
the stream is complete. After a lost connection, a new reader from
ClientStream::offset continues exactly there.