pub struct API<'s, S> { /* private fields */ }Expand description
an instance of the CloudI API
Implementations§
Source§impl<'s, S: 's> API<'s, S>
impl<'s, S: 's> API<'s, S>
Sourcepub fn new(thread_index: u32, state: &'s mut S) -> Result<Self>
pub fn new(thread_index: u32, state: &'s mut S) -> Result<Self>
creates an instance of the CloudI API
Sourcepub fn subscribe(&mut self, pattern: &str, f: Callback<'s, S>) -> Result<()>
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)
Sourcepub fn subscribe_count(&mut self, pattern: &str) -> Result<u32>
pub fn subscribe_count(&mut self, pattern: &str) -> Result<u32>
determine how many service name pattern subscriptions have occurred
Sourcepub fn unsubscribe(&mut self, pattern: &str) -> Result<()>
pub fn unsubscribe(&mut self, pattern: &str) -> Result<()>
unsubscribes from a service name pattern
Sourcepub 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>
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
Sourcepub 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)>
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
Sourcepub 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>>
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
Sourcepub fn recv_async(
&mut self,
timeout_opt: Option<u32>,
trans_id_opt: Option<TransId>,
consume_opt: Option<bool>,
) -> Result<(Vec<u8>, Vec<u8>, TransId)>
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
Sourcepub fn process_index(&self) -> u32
pub fn process_index(&self) -> u32
the 0-based index of this process in the service instance
Sourcepub fn process_count(&self) -> u32
pub fn process_count(&self) -> u32
the current process count based on the service configuration
Sourcepub fn process_count_max(&self) -> u32
pub fn process_count_max(&self) -> u32
the count_process_dynamic maximum count based on the service configuration
Sourcepub fn process_count_min(&self) -> u32
pub fn process_count_min(&self) -> u32
the count_process_dynamic minimum count based on the service configuration
Sourcepub fn timeout_initialize(&self) -> u32
pub fn timeout_initialize(&self) -> u32
the service initialization timeout from the service configuration
Sourcepub fn timeout_async(&self) -> u32
pub fn timeout_async(&self) -> u32
the default asynchronous service request send timeout from the service configuration
Sourcepub fn timeout_sync(&self) -> u32
pub fn timeout_sync(&self) -> u32
the default synchronous service request send timeout from the service configuration
Sourcepub fn timeout_terminate(&self) -> u32
pub fn timeout_terminate(&self) -> u32
the service termination timeout based on the service configuration
Sourcepub fn priority_default(&self) -> i8
pub fn priority_default(&self) -> i8
the default service request send priority from the service configuration