/* * Copyright (C) 2019-present ScyllaDB */ /* * SPDX-License-Identifier: LicenseRef-ScyllaDB-Source-Available-1.0 */ #pragma once #include #include #include "seastarx.hh" #include "utils/loading_shared_values.hh" #include #include enum class client_type { cql = 0, thrift, alternator, }; sstring to_string(client_type ct); enum class client_connection_stage { established = 0, authenticating, ready, }; // We implement a keys cache using a map-like utils::loading_shared_values container by storing empty values. struct options_cache_value_type {}; using client_options_cache_type = utils::loading_shared_values; using client_options_cache_entry_type = client_options_cache_type::entry_ptr; using client_options_cache_key_type = client_options_cache_type::key_type; // This struct represents a single OPTION key-value pair from the client's connection options. // Both key and value are represented by corresponding "references" to their cached values. // Each "reference" is effectively a lw_shared_ptr value. struct client_option_key_value_cached_entry { client_options_cache_entry_type key; client_options_cache_entry_type value; }; sstring to_string(client_connection_stage ct); // Representation of a row in `system.clients'. std::optionals are for nullable cells. struct client_data { net::inet_address ip; int32_t port; client_type ct = client_type::cql; client_connection_stage connection_stage = client_connection_stage::established; int32_t shard_id; /// ID of server-side shard which is processing the connection. std::optional driver_name; std::optional driver_version; std::optional hostname; std::optional protocol_version; std::optional ssl_cipher_suite; std::optional ssl_enabled; std::optional ssl_protocol; std::optional username; std::optional scheduling_group_name; std::list client_options; sstring stage_str() const { return to_string(connection_stage); } sstring client_type_str() const { return to_string(ct); } };