Update comments/docs to match code
This commit is contained in:
13
design.md
13
design.md
@@ -55,16 +55,19 @@ ninja test # or ctest
|
|||||||
- `./test_http_handler` - HTTP protocol handling tests
|
- `./test_http_handler` - HTTP protocol handling tests
|
||||||
- `./test_metric` - Metrics system tests
|
- `./test_metric` - Metrics system tests
|
||||||
- `./test_api_url_parser` - API URL parsing tests
|
- `./test_api_url_parser` - API URL parsing tests
|
||||||
|
- `./test_reference` - Reference counting system tests
|
||||||
- `./test_server_connection_return` - Connection lifecycle tests
|
- `./test_server_connection_return` - Connection lifecycle tests
|
||||||
|
|
||||||
**Benchmarking:**
|
**Benchmarking:**
|
||||||
|
|
||||||
- `./bench_arena` - Memory allocation performance
|
- `./bench_arena` - Memory allocation performance
|
||||||
- `./bench_commit_request` - JSON parsing performance
|
- `./bench_commit_request` - JSON parsing performance
|
||||||
- `./bench_parser_comparison` - Compare vs nlohmann::json and RapidJSON
|
- `./bench_cpu_work` - CPU work benchmarking utility
|
||||||
- `./bench_metric` - Metrics system performance
|
|
||||||
- `./bench_thread_pipeline` - Lock-free pipeline performance
|
|
||||||
- `./bench_format_comparison` - String formatting performance
|
- `./bench_format_comparison` - String formatting performance
|
||||||
|
- `./bench_metric` - Metrics system performance
|
||||||
|
- `./bench_parser_comparison` - Compare vs nlohmann::json and RapidJSON
|
||||||
|
- `./bench_reference` - Reference counting performance
|
||||||
|
- `./bench_thread_pipeline` - Lock-free pipeline performance
|
||||||
|
|
||||||
**Debug tools:**
|
**Debug tools:**
|
||||||
|
|
||||||
@@ -272,7 +275,7 @@ WeaselDB uses `EPOLLONESHOT` for all connection file descriptors to enable safe
|
|||||||
1. **Event Trigger**: Network thread gets epoll event → connection auto-disarmed via ONESHOT
|
1. **Event Trigger**: Network thread gets epoll event → connection auto-disarmed via ONESHOT
|
||||||
1. **Safe Transfer**: Handler can take ownership (`std::move(conn_ptr)`) with no epoll interference
|
1. **Safe Transfer**: Handler can take ownership (`std::move(conn_ptr)`) with no epoll interference
|
||||||
1. **Async Processing**: Connection processed on handler thread while epoll cannot trigger spurious events
|
1. **Async Processing**: Connection processed on handler thread while epoll cannot trigger spurious events
|
||||||
1. **Return & Re-arm**: `Server::receiveConnectionBack()` re-arms fd with `epoll_ctl(EPOLL_CTL_MOD)`
|
1. **Return & Re-arm**: Internal server method re-arms fd with `epoll_ctl(EPOLL_CTL_MOD)` via `Server::release_back_to_server()`
|
||||||
|
|
||||||
**Performance Trade-off:**
|
**Performance Trade-off:**
|
||||||
|
|
||||||
@@ -475,7 +478,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
void on_write_progress(std::unique_ptr<Connection> &conn) override {
|
void on_write_progress(std::unique_ptr<Connection> &conn) override {
|
||||||
if (conn->outgoingBytesQueued() == 0) {
|
if (conn->outgoing_bytes_queued() == 0) {
|
||||||
// Don't use an unbounded amount of memory
|
// Don't use an unbounded amount of memory
|
||||||
conn->reset();
|
conn->reset();
|
||||||
// Write "y\n" repeatedly
|
// Write "y\n" repeatedly
|
||||||
|
|||||||
@@ -196,17 +196,17 @@ struct Connection {
|
|||||||
* Use cases:
|
* Use cases:
|
||||||
* ```cpp
|
* ```cpp
|
||||||
* // Check if all data has been sent
|
* // Check if all data has been sent
|
||||||
* if (conn->outgoingBytesQueued() == 0) {
|
* if (conn->outgoing_bytes_queued() == 0) {
|
||||||
* conn->reset(); // Safe to reset arena
|
* conn->reset(); // Safe to reset arena
|
||||||
* }
|
* }
|
||||||
*
|
*
|
||||||
* // Implement backpressure
|
* // Implement backpressure
|
||||||
* if (conn->outgoingBytesQueued() > MAX_BUFFER_SIZE) {
|
* if (conn->outgoing_bytes_queued() > MAX_BUFFER_SIZE) {
|
||||||
* // Stop adding more data until queue drains
|
* // Stop adding more data until queue drains
|
||||||
* }
|
* }
|
||||||
*
|
*
|
||||||
* // Logging/monitoring
|
* // Logging/monitoring
|
||||||
* metrics.recordQueueDepth(conn->get_id(), conn->outgoingBytesQueued());
|
* metrics.recordQueueDepth(conn->get_id(), conn->outgoing_bytes_queued());
|
||||||
* ```
|
* ```
|
||||||
*/
|
*/
|
||||||
int64_t outgoing_bytes_queued() const {
|
int64_t outgoing_bytes_queued() const {
|
||||||
|
|||||||
Reference in New Issue
Block a user