pub struct ProviderConnection {
pub source_links: Arc<RwLock<HashMap<LatticeTarget, InterfaceLinkDefinition>>>,
pub target_links: Arc<RwLock<HashMap<String, InterfaceLinkDefinition>>>,
pub nats: Arc<Client>,
pub lattice: Arc<str>,
pub host_id: String,
pub provider_id: Arc<str>,
pub provider_xkey: Arc<XKey>,
pub host_xkey: Arc<XKey>,
pub config: HashMap<String, String>,
}
Fields§
§source_links: Arc<RwLock<HashMap<LatticeTarget, InterfaceLinkDefinition>>>
Links from the provider to other components, aka where the provider is the source of the link. Indexed by the component ID of the target
target_links: Arc<RwLock<HashMap<String, InterfaceLinkDefinition>>>
Links from other components to the provider, aka where the provider is the target of the link. Indexed by the component ID of the source
nats: Arc<Client>
NATS client used for performing RPCs
lattice: Arc<str>
Lattice name
host_id: String
§provider_id: Arc<str>
§provider_xkey: Arc<XKey>
Secrets XKeys
host_xkey: Arc<XKey>
§config: HashMap<String, String>
Implementations§
source§impl ProviderConnection
impl ProviderConnection
pub fn new( nats: impl Into<Arc<Client>>, provider_id: impl Into<Arc<str>>, lattice: impl Into<Arc<str>>, host_id: String, config: HashMap<String, String>, provider_private_xkey: impl Into<Arc<XKey>>, host_public_xkey: impl Into<Arc<XKey>>, ) -> ProviderInitResult<ProviderConnection>
sourcepub async fn get_wrpc_client(&self, target: &str) -> Result<WrpcClient>
pub async fn get_wrpc_client(&self, target: &str) -> Result<WrpcClient>
Retrieve a wRPC client that can be used based on the NATS client of this connection
§Arguments
target
- Target ID to which invocations will be sent
sourcepub async fn get_wrpc_client_custom(
&self,
target: &str,
timeout: Option<Duration>,
) -> Result<WrpcClient>
pub async fn get_wrpc_client_custom( &self, target: &str, timeout: Option<Duration>, ) -> Result<WrpcClient>
Retrieve a wRPC client that can be used based on the NATS client of this connection, customized with invocation timeout
§Arguments
target
- Target ID to which invocations will be senttimeout
- Timeout to be set on the client (by default if this is unset it will be 10 seconds)
sourcepub fn provider_key(&self) -> &str
pub fn provider_key(&self) -> &str
Get the provider key that was assigned to this host at startup
sourcepub async fn put_link(&self, ld: InterfaceLinkDefinition)
pub async fn put_link(&self, ld: InterfaceLinkDefinition)
Stores link in the ProviderConnection
, either as a source link or target link
depending on if the provider is the source or target of the link
sourcepub async fn delete_link(&self, source_id: &str, target: &str)
pub async fn delete_link(&self, source_id: &str, target: &str)
Deletes link from the ProviderConnection
, either a source link or target link
based on if the provider is the source or target of the link
Trait Implementations§
source§impl Clone for ProviderConnection
impl Clone for ProviderConnection
source§fn clone(&self) -> ProviderConnection
fn clone(&self) -> ProviderConnection
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreAuto Trait Implementations§
impl Freeze for ProviderConnection
impl !RefUnwindSafe for ProviderConnection
impl Send for ProviderConnection
impl Sync for ProviderConnection
impl Unpin for ProviderConnection
impl !UnwindSafe for ProviderConnection
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)source§impl<T> FutureExt for T
impl<T> FutureExt for T
source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T
in a tonic::Request