Struct USubscriptionService

Source
pub struct USubscriptionService { /* private fields */ }
Expand description

Core landing point and coordination of business logic of the uProtocol USubscription service. This implementation usually would be front-ended by the various listeners to connect with corresponding uProtocol RPC server endpoints.

Functionally, the code in this context primarily cares about:

  • input validation
  • interaction with / orchestration of backends for managing subscriptions (usubscription_manager.rs) and dealing with notifications (usubscription_notification.rs)

Implementations§

Source§

impl USubscriptionService

Implementation of uProtocol L3 USubscription service

Source

pub fn run( config: Arc<USubscriptionConfiguration>, up_transport: Arc<dyn UTransport>, up_client: Arc<dyn RpcClient>, ) -> Result<(Arc<dyn USubscriptionServiceAbstract>, USubscriptionStopper), UStatus>

Start a new USubscriptionService Atm this will directly spin up two tasks which deal with subscription and notification management, with no further action required, but also no explicit shutdown operation yet - that’s a TODO.

§Arguments
  • config - The configuration details for this USUbscription service
  • up_transport - Implementation of UTransport to be used by this USUbscription instance, for sending Listener-responses and Notifications
  • up_client - Implementation of RpcClient to be used by this USUbscription instance, for performing remote-subscribe operations
§Returns
  • the immutable parts of the USubscription service inside an Arc
  • a USubscriptionStopper object which can be used to explicitly shut down the USubscription service
Source

pub async fn now_listen( usubscription_service: Arc<dyn USubscriptionServiceAbstract>, ) -> Result<(), UStatus>

This sets up all applicable listeners to connect the USubscription service with it’s transport implementation. The following rules apply:

  • complete usubscription functionality is only available for local uEntities (TODO verify how this works with empty authority_names)
  • subscribe() and unsubscribe() are also available for remote callers, but only those with UEntity ID type USUSBSCRIPTION (other USubscription services)
§Arguments:
  • the USubscriptionServiceAbstract object to set up listeners for

Trait Implementations§

Source§

impl Clone for USubscriptionService

Source§

fn clone(&self) -> USubscriptionService

Returns a duplicate of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl LocalUriProvider for USubscriptionService

Source§

fn get_authority(&self) -> String

Gets the authority used for URIs representing this uEntity’s resources.
Source§

fn get_resource_uri(&self, resource_id: u16) -> UUri

Gets a URI that represents a given resource of this uEntity.
Source§

fn get_source_uri(&self) -> UUri

Gets the URI that represents the resource that this uEntity expects RPC responses and notifications to be sent to.
Source§

impl USubscription for USubscriptionService

Source§

fn subscribe<'life0, 'async_trait>( &'life0 self, subscription_request: SubscriptionRequest, ) -> Pin<Box<dyn Future<Output = Result<SubscriptionResponse, UStatus>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source§

fn unsubscribe<'life0, 'async_trait>( &'life0 self, unsubscribe_request: UnsubscribeRequest, ) -> Pin<Box<dyn Future<Output = Result<(), UStatus>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source§

fn register_for_notifications<'life0, 'async_trait>( &'life0 self, notifications_register_request: NotificationsRequest, ) -> Pin<Box<dyn Future<Output = Result<(), UStatus>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Register for notifications relevant to a given topic inside a NotificationsRequest changing in subscription status. Read more
Source§

fn unregister_for_notifications<'life0, 'async_trait>( &'life0 self, notifications_unregister_request: NotificationsRequest, ) -> Pin<Box<dyn Future<Output = Result<(), UStatus>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Unregister for notifications relevant to a given topic inside a NotificationsRequest changing in subscription status. Read more
Source§

fn fetch_subscribers<'life0, 'async_trait>( &'life0 self, fetch_subscribers_request: FetchSubscribersRequest, ) -> Pin<Box<dyn Future<Output = Result<FetchSubscribersResponse, UStatus>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Fetch a list of subscribers that are currently subscribed to a given topic in a FetchSubscribersRequest Read more
Source§

fn fetch_subscriptions<'life0, 'async_trait>( &'life0 self, fetch_subscriptions_request: FetchSubscriptionsRequest, ) -> Pin<Box<dyn Future<Output = Result<FetchSubscriptionsResponse, UStatus>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Fetch all subscriptions for a given topic or subscriber contained inside a FetchSubscriptionsRequest Read more
Source§

impl UTransportHolder for USubscriptionService

Source§

impl USubscriptionServiceAbstract for USubscriptionService

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, dest: *mut u8)

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

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> 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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more