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
impl USubscriptionService
Implementation of uProtocol L3 USubscription service
Sourcepub fn run(
config: Arc<USubscriptionConfiguration>,
up_transport: Arc<dyn UTransport>,
up_client: Arc<dyn RpcClient>,
) -> Result<(Arc<dyn USubscriptionServiceAbstract>, USubscriptionStopper), UStatus>
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 serviceup_transport- Implementation of UTransport to be used by this USUbscription instance, for sending Listener-responses and Notificationsup_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
USubscriptionStopperobject which can be used to explicitly shut down the USubscription service
Sourcepub async fn now_listen(
usubscription_service: Arc<dyn USubscriptionServiceAbstract>,
) -> Result<(), UStatus>
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
USubscriptionServiceAbstractobject to set up listeners for
Trait Implementations§
Source§impl Clone for USubscriptionService
impl Clone for USubscriptionService
Source§fn clone(&self) -> USubscriptionService
fn clone(&self) -> USubscriptionService
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl LocalUriProvider for USubscriptionService
impl LocalUriProvider for USubscriptionService
Gets the authority used for URIs representing this uEntity’s resources.
Source§fn get_resource_uri(&self, resource_id: u16) -> UUri
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
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
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,
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,
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,
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 moreSource§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,
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 moreSource§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,
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 moreSource§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,
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 moreSource§impl UTransportHolder for USubscriptionService
impl UTransportHolder for USubscriptionService
fn get_transport(&self) -> Arc<dyn UTransport>
impl USubscriptionServiceAbstract for USubscriptionService
Auto Trait Implementations§
impl Freeze for USubscriptionService
impl !RefUnwindSafe for USubscriptionService
impl Send for USubscriptionService
impl Sync for USubscriptionService
impl Unpin for USubscriptionService
impl !UnwindSafe for USubscriptionService
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