Skip to content

Commit 64b3e00

Browse files
committed
ran clang-format
1 parent 808ca65 commit 64b3e00

File tree

8 files changed

+82
-86
lines changed

8 files changed

+82
-86
lines changed

include/up-cpp/core/usubscription/notification_manager.h

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -10,26 +10,26 @@
1010

1111
namespace uprotocol::core::usubscription::v3 {
1212

13-
using UTransport = transport::UTransport;
13+
using UTransport = transport::UTransport;
1414

15-
struct NotificationEvent {};
15+
struct NotificationEvent {};
1616

17-
struct NotificationManager {
18-
explicit NotificationManager(std::shared_ptr<UTransport> transport,
19-
USubscriptionConfiguration config)
20-
:transport_(std::move(transport)), config_(std::move(config)){};
17+
struct NotificationManager {
18+
explicit NotificationManager(std::shared_ptr<UTransport> transport,
19+
USubscriptionConfiguration config)
20+
: transport_(std::move(transport)), config_(std::move(config)){};
2121

22-
void handle_message(
23-
std::shared_ptr<UTransport> transport,
24-
std::unique_ptr<util::ReceiverChannel<NotificationEvent>> notification_receiver,
25-
std::condition_variable& shutdown
26-
);
22+
void handle_message(
23+
std::shared_ptr<UTransport> transport,
24+
std::unique_ptr<util::ReceiverChannel<NotificationEvent>>
25+
notification_receiver,
26+
std::condition_variable& shutdown);
2727

28-
private:
29-
std::shared_ptr<UTransport> transport_;
30-
USubscriptionConfiguration config_;
31-
};
28+
private:
29+
std::shared_ptr<UTransport> transport_;
30+
USubscriptionConfiguration config_;
31+
};
3232

33-
} // namespace uprotocol::core::usubscription::v3
33+
} // namespace uprotocol::core::usubscription::v3
3434

35-
#endif //NOTIFICATION_MANAGER_H
35+
#endif // NOTIFICATION_MANAGER_H

include/up-cpp/core/usubscription/persistency.h

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,22 +13,20 @@ namespace uprotocol::core::usubscription::v3 {
1313
struct PersistencyError {};
1414

1515
struct SubscriptionStore {
16-
1716
explicit SubscriptionStore(USubscriptionConfiguration config);
1817

1918
utils::Expected<bool, PersistencyError> add_subscription(
20-
const v1::UUri& subscriber,
21-
const v1::UUri& topic);
19+
const v1::UUri& subscriber, const v1::UUri& topic);
2220

23-
private:
24-
std::unordered_map<std::string, std::unordered_set<std::string>> persistency_;
21+
private:
22+
std::unordered_map<std::string, std::unordered_set<std::string>>
23+
persistency_;
2524
};
2625

2726
struct RemoteTopicStore {
28-
2927
explicit RemoteTopicStore(USubscriptionConfiguration config);
3028
};
3129

32-
} // uprotocol::core::usubscription::v3
30+
} // namespace uprotocol::core::usubscription::v3
3331

34-
#endif //PERSISTENCY_H
32+
#endif // PERSISTENCY_H

include/up-cpp/core/usubscription/subscription_manager.h

Lines changed: 14 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,9 @@ struct RemoveSubscription {
2727
// Sender<int> respond_to;
2828
};
2929

30-
// TODO(max) this is just a placeholder, there might be something like this in the usubscription.ph.h file
31-
enum class TopicState {
32-
SUBSCRIBED,
33-
UNSUBSCRIBED,
34-
UNKNOWN
35-
};
30+
// TODO(max) this is just a placeholder, there might be something like this in
31+
// the usubscription.ph.h file
32+
enum class TopicState { SUBSCRIBED, UNSUBSCRIBED, UNKNOWN };
3633

3734
struct RemoteSubscriptionState {
3835
v1::UUri topic;
@@ -41,28 +38,27 @@ struct RemoteSubscriptionState {
4138

4239
using SubscriptionEvent = std::variant<AddSubscription, RemoveSubscription>;
4340
using RemoteSubscriptionEvent = std::variant<RemoteSubscriptionState>;
44-
using Event = std::variant<SubscriptionEvent, RemoteSubscriptionEvent>;
41+
using Event = std::variant<SubscriptionEvent, RemoteSubscriptionEvent>;
4542
using UTransport = transport::UTransport;
4643

4744
struct SubscriptionManager {
4845
SubscriptionManager(std::shared_ptr<UTransport> transport,
49-
USubscriptionConfiguration config)
46+
USubscriptionConfiguration config)
5047
: _transport(std::move(transport)), _config(std::move(config)){};
5148

5249
void handle_message(
5350
std::shared_ptr<UTransport> transport,
54-
std::unique_ptr<util::ReceiverChannel<SubscriptionEvent>> subscription_receiver,
55-
std::condition_variable& shutdown
56-
);
51+
std::unique_ptr<util::ReceiverChannel<SubscriptionEvent>>
52+
subscription_receiver,
53+
std::condition_variable& shutdown);
5754

5855
utils::Expected<SubscriptionStatus, PersistencyError> add_aubscription(
59-
std::shared_ptr<UTransport> transport,
60-
std::unique_ptr<util::ReceiverChannel<RemoteSubscriptionEvent>> remote_sub_sender,
61-
SubscriptionStore top_subscription_store,
62-
RemoteTopicStore remote_topic_store,
63-
v1::UUri subscriber,
64-
v1::UUri topic);
65-
56+
std::shared_ptr<UTransport> transport,
57+
std::unique_ptr<util::ReceiverChannel<RemoteSubscriptionEvent>>
58+
remote_sub_sender,
59+
SubscriptionStore top_subscription_store,
60+
RemoteTopicStore remote_topic_store, v1::UUri subscriber,
61+
v1::UUri topic);
6662

6763
private:
6864
std::shared_ptr<UTransport> _transport;

include/up-cpp/core/usubscription/usubscription.h

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -24,32 +24,33 @@ using UTransport = transport::UTransport;
2424
using StopperOrStatus = utils::Expected<USubscriptionStopper, v1::UStatus>;
2525

2626
struct USubscriptionService : communication::RpcServer {
27-
2827
explicit USubscriptionService(
2928
std::shared_ptr<transport::UTransport> transport,
3029
USubscriptionConfiguration config, v1::UPayloadFormat format = {},
3130
std::chrono::milliseconds ttl = {});
3231

3332
StopperOrStatus run();
3433

35-
v1::UStatus register_handlers(std::unique_ptr<util::SenderChannel<SubscriptionEvent>> subscription_sender,
36-
std::unique_ptr<util::SenderChannel<NotificationEvent>> notification_channel);
34+
v1::UStatus register_handlers(
35+
std::unique_ptr<util::SenderChannel<SubscriptionEvent>>
36+
subscription_sender,
37+
std::unique_ptr<util::SenderChannel<NotificationEvent>>
38+
notification_channel);
3739

3840
// TODO(max) maybe return a stopper struct instead
3941
void stop();
4042

4143
struct USubscriptionStopper {
4244
explicit USubscriptionStopper() = default;
43-
// : service_(std::make_unique<USubscriptionService>(this)) {}
44-
//
45-
// void stop() {service_->stop();}
46-
// ~USubscriptionStopper(){stop();}
47-
//
48-
// private:
49-
// std::unique_ptr<USubscriptionService> service_;
45+
// : service_(std::make_unique<USubscriptionService>(this)) {}
46+
//
47+
// void stop() {service_->stop();}
48+
// ~USubscriptionStopper(){stop();}
49+
//
50+
// private:
51+
// std::unique_ptr<USubscriptionService> service_;
5052
};
5153

52-
5354
private:
5455
std::atomic<bool> stop_{false};
5556
std::thread subscription_manager_thread_;

src/core/usubscription/handlers/subscribe.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ extract_inputs(uint16_t expected_resource_id, uint16_t resource_id,
3838
throw ServiceInvocationError::InvalidArgument("No request payload");
3939
}
4040

41-
// TODO(max) turned into comment to check compiling, uncomment to continue work
42-
// std::optional<uprotocol::datamodel::builder::Payload> request;
41+
// TODO(max) turned into comment to check compiling, uncomment to continue
42+
// work std::optional<uprotocol::datamodel::builder::Payload> request;
4343

4444
try {
4545
// TODO(lennart)
@@ -55,9 +55,9 @@ extract_inputs(uint16_t expected_resource_id, uint16_t resource_id,
5555
throw ServiceInvocationError::InvalidArgument("No request source uri");
5656
}
5757

58-
auto request = uprotocol::datamodel::builder::Payload(std::string("dummy payload"), uprotocol::v1::UPAYLOAD_FORMAT_TEXT);
59-
return { request,
60-
uprotocol::v1::UUri(source)};
58+
auto request = uprotocol::datamodel::builder::Payload(
59+
std::string("dummy payload"), uprotocol::v1::UPAYLOAD_FORMAT_TEXT);
60+
return {request, uprotocol::v1::UUri(source)};
6161
// TODO(lennart) get corresponding request Payload Constructor, in Rust
6262
// MessageFull is used, that originates from: request =
6363
// payload.extract_protobuf()...

src/core/usubscription/persistency.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@
66

77
namespace uprotocol::core::usubscription::v3 {
88

9-
} // namespace uprotocol::core::usubscription::v3
9+
} // namespace uprotocol::core::usubscription::v3

src/core/usubscription/subscription_manager.cpp

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,28 @@
11
#include "up-cpp/core/usubscription/subscription_manager.h"
2+
23
#include "up-cpp/core/usubscription/persistency.h"
34

45
namespace uprotocol::core::usubscription::v3 {
56
using UTransport = transport::UTransport;
6-
using StatusOrError = utils::Expected<SubscriptionStatus,PersistencyError>;
7+
using StatusOrError = utils::Expected<SubscriptionStatus, PersistencyError>;
78

8-
[[noreturn]] void handle_message(
9-
const UTransport& transport,
10-
std::unique_ptr<util::ReceiverChannel<SubscriptionEvent>> subscription_receiver,
11-
std::condition_variable& shutdown
12-
){
9+
[[noreturn]] void handle_message(
10+
const UTransport& transport,
11+
std::unique_ptr<util::ReceiverChannel<SubscriptionEvent>>
12+
subscription_receiver,
13+
std::condition_variable& shutdown) {
1314
while (true) {
1415
auto event = subscription_receiver->receive();
1516
}
1617
};
1718

18-
1919
StatusOrError add_aubscription(
20-
std::shared_ptr<UTransport> transport,
21-
std::unique_ptr<util::ReceiverChannel<RemoteSubscriptionEvent>> remote_sub_sender,
22-
SubscriptionStore top_subscription_store,
23-
RemoteTopicStore remote_topic_store,
24-
v1::UUri subscriber,
25-
v1::UUri topic) {
26-
//dummy
20+
std::shared_ptr<UTransport> transport,
21+
std::unique_ptr<util::ReceiverChannel<RemoteSubscriptionEvent>>
22+
remote_sub_sender,
23+
SubscriptionStore top_subscription_store,
24+
RemoteTopicStore remote_topic_store, v1::UUri subscriber, v1::UUri topic) {
25+
// dummy
2726
return StatusOrError(SubscriptionStatus());
2827
};
2928

src/core/usubscription/usubscription.cpp

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -26,32 +26,34 @@ USubscriptionService::USubscriptionService(
2626
config_(std::move(config)){};
2727

2828
StopperOrStatus USubscriptionService::run() {
29-
3029
util::ChannelBuilder<SubscriptionEvent> subscription_channel_builder;
3130

32-
auto [subscription_receiver, subscription_sender] = subscription_channel_builder.build();
31+
auto [subscription_receiver, subscription_sender] =
32+
subscription_channel_builder.build();
3333
const SubscriptionManager subscription_manager(transport_, config_);
34-
subscription_manager_thread_ = std::thread(subscription_manager.handle_message, transport_,
35-
subscription_receiver);
34+
subscription_manager_thread_ = std::thread(
35+
subscription_manager.handle_message, transport_, subscription_receiver);
3636

3737
util::ChannelBuilder<NotificationEvent> notification_channel_builder;
3838

39-
auto [notification_receiver, notification_sender] = notification_channel_builder.build();
39+
auto [notification_receiver, notification_sender] =
40+
notification_channel_builder.build();
4041
const NotificationManager notification_manager(transport_, config_);
41-
notification_manager_thread_ = std::thread(notification_manager.handle_message, transport_,
42-
notification_receiver);
42+
notification_manager_thread_ = std::thread(
43+
notification_manager.handle_message, transport_, notification_receiver);
4344

44-
const v1::UStatus connection_status = register_handlers(std::move(subscription_sender),
45-
std::move(notification_sender));
45+
const v1::UStatus connection_status = register_handlers(
46+
std::move(subscription_sender), std::move(notification_sender));
4647
if (connection_status.code() != v1::UCode::OK) {
4748
return StopperOrStatus(utils::Unexpected(connection_status));
4849
}
4950

50-
return StopperOrStatus(USubscriptionStopper());
51+
return StopperOrStatus(USubscriptionStopper());
5152
}
5253

53-
v1::UStatus register_handlers(util::SenderChannel<SubscriptionEvent> sender_channel,
54-
util::ReceiverChannel<NotificationEvent> notification_sender) {
54+
v1::UStatus register_handlers(
55+
util::SenderChannel<SubscriptionEvent> sender_channel,
56+
util::ReceiverChannel<NotificationEvent> notification_sender) {
5557
throw std::runtime_error("Not implemented");
5658
}
5759

0 commit comments

Comments
 (0)