Skip to main content

Client

Struct Client 

pub struct Client { /* private fields */ }
Expand description

A connection that sends calls to whichever worker holds the shards.

Implementations§

§

impl Client

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>

Like connect, with security given separately.

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

Whether the connection is gone: the server closed it, or it broke. Calls on a closed client fail at once.

pub fn close(&self) -> Result<()>

Closes the transport and wakes calls waiting for replies.

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>

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>

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>

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>

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>

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>

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>

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>

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>

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 ⓘ

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.

Trait Implementations§

§

impl Clone for Client

§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
§

impl Debug for Client

§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl Forget for Client

§

impl Freeze for Client

§

impl Move for Client

§

impl RefUnwindSafe for Client

§

impl Send for Client

§

impl Sync for Client

§

impl Unpin for Client

§

impl UnsafeUnpin for Client

§

impl UnwindSafe for Client

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.