[COMMIT seastar master] rpc: rpc_types: move `connection_id` definition before `client_info`

1 view
Skip to first unread message

Commit Bot

<bot@cloudius-systems.com>
unread,
May 25, 2023, 6:29:31 AM5/25/23
to seastar-dev@googlegroups.com, Kamil Braun
From: Kamil Braun <kbr...@scylladb.com>
Committer: Kamil Braun <kbr...@scylladb.com>
Branch: master

rpc: rpc_types: move `connection_id` definition before `client_info`

We'll add a `connection_id` field to `client_info` in a later commit.

---
diff --git a/include/seastar/rpc/rpc_types.hh b/include/seastar/rpc/rpc_types.hh
--- a/include/seastar/rpc/rpc_types.hh
+++ b/include/seastar/rpc/rpc_types.hh
@@ -55,6 +55,28 @@ struct stats {
counter_type timeout = 0;
};

+struct connection_id {
+ uint64_t id;
+ bool operator==(const connection_id& o) const {
+ return id == o.id;
+ }
+ explicit operator bool() const {
+ return shard() != 0xffff;
+ }
+ size_t shard() const {
+ return size_t(id & 0xffff);
+ }
+ constexpr static connection_id make_invalid_id(uint64_t id = 0) {
+ return make_id(id, 0xffff);
+ }
+ constexpr static connection_id make_id(uint64_t id, uint16_t shard) {
+ return {id << 16 | shard};
+ }
+};
+
+constexpr connection_id invalid_connection_id = connection_id::make_invalid_id();
+
+std::ostream& operator<<(std::ostream&, const connection_id&);

struct client_info {
socket_address addr;
@@ -258,29 +280,6 @@ public:

class connection;

-struct connection_id {
- uint64_t id;
- bool operator==(const connection_id& o) const {
- return id == o.id;
- }
- explicit operator bool() const {
- return shard() != 0xffff;
- }
- size_t shard() const {
- return size_t(id & 0xffff);
- }
- constexpr static connection_id make_invalid_id(uint64_t id = 0) {
- return make_id(id, 0xffff);
- }
- constexpr static connection_id make_id(uint64_t id, uint16_t shard) {
- return {id << 16 | shard};
- }
-};
-
-constexpr connection_id invalid_connection_id = connection_id::make_invalid_id();
-
-std::ostream& operator<<(std::ostream&, const connection_id&);
-
using xshard_connection_ptr = lw_shared_ptr<foreign_ptr<shared_ptr<connection>>>;
constexpr size_t max_queued_stream_buffers = 50;
constexpr size_t max_stream_buffers_memory = 100 * 1024;
Reply all
Reply to author
Forward
0 new messages