pub struct PubSubManager { /* private fields */ }Expand description
Manager for pub-sub subscriptions and event publishing.
This provides the infrastructure for change notifications. Full change data capture (CDC) integration with the storage layer will be implemented in Phase 6.
Implementations§
Source§impl PubSubManager
impl PubSubManager
Sourcepub async fn subscribe(
&self,
client_id: &str,
subscription: &Subscription,
) -> Result<u64, Error>
pub async fn subscribe( &self, client_id: &str, subscription: &Subscription, ) -> Result<u64, Error>
Subscribe to changes for an entity type.
Returns the subscription ID.
Sourcepub async fn unsubscribe(&self, subscription_id: u64) -> Result<(), Error>
pub async fn unsubscribe(&self, subscription_id: u64) -> Result<(), Error>
Unsubscribe from a subscription.
Sourcepub async fn publish_event(
&self,
entity: &str,
entity_id: [u8; 16],
change_type: ChangeType,
changed_fields: Vec<String>,
schema_version: u64,
)
pub async fn publish_event( &self, entity: &str, entity_id: [u8; 16], change_type: ChangeType, changed_fields: Vec<String>, schema_version: u64, )
Publish a change event for an entity.
This queues the event for delivery to matching subscriptions. In Phase 6, this will be connected to the storage layer’s CDC.
Sourcepub async fn drain_events(&self) -> Vec<ChangeEvent>
pub async fn drain_events(&self) -> Vec<ChangeEvent>
Drain queued events for delivery.
This is used by the transport layer to send events to subscribers.
Sourcepub async fn subscription_count(&self) -> usize
pub async fn subscription_count(&self) -> usize
Get the number of active subscriptions.
Sourcepub async fn subscriptions_for_entity(&self, entity: &str) -> Vec<u64>
pub async fn subscriptions_for_entity(&self, entity: &str) -> Vec<u64>
Get subscriptions for a specific entity.
Sourcepub async fn get_subscription(
&self,
subscription_id: u64,
) -> Option<SubscriptionEntry>
pub async fn get_subscription( &self, subscription_id: u64, ) -> Option<SubscriptionEntry>
Get a subscription by ID.
Sourcepub async fn remove_client_subscriptions(&self, client_id: &str)
pub async fn remove_client_subscriptions(&self, client_id: &str)
Remove all subscriptions for a client.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for PubSubManager
impl !RefUnwindSafe for PubSubManager
impl Send for PubSubManager
impl Sync for PubSubManager
impl Unpin for PubSubManager
impl !UnwindSafe for PubSubManager
Blanket Implementations§
Source§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
Source§type ArchivedMetadata = ()
type ArchivedMetadata = ()
The archived version of the pointer metadata for this type.
Source§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
Converts some archived metadata to the pointer metadata for itself.
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
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> LayoutRaw for T
impl<T> LayoutRaw for T
Source§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
Returns the layout of the type.
Source§impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
Source§unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
Returns whether the given value has been niched. Read more
Source§fn resolve_niched(out: Place<NichedOption<T, N1>>)
fn resolve_niched(out: Place<NichedOption<T, N1>>)
Writes data to
out indicating that a T is niched.