Use snake_case for Connection etc methods

This commit is contained in:
2025-08-24 16:21:01 -04:00
parent e56cf41a01
commit ee721c7753
13 changed files with 74 additions and 57 deletions

View File

@@ -83,12 +83,12 @@ struct Connection {
*
* Example usage:
* ```cpp
* conn->appendMessage("HTTP/1.1 200 OK\r\n\r\n", false); // Static string
* conn->appendMessage(dynamic_response, true); // Dynamic data
* conn->appendMessage(arena_allocated_data, false); // Arena data
* conn->append_message("HTTP/1.1 200 OK\r\n\r\n", false); // Static string
* conn->append_message(dynamic_response, true); // Dynamic data
* conn->append_message(arena_allocated_data, false); // Arena data
* ```
*/
void appendMessage(std::string_view s, bool copy_to_arena = true);
void append_message(std::string_view s, bool copy_to_arena = true);
/**
* @brief Mark the connection to be closed after sending all queued messages.
@@ -108,11 +108,11 @@ struct Connection {
*
* Typical usage:
* ```cpp
* conn->appendMessage("HTTP/1.1 200 OK\r\n\r\nBye!");
* conn->closeAfterSend(); // Close after sending response
* conn->append_message("HTTP/1.1 200 OK\r\n\r\nBye!");
* conn->close_after_send(); // Close after sending response
* ```
*/
void closeAfterSend() { closeConnection_ = true; }
void close_after_send() { closeConnection_ = true; }
/**
* @brief Get access to the connection's arena allocator.
@@ -135,7 +135,7 @@ struct Connection {
*
* Best practices:
* ```cpp
* ArenaAllocator& arena = conn->getArena();
* ArenaAllocator& arena = conn->get_arena();
*
* // Allocate temporary parsing buffers
* char* buffer = arena.allocate<char>(1024);
@@ -147,7 +147,7 @@ struct Connection {
* std::vector<Token, ArenaStlAllocator<Token>> tokens{&arena};
* ```
*/
ArenaAllocator &getArena() { return arena_; }
ArenaAllocator &get_arena() { return arena_; }
/**
* @brief Get the unique identifier for this connection.
@@ -168,19 +168,19 @@ struct Connection {
*
* Typical usage:
* ```cpp
* std::cout << "Processing request on connection " << conn->getId() <<
* std::endl; logger.info("Connection {} sent {} bytes", conn->getId(),
* std::cout << "Processing request on connection " << conn->get_id() <<
* std::endl; logger.info("Connection {} sent {} bytes", conn->get_id(),
* response.size());
* ```
*/
int64_t getId() const { return id_; }
int64_t get_id() const { return id_; }
/**
* @brief Get the number of bytes queued for transmission.
*
* Returns the total number of bytes in all messages currently
* queued for transmission to the client. This includes all data added via
* appendMessage() that has not yet been sent over the network.
* append_message() that has not yet been sent over the network.
*
* @return Total bytes queued for transmission
*
@@ -206,7 +206,7 @@ struct Connection {
* }
*
* // Logging/monitoring
* metrics.recordQueueDepth(conn->getId(), conn->outgoingBytesQueued());
* metrics.recordQueueDepth(conn->get_id(), conn->outgoingBytesQueued());
* ```
*/
int64_t outgoingBytesQueued() const {
@@ -248,7 +248,7 @@ struct Connection {
* class HttpHandler : public ConnectionHandler {
* void on_connection_established(Connection& conn) override {
* // Allocate HTTP state in connection's arena or heap
* auto* state = conn.getArena().construct<HttpConnectionState>();
* auto* state = conn.get_arena().construct<HttpConnectionState>();
* conn.user_data = state;
* }
*
@@ -299,7 +299,7 @@ struct Connection {
* @note Ownership Transfer: To release a connection back to the server for
* continued processing, use the static method:
* ```cpp
* Server::releaseBackToServer(std::move(connection_ptr));
* Server::release_back_to_server(std::move(connection_ptr));
* ```
*
* This is the correct way to return connection ownership when: