Enable dev M10 session windows and QUIC route
Foundation / checks (checks) (push) Failing after 56s
Foundation / checks (ecs) (push) Successful in 1m45s
Foundation / checks (postgres) (push) Canceled after 0s
Foundation / checks (tsan) (push) Canceled after 0s
Foundation / postgres-tools (push) Canceled after 0s
Foundation / server-image (push) Canceled after 0s
Foundation / image (push) Canceled after 0s
Foundation / checks (deploy) (push) Canceled after 3m3s
Foundation / checks (client) (push) Canceled after 3m9s
Foundation / checks (network) (push) Canceled after 28s

This commit is contained in:
aevolution-gitops-bot
2026-10-04 09:54:47 -04:00
parent a82290e057
commit e560968530
14 changed files with 199 additions and 44 deletions
+26 -4
View File
@@ -19,6 +19,7 @@
#include "evo/server/postgres_control_ledger.hpp"
#include "evo/server/region_host.hpp"
#include "evo/server/region_sessions.hpp"
#include "evo/server/session_window.hpp"
#include <algorithm>
#include <charconv>
#include <chrono>
@@ -32,14 +33,14 @@
namespace evo::server_app {
struct M10Options {
std::string listen, certificate, key, issuer, environment;
std::string listen, certificate, key, issuer, environment, session_window;
[[nodiscard]] bool any() const noexcept {
return !listen.empty() || !certificate.empty() || !key.empty() || !issuer.empty() ||
!environment.empty();
!environment.empty() || !session_window.empty();
}
[[nodiscard]] bool complete() const noexcept {
return !listen.empty() && !certificate.empty() && !key.empty() && !issuer.empty() &&
!environment.empty();
!environment.empty() && !session_window.empty();
}
};
// Actions are handed to the host as soon as they are scheduled (at most 8 ticks ahead).
@@ -56,6 +57,13 @@ template <typename Host> class M10Bridge {
M10Bridge bridge;
if (!o.any())
return bridge;
const auto window = server::SessionWindow::open(o.session_window, wall_seconds());
if (!window)
return fail(window.error() == server::SessionWindow::Error::expired
? "error m10-window-expired"
: window.error() == server::SessionWindow::Error::too_long
? "error m10-window-too-long"
: "error m10-window");
const auto colon = o.listen.rfind(':');
std::uint16_t port = 0;
if (colon == std::string::npos ||
@@ -82,6 +90,7 @@ template <typename Host> class M10Bridge {
std::copy(issuer.begin(), issuer.end(), issuer_key.public_key.begin());
config.issuer_keys.push_back(issuer_key);
bridge.host_ = &host;
bridge.window_ = *window;
bridge.slot_ = std::make_unique<server::PgSlot>(pg, std::chrono::seconds{2});
const auto lease = [h = &host] { return h->authority(); };
bridge.control_ =
@@ -102,8 +111,18 @@ template <typename Host> class M10Bridge {
[[nodiscard]] bool enabled() const noexcept {
return sessions_ != nullptr;
}
[[nodiscard]] bool accepting(std::uint64_t now_seconds) {
if (!sessions_ || window_closed_)
return sessions_ != nullptr && !window_closed_;
if (window_.accepting(now_seconds))
return sessions_ != nullptr;
window_closed_ = true;
sessions_->shutdown(std::chrono::steady_clock::now());
std::printf("m10 window closed activation=%s\n", window_.activation_id().c_str());
return false;
}
void after_step() {
if (!sessions_)
if (!sessions_ || !accepting(wall_seconds()))
return;
auto& host = *host_;
const auto& s = host.status();
@@ -172,6 +191,8 @@ template <typename Host> class M10Bridge {
std::unique_ptr<server::PostgresControlLedger> control_;
std::unique_ptr<server::PostgresActionLedger> actions_;
std::unique_ptr<server::RegionSessions> sessions_; // Destroyed first: uses the ledgers.
server::SessionWindow window_{"disabled", 1};
bool window_closed_{};
};
#else
inline constexpr bool m10_available = false;
@@ -184,6 +205,7 @@ template <typename Host> class M10Bridge {
[[nodiscard]] bool enabled() const noexcept {
return false;
}
[[nodiscard]] bool accepting(std::uint64_t) const noexcept { return false; }
void after_step() {}
void shutdown() {}
};