pub struct NatsHostBuilder { /* private fields */ }Expand description
Opinionated crate::wasmbus::HostBuilder that uses NATS as the primary transport and implementations for the crate::wasmbus::Host extension traits.
This builder is used to create a crate::wasmbus::HostBuilder and a NatsControlInterfaceServer for listening for control messages on the NATS message bus. Incoming messages will use the crate::wasmbus::ctl::ControlInterfaceServer trait to handle the messages and send them to the host.
Implementations§
Source§impl NatsHostBuilder
impl NatsHostBuilder
Sourcepub async fn new(
ctl_nats: Client,
ctl_topic_prefix: Option<String>,
lattice: String,
js_domain: Option<String>,
oci_opts: Option<Config>,
labels: BTreeMap<String, String>,
config_service_enabled: bool,
enable_component_auction: bool,
enable_provider_auction: bool,
) -> Result<Self>
pub async fn new( ctl_nats: Client, ctl_topic_prefix: Option<String>, lattice: String, js_domain: Option<String>, oci_opts: Option<Config>, labels: BTreeMap<String, String>, config_service_enabled: bool, enable_component_auction: bool, enable_provider_auction: bool, ) -> Result<Self>
Initialize the host with the NATS control interface connection
Sourcepub async fn with_policy_manager(
self,
host_key: Arc<KeyPair>,
labels: HashMap<String, String>,
policy_topic: Option<String>,
policy_timeout: Option<Duration>,
policy_changes_topic: Option<String>,
) -> Result<Self>
pub async fn with_policy_manager( self, host_key: Arc<KeyPair>, labels: HashMap<String, String>, policy_topic: Option<String>, policy_timeout: Option<Duration>, policy_changes_topic: Option<String>, ) -> Result<Self>
Setup the NATS policy manager for the host
Sourcepub fn with_secrets_manager(self, secrets_topic_prefix: String) -> Result<Self>
pub fn with_secrets_manager(self, secrets_topic_prefix: String) -> Result<Self>
Setup the NATS secrets manager for the host
Sourcepub fn with_event_publisher(self, source: String) -> Self
pub fn with_event_publisher(self, source: String) -> Self
Setup the NATS event publisher for the host
This will create a new NATS event publisher with the provided source. It’s strongly recommended to use the host’s public key as the source, as this will allow tracing events back to the host that published them.
Sourcepub async fn build(
self,
config: WasmbusHostConfig,
) -> Result<(HostBuilder, NatsControlInterfaceServer)>
pub async fn build( self, config: WasmbusHostConfig, ) -> Result<(HostBuilder, NatsControlInterfaceServer)>
Build the HostBuilder with the NATS extension traits and the provided WasmbusHostConfig.
Auto Trait Implementations§
impl Freeze for NatsHostBuilder
impl !RefUnwindSafe for NatsHostBuilder
impl Send for NatsHostBuilder
impl Sync for NatsHostBuilder
impl Unpin for NatsHostBuilder
impl !UnwindSafe for NatsHostBuilder
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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> 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> GetSetFdFlags for T
impl<T> GetSetFdFlags for T
Source§fn get_fd_flags(&self) -> Result<FdFlags, Error>where
T: AsFilelike,
fn get_fd_flags(&self) -> Result<FdFlags, Error>where
T: AsFilelike,
self file descriptor.Source§fn new_set_fd_flags(&self, fd_flags: FdFlags) -> Result<SetFdFlags<T>, Error>where
T: AsFilelike,
fn new_set_fd_flags(&self, fd_flags: FdFlags) -> Result<SetFdFlags<T>, Error>where
T: AsFilelike,
Source§fn set_fd_flags(&mut self, set_fd_flags: SetFdFlags<T>) -> Result<(), Error>where
T: AsFilelike,
fn set_fd_flags(&mut self, set_fd_flags: SetFdFlags<T>) -> Result<(), Error>where
T: AsFilelike,
self file descriptor. Read moreSource§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> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§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::RequestSource§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