Basic implementation of /commit, /version, and /status
No precondition checking, persistence, or log scanning yet.
This commit is contained in:
47
src/pipeline_entry.hpp
Normal file
47
src/pipeline_entry.hpp
Normal file
@@ -0,0 +1,47 @@
|
||||
#pragma once
|
||||
|
||||
#include "connection.hpp"
|
||||
#include <memory>
|
||||
#include <variant>
|
||||
|
||||
/**
|
||||
* Pipeline entry for commit requests that need full 4-stage processing.
|
||||
* Contains connection with parsed CommitRequest.
|
||||
*/
|
||||
struct CommitEntry {
|
||||
std::unique_ptr<Connection> connection;
|
||||
int64_t assigned_version = 0; // Set by sequence stage
|
||||
bool resolve_success = false; // Set by resolve stage
|
||||
bool persist_success = false; // Set by persist stage
|
||||
|
||||
CommitEntry() = default; // Default constructor for variant
|
||||
explicit CommitEntry(std::unique_ptr<Connection> conn)
|
||||
: connection(std::move(conn)) {}
|
||||
};
|
||||
|
||||
/**
|
||||
* Pipeline entry for status requests that need sequence stage processing
|
||||
* then transfer to status threadpool.
|
||||
*/
|
||||
struct StatusEntry {
|
||||
std::unique_ptr<Connection> connection;
|
||||
int64_t version_upper_bound = 0; // Set by sequence stage
|
||||
|
||||
StatusEntry() = default; // Default constructor for variant
|
||||
explicit StatusEntry(std::unique_ptr<Connection> conn)
|
||||
: connection(std::move(conn)) {}
|
||||
};
|
||||
|
||||
/**
|
||||
* Pipeline entry for coordinated shutdown of all stages.
|
||||
* Flows through all stages to ensure proper cleanup.
|
||||
*/
|
||||
struct ShutdownEntry {
|
||||
// Empty struct - presence indicates shutdown
|
||||
};
|
||||
|
||||
/**
|
||||
* Pipeline entry variant type used by the commit processing pipeline.
|
||||
* Each stage pattern-matches on the variant type to handle appropriately.
|
||||
*/
|
||||
using PipelineEntry = std::variant<CommitEntry, StatusEntry, ShutdownEntry>;
|
||||
Reference in New Issue
Block a user