[−][src]Struct rustypipes::OctopipesServer
OctopipesServer
OctopipesServer
is a container for an Octopipes Server
Methods
impl OctopipesServer
[src]
pub fn new(
version: OctopipesProtocolVersion,
cap_pipe: String,
client_folder: String
) -> OctopipesServer
[src]
version: OctopipesProtocolVersion,
cap_pipe: String,
client_folder: String
) -> OctopipesServer
new
new
instances a new OctopipesServer
pub fn stop_server(&mut self) -> Result<(), OctopipesServerError>
[src]
stop_server
stop_server
stops the octopipes server (workers and cap listener)
pub fn start_cap_listener(&mut self) -> Result<(), OctopipesServerError>
[src]
start_cap_listener
start_cap_listener
Start CAP listener thread
pub fn stop_cap_listener(&mut self) -> Result<(), OctopipesServerError>
[src]
stop_cap_listener
stop_cap_listener
stops the server cap listener thread
pub fn start_worker(
&mut self,
client: String,
subscriptions: Vec<String>,
cli_tx_pipe: String,
cli_rx_pipe: String
) -> Result<(), OctopipesServerError>
[src]
&mut self,
client: String,
subscriptions: Vec<String>,
cli_tx_pipe: String,
cli_rx_pipe: String
) -> Result<(), OctopipesServerError>
start_worker
start_worker
add and starts a new worker for the Octopipes Server. The server must be in Running state
pub fn stop_worker(
&mut self,
client: &String
) -> Result<(), OctopipesServerError>
[src]
&mut self,
client: &String
) -> Result<(), OctopipesServerError>
stop_worker
stop_worker
stops a running worker for the Octopipes Server. The server must be in Running state
pub fn dispatch_message(
&self,
message: &OctopipesMessage
) -> Result<(), (Option<String>, OctopipesServerError)>
[src]
&self,
message: &OctopipesMessage
) -> Result<(), (Option<String>, OctopipesServerError)>
dispatch_message
dispatch_message
Dispatch a message to subscribed nodes. Returns error with the error type and the client id of the worker associated which returned an error
pub fn process_cap_once(&mut self) -> Result<usize, OctopipesServerError>
[src]
process_cap_once
process_cap_once
Reads up to one message from the CAP receiver and process it.
When Ok, returns the amount of messages processed (0/1), otherwise an Error
pub fn process_cap_all(&mut self) -> Result<usize, OctopipesServerError>
[src]
process_cap_all
process_cap_all
Reads all the available messages on the CAP until no one is available.
When Ok, returns the amount of messages processed, otherwise Error
pub fn manage_cap_message(
&mut self,
message: &OctopipesMessage
) -> Result<OctopipesCapMessage, OctopipesServerError>
[src]
&mut self,
message: &OctopipesMessage
) -> Result<OctopipesCapMessage, OctopipesServerError>
manage_cap_message
manage_cap_message
Takes a Message from CAP and based on its type perform an action to the server.
If necessary it also responds to the client through the CAP.
(e.g. in case of subscription it will send an assignment back)
pub fn process_first(&self) -> Result<usize, (String, OctopipesServerError)>
[src]
process_first
process_first
Find the first Worker which has an available message to process and dispatch it
When OK is returned, the number of processed workers is returned
If no worker has a message to process, the function will just return Ok
If an error was returned during the process, the function will return Error((client_id, Error))
pub fn process_once(&self) -> Result<usize, (String, OctopipesServerError)>
[src]
process_once
process_once
For each worker process the first message in its inbox. If the worker has no message it will be just ignored.
When OK is returned, the number of processed workers is returned
If no worker has a message to process, the function will just return Ok
If an error was returned during the process, the function will return Error((client_id, Error))
pub fn process_all(&self) -> Result<usize, (String, OctopipesServerError)>
[src]
process_once
process_once
For each worker process the first message in its inbox. If the worker has no message it will be just ignored.
Once all the workers have been process the function will restart until all the workers has no more message in their inbox.
When OK is returned, the number of processed workers is returned
If no worker has a message to process, the function will just return Ok
If an error was returned during the process, the function will return Error((client_id, Error))
pub fn is_subscribed(&self, client: String) -> Option<Instant>
[src]
is_subscribed
is_subscribed
returns whether a client with a certain ID is subscribed or not
pub fn get_subscriptions(&self, client: String) -> Option<Vec<String>>
[src]
get_subscriptions
get_subscriptions
Get all the subscriptions for a certain client
pub fn get_clients(&self) -> Vec<String>
[src]
get_clients
get_clients
Get all the clients id subscribed to the server
Trait Implementations
impl Drop for OctopipesServer
[src]
Auto Trait Implementations
impl !RefUnwindSafe for OctopipesServer
impl Send for OctopipesServer
impl !Sync for OctopipesServer
impl Unpin for OctopipesServer
impl !UnwindSafe for OctopipesServer
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,