Parse commit request
This commit is contained in:
@@ -13,6 +13,10 @@
|
||||
#include "server.hpp"
|
||||
#include "thread_pipeline.hpp"
|
||||
|
||||
// Forward declarations
|
||||
struct CommitRequest;
|
||||
struct JsonCommitRequestParser;
|
||||
|
||||
/**
|
||||
* HTTP routes supported by WeaselDB server.
|
||||
* Using enum for efficient switch-based routing.
|
||||
@@ -56,6 +60,11 @@ struct HttpConnectionState {
|
||||
bool header_field_complete = false;
|
||||
int64_t request_id = 0; // X-Request-Id header value
|
||||
|
||||
// Streaming parser for POST requests
|
||||
std::unique_ptr<JsonCommitRequestParser> commit_parser;
|
||||
std::unique_ptr<CommitRequest> commit_request;
|
||||
bool parsing_commit = false;
|
||||
|
||||
explicit HttpConnectionState(ArenaAllocator &arena);
|
||||
};
|
||||
|
||||
@@ -176,10 +185,10 @@ private:
|
||||
static void sendResponse(Connection &conn, int status_code,
|
||||
std::string_view content_type, std::string_view body,
|
||||
bool close_connection = false);
|
||||
static void sendJsonResponse(Connection &conn, int status_code,
|
||||
std::string_view json,
|
||||
bool close_connection = false);
|
||||
static void sendErrorResponse(Connection &conn, int status_code,
|
||||
std::string_view message,
|
||||
bool close_connection = false);
|
||||
static void send_json_response(Connection &conn, int status_code,
|
||||
std::string_view json,
|
||||
bool close_connection = false);
|
||||
static void send_error_response(Connection &conn, int status_code,
|
||||
std::string_view message,
|
||||
bool close_connection = false);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user