pub trait ContextAbstraction:
Debug
+ Send
+ Sync {
type Props;
Show 22 methods
// Required methods
fn name(&self) -> Option<&String>;
fn fq_name(&self) -> Option<String>;
fn state(&self) -> OperationState;
fn set_state(&self, state: OperationState) -> Result<()>;
fn uuid(&self) -> String;
fn prefix(&self) -> Option<&String>;
fn mode(&self) -> &String;
fn default_session(&self) -> Arc<Session>;
fn session(&self, session_id: &str) -> Option<Arc<Session>>;
fn sender(&self) -> &Sender<TaskSignal>;
fn read(&self) -> Result<RwLockReadGuard<'_, Self::Props>>;
fn write(&self) -> Result<RwLockWriteGuard<'_, Self::Props>>;
fn put_with(&self, selector: &str, message: Message) -> Result<()>;
fn delete_with(&self, selector: &str) -> Result<()>;
fn get_with(
&self,
selector: &str,
message: Option<Message>,
callback: Option<&mut dyn FnMut(QueryableMsg) -> Result<()>>,
) -> Result<()>;
fn observe_with(
&self,
selector: &str,
message: Option<Message>,
) -> Result<()>;
fn cancel_observe_with(&self, selector: &str) -> Result<()>;
// Provided methods
fn put(&self, topic: &str, message: Message) -> Result<()> { ... }
fn delete(&self, topic: &str) -> Result<()> { ... }
fn get(
&self,
topic: &str,
message: Option<Message>,
callback: Option<&mut dyn FnMut(QueryableMsg) -> Result<()>>,
) -> Result<()> { ... }
fn observe(&self, topic: &str, message: Option<Message>) -> Result<()> { ... }
fn cancel_observe(&self, topic: &str) -> Result<()> { ... }
}Expand description
Commonalities for the context
Required Associated Types§
Required Methods§
Sourcefn state(&self) -> OperationState
fn state(&self) -> OperationState
Sourcefn set_state(&self, state: OperationState) -> Result<()>
fn set_state(&self, state: OperationState) -> Result<()>
Set the OperationState.
Setting new state is done step by step
§Errors
Sourcefn default_session(&self) -> Arc<Session>
fn default_session(&self) -> Arc<Session>
Get default session reference
Sourcefn sender(&self) -> &Sender<TaskSignal>
fn sender(&self) -> &Sender<TaskSignal>
Get sender reference
Sourcefn read(&self) -> Result<RwLockReadGuard<'_, Self::Props>>
fn read(&self) -> Result<RwLockReadGuard<'_, Self::Props>>
Gives read access to the properties
§Errors
Sourcefn write(&self) -> Result<RwLockWriteGuard<'_, Self::Props>>
fn write(&self) -> Result<RwLockWriteGuard<'_, Self::Props>>
Gives write access to the properties
§Errors
Sourcefn put_with(&self, selector: &str, message: Message) -> Result<()>
fn put_with(&self, selector: &str, message: Message) -> Result<()>
Method to do a publishing for a selector
If there is a publisher stored, it will be used
otherwise an ad-hoc publishing will be done
§Errors
Sourcefn delete_with(&self, selector: &str) -> Result<()>
fn delete_with(&self, selector: &str) -> Result<()>
Method to do a deletion for a selector
If there is a publisher stored, it will be used
otherwise an ad-hoc deletion will be done
§Errors
Sourcefn get_with(
&self,
selector: &str,
message: Option<Message>,
callback: Option<&mut dyn FnMut(QueryableMsg) -> Result<()>>,
) -> Result<()>
fn get_with( &self, selector: &str, message: Option<Message>, callback: Option<&mut dyn FnMut(QueryableMsg) -> Result<()>>, ) -> Result<()>
Provided Methods§
Sourcefn put(&self, topic: &str, message: Message) -> Result<()>
fn put(&self, topic: &str, message: Message) -> Result<()>
Method to do a publishing for a topic
The topic will be enhanced with the prefix.
If there is a publisher stored, it will be used
otherwise an ad-hoc publishing will be done
§Errors
Sourcefn delete(&self, topic: &str) -> Result<()>
fn delete(&self, topic: &str) -> Result<()>
Method to do a deletion for a topic
The topic will be enhanced with the prefix.
If there is a publisher stored, it will be used
otherwise an ad-hoc deletion will be done