pub struct NatsConnection { /* private fields */ }Expand description
NATS JetStream KV connection.
Implementations§
Source§impl NatsConnection
impl NatsConnection
pub fn new(config: NatsConnectionConfig) -> Self
Sourcepub fn from_client(client: Client) -> Self
pub fn from_client(client: Client) -> Self
Create a NatsConnection from an existing NATS client.
This is useful when the caller already has a NATS connection and wants to reuse it for KV stores instead of creating a new connection.
Trait Implementations§
Source§impl Connection for NatsConnection
impl Connection for NatsConnection
Source§fn connect<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<(), KvError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn connect<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<(), KvError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Connect to the store.
Source§fn shutdown<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<(), KvError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn shutdown<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<(), KvError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Graceful shutdown.
Source§fn is_healthy(&self) -> bool
fn is_healthy(&self) -> bool
Health check - fast, non-blocking.
Source§fn store<'life0, 'life1, 'async_trait>(
&'life0 self,
name: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Arc<dyn KvStore>, KvError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn store<'life0, 'life1, 'async_trait>(
&'life0 self,
name: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Arc<dyn KvStore>, KvError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Get or create a named store with default configuration.
Source§fn store_with_config<'life0, 'async_trait>(
&'life0 self,
config: StoreConfig,
) -> Pin<Box<dyn Future<Output = Result<Arc<dyn KvStore>, KvError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn store_with_config<'life0, 'async_trait>(
&'life0 self,
config: StoreConfig,
) -> Pin<Box<dyn Future<Output = Result<Arc<dyn KvStore>, KvError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Get or create a named store with custom configuration. Read more
Source§fn capabilities(&self) -> ConnectionCapabilities
fn capabilities(&self) -> ConnectionCapabilities
Store capabilities for runtime feature detection.
Auto Trait Implementations§
impl !Freeze for NatsConnection
impl !RefUnwindSafe for NatsConnection
impl !UnwindSafe for NatsConnection
impl Send for NatsConnection
impl Sync for NatsConnection
impl Unpin for NatsConnection
impl UnsafeUnpin for NatsConnection
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
Mutably borrows from an owned value. Read more