Rename ArenaAllocator -> Arena

This commit is contained in:
2025-09-05 17:57:04 -04:00
parent 46fe51c0bb
commit f56ed2bfbe
22 changed files with 267 additions and 279 deletions

View File

@@ -8,7 +8,7 @@
#include <sys/uio.h>
#include <unistd.h>
#include "arena_allocator.hpp"
#include "arena.hpp"
#include "connection_handler.hpp"
#ifndef __has_feature
@@ -28,7 +28,7 @@
* - RAII cleanup happens if I/O thread doesn't transfer back
*
* Arena allocator thread safety:
* Each Connection contains its own ArenaAllocator instance that is accessed
* Each Connection contains its own Arena instance that is accessed
* exclusively by the thread that currently owns the connection. This ensures
* thread safety without requiring locks:
* - Arena is used by the owning thread for I/O buffers, request parsing, and
@@ -117,7 +117,7 @@ struct Connection {
/**
* @brief Get access to the connection's arena allocator.
*
* Returns a reference to this connection's private ArenaAllocator instance,
* Returns a reference to this connection's private Arena instance,
* which should be used for all temporary allocations during request
* processing. The arena provides extremely fast allocation (~1ns) and
* automatic cleanup when the connection is destroyed or reset.
@@ -135,7 +135,7 @@ struct Connection {
*
* Best practices:
* ```cpp
* ArenaAllocator& arena = conn->get_arena();
* Arena& 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 &get_arena() { return arena_; }
Arena &get_arena() { return arena_; }
/**
* @brief Get the unique identifier for this connection.
@@ -345,7 +345,7 @@ private:
const int64_t id_;
const size_t epoll_index_; // Index of the epoll instance this connection uses
struct sockaddr_storage addr_; // sockaddr_storage handles IPv4/IPv6
ArenaAllocator arena_;
Arena arena_;
ConnectionHandler *handler_;
std::weak_ptr<Server> server_; // Weak reference to server for safe cleanup