New DynamicViralPostingInvoker: takes runtime post-to target

This commit is contained in:
2026-05-31 07:13:10 -04:00
parent a53e0ca325
commit c60854845d
2 changed files with 38 additions and 2 deletions
@@ -0,0 +1,36 @@
#ifndef DYNAMIC_POSTING_INVOKER_H
#define DYNAMIC_POSTING_INVOKER_H
#include <stdexcept>
#include <boost/asio/io_context.hpp>
#include <spinscale/co/invokers.h>
#include <spinscale/co/postingPromise.h>
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<typename T>
using DynamicPostingPromise =
TaggedPostingPromise<T, DynamicPostTargetThreadTag>;
template<typename T>
using DynamicViralPostingInvoker =
ViralPostingInvoker<DynamicPostingPromise, T>;
} // namespace sscl::co
#endif // DYNAMIC_POSTING_INVOKER_H
+2 -2
View File
@@ -223,8 +223,8 @@ struct PostingPromise
ExplicitPostTarget _calleePostTarget, ExplicitPostTarget _calleePostTarget,
TailArgs &&...) noexcept TailArgs &&...) noexcept
: returnValues(), : returnValues(),
postBackStatus(*this), calleePostTarget(std::move(_calleePostTarget)),
calleePostTarget(std::move(_calleePostTarget)) postBackStatus(*this)
{} {}
/** Viral / free-function entry: post-TO uses ThreadTag default. */ /** Viral / free-function entry: post-TO uses ThreadTag default. */