pub trait USubscription: Send + Sync {
// Required methods
fn subscribe<'life0, 'life1, 'async_trait>(
&'life0 self,
topic: &'life1 UUri,
expiration: Option<u64>,
min_sample_period: Option<u32>,
) -> Pin<Box<dyn Future<Output = Result<SubscriptionStatus, UStatus>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn unsubscribe<'life0, 'life1, 'async_trait>(
&'life0 self,
topic: &'life1 UUri,
) -> Pin<Box<dyn Future<Output = Result<(), UStatus>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn fetch_subscriptions_by_topic<'life0, 'life1, 'async_trait>(
&'life0 self,
topic: &'life1 UUri,
) -> Pin<Box<dyn Future<Output = Result<Vec<SubscriptionInfo>, UStatus>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn fetch_subscriptions_by_subscriber<'life0, 'life1, 'async_trait>(
&'life0 self,
subscriber: &'life1 UUri,
) -> Pin<Box<dyn Future<Output = Result<Vec<SubscriptionInfo>, UStatus>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn register_for_notifications<'life0, 'life1, 'async_trait>(
&'life0 self,
topic: &'life1 UUri,
) -> Pin<Box<dyn Future<Output = Result<(), UStatus>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn unregister_for_notifications<'life0, 'life1, 'async_trait>(
&'life0 self,
topic: &'life1 UUri,
) -> Pin<Box<dyn Future<Output = Result<(), UStatus>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn fetch_subscribers<'life0, 'life1, 'async_trait>(
&'life0 self,
topic: &'life1 UUri,
) -> Pin<Box<dyn Future<Output = Result<Vec<UUri>, UStatus>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn reset<'life0, 'async_trait>(
&'life0 self,
reason: ResetReason,
message: Option<String>,
) -> Pin<Box<dyn Future<Output = Result<(), UStatus>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
}Expand description
The uProtocol Application Layer client interface to the uSubscription service.
Please refer to the uSubscription service specification for details.
Note that in contrast to the uSubscription service specification, the functions defined in this trait only support commonly used input and output parameters of the operations defined in the specification. This is mainly due to the fact, that for many of the other parameters defined in the specification, it is not entirely clear if and how they should be used in practice. The next version of the uSubscription service specification will include a more detailed description of the operations and their parameters, which will then be reflected in the next version of this trait.
Required Methods§
Sourcefn subscribe<'life0, 'life1, 'async_trait>(
&'life0 self,
topic: &'life1 UUri,
expiration: Option<u64>,
min_sample_period: Option<u32>,
) -> Pin<Box<dyn Future<Output = Result<SubscriptionStatus, UStatus>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn subscribe<'life0, 'life1, 'async_trait>(
&'life0 self,
topic: &'life1 UUri,
expiration: Option<u64>,
min_sample_period: Option<u32>,
) -> Pin<Box<dyn Future<Output = Result<SubscriptionStatus, UStatus>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Subscribes to a topic.
§Parameters
topic- The topic to subscribe to.expiration- The point in time at which the subscription expires (milliseconds since Unix epoch). If not specified, the subscription is valid until explicitly unsubscribed.min_sample_period- The minimum duration (in seconds) between two events that should be maintained for remote only topics. Device dispatchers use this attribute to reduce the publication rates of events sent between devices. This attribute is commonly used for mobile/cloud components subscribing to vehicle topics that are published at a high rate. If the desired sampling period set by the subscriber is lower than the original publisher’s publication period, the attribute is ignored. If not specified, the sampling period is set by the publisher.
§Returns
The outcome of the attempt to establish the subscription.