common_agent::agent

Struct AgentHandler

source
pub struct AgentHandler { /* private fields */ }
Expand description

This struct has all the functions an agent can use when communicating with its trustee or other agents

Implementations§

source§

impl AgentHandler

source

pub fn new( name: String, agent_id: MeshId, agent_trustee_id: MeshId, listener_enclave_id: Option<MeshId>, listener_subsystem: Option<MeshSubsystem>, requests: RequestTable, routing_table: RoutingTable, ) -> AgentHandler

source

pub fn is_bootstrapped(&self) -> bool

source

pub fn lookup_entity_on_same_agent( &self, source_emid: MeshEntityKeychainMeshId, lemid: LinkedEntityKeychainMeshId, reply_callback: ReplyCallback<LookupEntityOnSameAgentResult>, context_id: Option<ContextId>, ) -> Result<Vec<MeshMessage>, MeshError>

source

pub fn create_entity( &self, emid: Option<MeshEntityKeychainMeshId>, entity_type: Option<MeshEntityType>, data_operations: Option<Vec<DataOperation>>, expiration_time: Option<i64>, reply_callback: ReplyCallback<CreateEntityResult>, context_id: Option<ContextId>, ) -> Result<Vec<MeshMessage>, MeshError>

source

pub async fn async_create_entity( &self, emid: Option<MeshEntityKeychainMeshId>, entity_type: Option<MeshEntityType>, data_operations: Option<Vec<DataOperation>>, expiration_time: Option<i64>, context_id: Option<ContextId>, ) -> Result<CreateEntityResult, MeshError>

source

pub fn mutate_emid_data( &self, emid: MeshEntityKeychainMeshId, key_path: Vec<Vec<u8>>, mutate_callback: Box<dyn Fn(&mut DataEntry) -> Result<Option<MutateCallbackResultData>, MeshError> + Send + Sync>, reply_callback: Box<dyn FnOnce(Result<MutateReplyData, MeshError>) -> Result<Vec<MeshMessage>, MeshError> + Send + Sync>, context_id: Option<ContextId>, ) -> Result<Vec<MeshMessage>, MeshError>

source

pub fn mutate_lemid_data( &self, emid: MeshEntityKeychainMeshId, lemid: LinkedEntityKeychainMeshId, key_path: Vec<Vec<u8>>, mutate_callback: Box<dyn Fn(&mut DataEntry) -> Result<Option<MutateCallbackResultData>, MeshError> + Send + Sync>, reply_callback: Box<dyn FnOnce(Result<MutateReplyData, MeshError>) -> Result<Vec<MeshMessage>, MeshError> + Send + Sync>, context_id: Option<ContextId>, ) -> Result<Vec<MeshMessage>, MeshError>

source

pub fn data_operation_for_entity( &self, operations: Vec<AgentDataOperationForEntityInput>, reply_callback: ReplyCallback<DataOperationForEntityResult>, context_id: Option<ContextId>, ) -> Result<Vec<MeshMessage>, MeshError>

source

pub async fn async_data_operation_for_entity( &self, operations: Vec<AgentDataOperationForEntityInput>, context_id: Option<ContextId>, ) -> Result<DataOperationForEntityResult, MeshError>

source

pub async fn async_delete_entity( &self, emid: MeshEntityKeychainMeshId, context_id: Option<ContextId>, ) -> Result<(), MeshError>

source

pub fn delete_entity( &self, emid: MeshEntityKeychainMeshId, reply_callback: ReplyCallback<()>, context_id: Option<ContextId>, ) -> Result<Vec<MeshMessage>, MeshError>

source

pub fn lookup_linked_entities( &self, emid: MeshEntityKeychainMeshId, agent_ids: Option<Vec<AgentIdWithAttributes>>, external_ids: Option<Vec<MeshExternalId>>, reply_callback: ReplyCallback<LookupLinkedEntitiesResult>, offset: Option<u64>, limit: Option<u64>, include_deleted: Option<bool>, context_id: Option<ContextId>, ) -> Result<Vec<MeshMessage>, MeshError>

source

pub async fn async_lookup_linked_entities( &self, emid: MeshEntityKeychainMeshId, agent_ids: Option<Vec<AgentIdWithAttributes>>, external_ids: Option<Vec<MeshExternalId>>, offset: Option<u64>, limit: Option<u64>, include_deleted: Option<bool>, context_id: Option<ContextId>, ) -> Result<LookupLinkedEntitiesResult, MeshError>

source

pub fn check_permissions( &self, _lemid: LinkedEntityKeychainMeshId, _link_info: AgentMeshLinkInfo, _permissions: Vec<MeshPermission>, _reply_callback: Box<dyn Fn(Result<CheckPermissionsResult, MeshError>) -> Result<Vec<MeshMessage>, MeshError> + Send>, ) -> Result<Vec<MeshMessage>, MeshError>

source

pub fn check_permissions_inline( &self, _lemid: LinkedEntityKeychainMeshId, _link_info: AgentMeshLinkInfo, _permissions: Vec<MeshPermission>, ) -> Result<CheckPermissionsResult, MeshError>

source

pub fn send_message_to_entity_on_node_instance( &self, node_instance: MeshInstanceRoute, emid: MeshEntityKeychainMeshId, request_message: WrappedMessage, reply_callback: ReplyCallback<SendMessageToEntityOnNodeInstanceResult>, context_id: Option<ContextId>, ) -> Result<Vec<MeshMessage>, MeshError>

source

pub fn send_message_to_linked_entity( &self, lemid: LinkedEntityKeychainMeshId, request_message: WrappedMessage, reply_callback: ReplyCallback<SendMessageToLinkedEntityResult>, context_id: Option<ContextId>, ) -> Result<Vec<MeshMessage>, MeshError>

source

pub fn send_message_to_linked_entity_with_transform_error_option( &self, lemid: LinkedEntityKeychainMeshId, request_message: WrappedMessage, transform_error: bool, reply_callback: ReplyCallback<SendMessageToLinkedEntityResult>, context_id: Option<ContextId>, ) -> Result<Vec<MeshMessage>, MeshError>

source

pub async fn async_send_message_to_linked_entity( &self, lemid: LinkedEntityKeychainMeshId, request_message: WrappedMessage, context_id: Option<ContextId>, ) -> Result<SendMessageToLinkedEntityResult, MeshError>

source

pub async fn async_send_message_to_linked_entity_with_transform_error_option( &self, lemid: LinkedEntityKeychainMeshId, request_message: WrappedMessage, transform_error: bool, context_id: Option<ContextId>, ) -> Result<SendMessageToLinkedEntityResult, MeshError>

source

pub async fn async_send_message_to_all_linked_entities( &self, emid: MeshEntityKeychainMeshId, destination_agent_id: AgentIdWithAttributes, request_message: WrappedMessage, context_id: Option<ContextId>, ) -> Result<SendMessageToAllLinkedEntitiesResult, MeshError>

source

pub fn send_message_to_all_linked_entities( &self, emid: MeshEntityKeychainMeshId, destination_agent_id: AgentIdWithAttributes, request_message: WrappedMessage, reply_callback: ReplyCallback<SendMessageToAllLinkedEntitiesResult>, context_id: Option<ContextId>, ) -> Result<Vec<MeshMessage>, MeshError>

source

pub fn send_message_to_agent( &self, destination_agent_id: MeshId, request_message: WrappedMessage, reply_callback: ReplyCallback<SendMessageToAgentResult>, context_id: Option<ContextId>, ) -> Result<Vec<MeshMessage>, MeshError>

source

pub fn send_message_to_agent_with_transform_error_option( &self, destination_agent_id: MeshId, request_message: WrappedMessage, transform_error: bool, reply_callback: ReplyCallback<SendMessageToAgentResult>, context_id: Option<ContextId>, ) -> Result<Vec<MeshMessage>, MeshError>

source

pub fn send_message_to_agent_with_node_instance_and_timeout( &self, destination_agent_id: MeshId, request_message: WrappedMessage, expiration_ms: Option<i64>, node_instance: Option<MeshInstanceRoute>, transform_error: bool, reply_callback: ReplyCallback<SendMessageToAgentResult>, context_id: Option<ContextId>, ) -> Result<Vec<MeshMessage>, MeshError>

source

pub async fn async_send_message_to_agent( &self, destination_agent_id: MeshId, request_message: WrappedMessage, context_id: Option<ContextId>, ) -> Result<SendMessageToAgentResult, MeshError>

source

pub async fn async_send_message_to_agent_with_node_instance_and_timeout( &self, destination_agent_id: MeshId, request_message: WrappedMessage, expiration_ms: Option<i64>, node_instance: Option<MeshInstanceRoute>, context_id: Option<ContextId>, ) -> Result<SendMessageToAgentResult, MeshError>

source

pub fn send_message_to_trustee( &self, destination_trustee_id: MeshId, request_message: WrappedMessage, reply_callback: ReplyCallback<SendMessageToTrusteeResult>, context_id: Option<ContextId>, ) -> Result<Vec<MeshMessage>, MeshError>

source

pub async fn async_send_message_to_trustee( &self, destination_trustee_id: MeshId, request_message: WrappedMessage, context_id: Option<ContextId>, ) -> Result<SendMessageToTrusteeResult, MeshError>

source

pub fn update_uns_record_version_info( &self, source_id: MeshId, version_info: MeshVersionInfo, reply_callback: ReplyCallback<()>, context_id: Option<ContextId>, ) -> Result<Vec<MeshMessage>, MeshError>

source

pub async fn async_update_uns_record_version_info( &self, source_id: MeshId, version_info: MeshVersionInfo, context_id: Option<ContextId>, ) -> Result<(), MeshError>

source

pub fn create_uns_records( &self, records: Vec<CreateUnsRecord>, is_agent_and_trustees: bool, reply_callback: ReplyCallback<CreateUnsRecordsResult>, context_id: Option<ContextId>, ) -> Result<Vec<MeshMessage>, MeshError>

source

pub async fn async_create_uns_records( &self, records: Vec<CreateUnsRecord>, is_agent_and_trustees: bool, context_id: Option<ContextId>, ) -> Result<CreateUnsRecordsResult, MeshError>

source

pub fn lookup_uns_records( &self, lookup: UnsLookupType, bypass_cache: bool, get_trustees_if_agent: bool, reply_callback: ReplyCallback<LookupUnsRecordsResult>, context_id: Option<ContextId>, ) -> Result<Vec<MeshMessage>, MeshError>

source

pub async fn async_lookup_uns_records( &self, lookup: UnsLookupType, bypass_cache: bool, get_trustees_if_agent: bool, context_id: Option<ContextId>, ) -> Result<LookupUnsRecordsResult, MeshError>

source

pub fn get_source_and_destination(&self) -> (MeshId, MeshId)

source

pub fn get_agent_emid(&self) -> Result<MeshEntityKeychainMeshId, MeshError>

source

pub fn set_agent_emid(&self, agent_emid: MeshEntityKeychainMeshId)

source

pub fn get_agent_id(&self) -> MeshId

source

pub fn get_listener_subsystem(&self) -> Option<MeshSubsystem>

source

pub async fn async_mutate_emid_data( &self, emid: MeshEntityKeychainMeshId, key_path: Vec<Vec<u8>>, mutate_callback: Box<dyn Fn(&mut DataEntry) -> Result<Option<MutateCallbackResultData>, MeshError> + Send + Sync>, context_id: Option<ContextId>, ) -> Result<MutateReplyData, MeshError>

source

pub async fn async_mutate_emid_data_with_part_number( &self, emid: MeshEntityKeychainMeshId, key_path: Vec<Vec<u8>>, part_number: i64, mutate_callback: Box<dyn Fn(&mut DataEntry) -> Result<Option<MutateCallbackResultData>, MeshError> + Send + Sync>, context_id: Option<ContextId>, ) -> Result<MutateReplyData, MeshError>

source

pub async fn async_mutate_lemid_data( &self, emid: MeshEntityKeychainMeshId, lemid: LinkedEntityKeychainMeshId, key_path: Vec<Vec<u8>>, mutate_callback: Box<dyn Fn(&mut DataEntry) -> Result<Option<MutateCallbackResultData>, MeshError> + Send + Sync>, context_id: Option<ContextId>, ) -> Result<MutateReplyData, MeshError>

source

pub fn get_certificate_authorities( &self, reply_callback: ReplyCallback<GetCertificateAuthoritiesResult>, context_id: Option<ContextId>, ) -> Result<Vec<MeshMessage>, MeshError>

source

pub async fn async_get_certificate_authorities( &self, context_id: Option<ContextId>, ) -> Result<GetCertificateAuthoritiesResult, MeshError>

source

pub async fn async_get_lock_for_node( &self, name: &str, lock_timeout_ms: i64, context_id: Option<ContextId>, ) -> Result<bool, MeshError>

source

pub async fn async_mutate_emid_data_with_async_callback<F, Fut>( &self, emid: MeshEntityKeychainMeshId, key_path: Vec<Vec<u8>>, mutate_callback: F, context_id: Option<ContextId>, ) -> Result<MutateReplyData, MeshError>
where F: Fn(DataEntry) -> Fut + Send + Sync, Fut: Future<Output = Result<(DataEntry, Option<MutateCallbackResultData>), MeshError>> + Send,

source

pub async fn async_mutate_lemid_data_with_async_callback<F, Fut>( &self, emid: MeshEntityKeychainMeshId, lemid: LinkedEntityKeychainMeshId, key_path: Vec<Vec<u8>>, mutate_callback: F, context_id: Option<ContextId>, ) -> Result<MutateReplyData, MeshError>
where F: Fn(DataEntry) -> Fut + Send + Sync, Fut: Future<Output = Result<(DataEntry, Option<MutateCallbackResultData>), MeshError>> + Send,

source§

impl AgentHandler

source

pub fn bootstrap_with_trustee<F, FN>( &self, need_config: bool, bootstrap_get_key_pairs: Option<Vec<BootstrapGetKeyPair>>, lookup_uns_records: Option<impl IntoIterator<Item = impl Into<String>>>, callback: Option<FN>, ) -> Result<Vec<MeshMessage>, MeshError>
where F: Future<Output = Result<(), MeshError>> + Send + Sync + 'static, FN: Fn(AgentBootstrapData) -> F + Send + Sync + 'static,

source§

impl AgentHandler

source

pub fn check_purge_expired_tasks( &mut self, max_to_expire: Option<usize>, ) -> (Vec<MeshMessage>, Option<i64>)

source

pub async fn send_certificate_to_listener( &self, certificate_chain_pem: &str, private_key_pem: &str, ) -> Result<(), MeshError>

source§

impl AgentHandler

source

pub fn register_link_entity_post_create_handler( &mut self, request_handler: Box<RequestHandler>, )

source

pub fn register_create_temp_entity_handler( &mut self, request_handler: Box<RequestHandler>, )

source

pub fn register_create_temp_entity_handler_with_authorization_check( &mut self, authorization_handler: Box<AuthorizationHandler>, request_handler: Box<RequestHandler>, )

source

pub fn register_merge_temp_entity_handler( &mut self, request_handler: Box<RequestHandler>, )

source

pub fn register_handler( &mut self, subsystem: MeshSubsystem, message_type: MeshMessageType, request_handler: Box<RequestHandler>, )

source

pub fn register_handler_with_authorization_check( &mut self, subsystem: MeshSubsystem, message_type: MeshMessageType, authorization_handler: Box<AuthorizationHandler>, request_handler: Box<RequestHandler>, )

source

pub fn register_handler_set_include_pre_creates( &mut self, subsystem: MeshSubsystem, message_type: MeshMessageType, request_handler: Box<RequestHandler>, include_pre_creates: bool, )

source

pub fn register_handler_with_authorization_check_set_include_pre_creates( &mut self, subsystem: MeshSubsystem, message_type: MeshMessageType, authorization_handler: Box<AuthorizationHandler>, request_handler: Box<RequestHandler>, include_pre_creates: bool, )

source

pub fn register_handler_with_authorization_check_with_pre_creates( &mut self, subsystem: MeshSubsystem, message_type: MeshMessageType, authorization_handler: Box<AuthorizationHandler>, request_handler: Box<RequestHandler>, pre_create_handler: Box<RequestHandler>, )

source

pub fn send_reply_for_handler( &self, state_id: MeshId, reply_data: AgentHandlerRoutingResponseType, ) -> Result<Vec<MeshMessage>, MeshError>

source

pub fn send_error_for_handler( &self, state_id: MeshId, err: MeshError, ) -> Result<Vec<MeshMessage>, MeshError>

source

pub fn send_error_status_for_handler( &self, state_id: MeshId, status: MeshStatusType, status_message: Option<String>, ) -> Result<Vec<MeshMessage>, MeshError>

Trait Implementations§

source§

impl Clone for AgentHandler

source§

fn clone(&self) -> AgentHandler

Returns a copy of the value. Read more
1.0.0 · source§

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

Performs copy-assignment from source. Read more

Auto Trait Implementations§

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, dst: *mut T)

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

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

source§

fn __clone_box(&self, _: Private) -> *mut ()

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 = 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.