API

Struct API 

Source
pub struct API<'s, S> { /* private fields */ }
Expand description

an instance of the CloudI API

Implementations§

Source§

impl<'s, S: 's> API<'s, S>

Source

pub fn new(thread_index: u32, state: &'s mut S) -> Result<Self>

creates an instance of the CloudI API

Source

pub fn subscribe(&mut self, pattern: &str, f: Callback<'s, S>) -> Result<()>

subscribes to a service name pattern with a function pointer callback (or a closure callback without a context)

Source

pub fn subscribe_count(&mut self, pattern: &str) -> Result<u32>

determine how many service name pattern subscriptions have occurred

Source

pub fn unsubscribe(&mut self, pattern: &str) -> Result<()>

unsubscribes from a service name pattern

Source

pub fn send_async( &mut self, name: &str, request: &Vec<u8>, timeout_opt: Option<u32>, request_info_opt: Option<Vec<u8>>, priority_opt: Option<i8>, ) -> Result<TransId>

asynchronous point-to-point communication to a service

Source

pub fn send_sync( &mut self, name: &str, request: &Vec<u8>, timeout_opt: Option<u32>, request_info_opt: Option<Vec<u8>>, priority_opt: Option<i8>, ) -> Result<(Vec<u8>, Vec<u8>, TransId)>

synchronous point-to-point communication to a service

Source

pub fn mcast_async( &mut self, name: &str, request: &Vec<u8>, timeout_opt: Option<u32>, request_info_opt: Option<Vec<u8>>, priority_opt: Option<i8>, ) -> Result<Vec<TransId>>

asynchronous point-multicast communication to services

Source

pub fn recv_async( &mut self, timeout_opt: Option<u32>, trans_id_opt: Option<TransId>, consume_opt: Option<bool>, ) -> Result<(Vec<u8>, Vec<u8>, TransId)>

asynchronously receive a response

Source

pub fn process_index(&self) -> u32

the 0-based index of this process in the service instance

Source

pub fn process_count(&self) -> u32

the current process count based on the service configuration

Source

pub fn process_count_max(&self) -> u32

the count_process_dynamic maximum count based on the service configuration

Source

pub fn process_count_min(&self) -> u32

the count_process_dynamic minimum count based on the service configuration

Source

pub fn prefix(&self) -> String

the service name pattern prefix from the service configuration

Source

pub fn timeout_initialize(&self) -> u32

the service initialization timeout from the service configuration

Source

pub fn timeout_async(&self) -> u32

the default asynchronous service request send timeout from the service configuration

Source

pub fn timeout_sync(&self) -> u32

the default synchronous service request send timeout from the service configuration

Source

pub fn timeout_terminate(&self) -> u32

the service termination timeout based on the service configuration

Source

pub fn priority_default(&self) -> i8

the default service request send priority from the service configuration

Source

pub fn poll(&mut self, timeout: i32) -> Result<bool>

blocks to process incoming CloudI service requests

Source

pub fn shutdown(&mut self, reason_opt: Option<String>) -> Result<()>

shutdown the service successfully

Auto Trait Implementations§

§

impl<'s, S> Freeze for API<'s, S>

§

impl<'s, S> RefUnwindSafe for API<'s, S>
where S: RefUnwindSafe,

§

impl<'s, S> Send for API<'s, S>
where S: Send,

§

impl<'s, S> Sync for API<'s, S>
where S: Sync,

§

impl<'s, S> Unpin for API<'s, S>

§

impl<'s, S> !UnwindSafe for API<'s, S>

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> 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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.