up_subscription/
lib.rs

1/********************************************************************************
2 * Copyright (c) 2024 Contributors to the Eclipse Foundation
3 *
4 * See the NOTICE file(s) distributed with this work for additional
5 * information regarding copyright ownership.
6 *
7 * This program and the accompanying materials are made available under the
8 * terms of the Apache License Version 2.0 which is available at
9 * https://www.apache.org/licenses/LICENSE-2.0
10 *
11 * SPDX-License-Identifier: Apache-2.0
12 ********************************************************************************/
13
14/*!
15up-subscription is an implementation of the [Eclipse uProtocol™ USubscription service](https://github.com/eclipse-uprotocol/up-spec/blob/main/up-l3/usubscription/v3/README.adoc) for the rust programming language.
16
17This crate can be used to configure and run a USubscription service as part of your rust application, implementing the interface defined by the [uProtocol protobuf core API specification](https://github.com/eclipse-uprotocol/up-spec/blob/main/up-core-api/uprotocol/core/usubscription/v3/usubscription.proto).
18
19## Library contents
20
21* `usubscription` service as an frontend for the subscription management and notification handler actors.
22* `listeners` module, with UListener trait implementations for all functions defined by the USubscription API
23
24## Note
25
26For a batteries-included approach to running up-subscription-rust, the `up-subscription-cli` module provides a command line frontend for running the USubscription service. It is available via the [project's github repo](https://github.com/eclipse-uprotocol/up-subscription-rust).
27
28
29## References
30
31* [uProtocol Specification](https://github.com/eclipse-uprotocol/up-spec/tree/v1.6.0-alpha.2)
32* [uProtocol USubscription Specification](https://github.com/eclipse-uprotocol/up-spec/blob/main/up-l3/usubscription/v3/README.adoc)
33* [uProtocol USubscription API](https://github.com/eclipse-uprotocol/up-spec/blob/main/up-core-api/uprotocol/core/usubscription/v3/usubscription.proto)
34
35*/
36
37mod common {
38    pub(crate) mod helpers;
39}
40pub use common::helpers::init_once;
41pub(crate) use common::*;
42
43mod notification_manager;
44mod subscription_manager;
45
46mod configuration;
47pub use usubscription::*;
48mod usubscription;
49pub use configuration::{ConfigurationError, USubscriptionConfiguration};
50
51pub mod listeners {
52    pub mod fetch_subscribers;
53    pub mod fetch_subscriptions;
54    pub mod register_for_notifications;
55    pub mod subscribe;
56    pub mod unregister_for_notifications;
57    pub mod unsubscribe;
58
59    pub use fetch_subscribers::FetchSubscribersListener;
60    pub use fetch_subscriptions::FetchSubscriptionsListener;
61    pub use register_for_notifications::RegisterForNotificationsListener;
62    pub use subscribe::SubscribeListener;
63    pub use unregister_for_notifications::UnregisterForNotificationsListener;
64    pub use unsubscribe::UnsubscribeListener;
65}
66
67#[cfg(test)]
68mod tests;
69#[cfg(test)]
70pub(crate) use tests::*;