From c60854845d5650953c2dc591a76142af93349a03 Mon Sep 17 00:00:00 2001 From: Hayodea Hekol Date: Sun, 31 May 2026 07:13:10 -0400 Subject: [PATCH] New DynamicViralPostingInvoker: takes runtime post-to target --- include/spinscale/co/dynamicPostingInvoker.h | 36 ++++++++++++++++++++ include/spinscale/co/postingPromise.h | 4 +-- 2 files changed, 38 insertions(+), 2 deletions(-) create mode 100644 include/spinscale/co/dynamicPostingInvoker.h diff --git a/include/spinscale/co/dynamicPostingInvoker.h b/include/spinscale/co/dynamicPostingInvoker.h new file mode 100644 index 0000000..d663c04 --- /dev/null +++ b/include/spinscale/co/dynamicPostingInvoker.h @@ -0,0 +1,36 @@ +#ifndef DYNAMIC_POSTING_INVOKER_H +#define DYNAMIC_POSTING_INVOKER_H + +#include + +#include + +#include +#include + +namespace sscl::co { + +/** Fallback ThreadTag for DynamicViralPostingInvoker when ExplicitPostTarget is + * omitted. Callers must always pass ExplicitPostTarget in production paths. + */ +struct DynamicPostTargetThreadTag +{ + static boost::asio::io_context &io_context() + { + throw std::runtime_error( + std::string(__func__) + + ": ExplicitPostTarget required for DynamicViralPostingInvoker"); + } +}; + +template +using DynamicPostingPromise = + TaggedPostingPromise; + +template +using DynamicViralPostingInvoker = + ViralPostingInvoker; + +} // namespace sscl::co + +#endif // DYNAMIC_POSTING_INVOKER_H diff --git a/include/spinscale/co/postingPromise.h b/include/spinscale/co/postingPromise.h index 2d49b3e..a7161f5 100644 --- a/include/spinscale/co/postingPromise.h +++ b/include/spinscale/co/postingPromise.h @@ -223,8 +223,8 @@ struct PostingPromise ExplicitPostTarget _calleePostTarget, TailArgs &&...) noexcept : returnValues(), - postBackStatus(*this), - calleePostTarget(std::move(_calleePostTarget)) + calleePostTarget(std::move(_calleePostTarget)), + postBackStatus(*this) {} /** Viral / free-function entry: post-TO uses ThreadTag default. */