YOrch 1.0.0
Loading...
Searching...
No Matches
yorch::retry_task< Task, Policy > Struct Template Reference

Retry adapter that re-invokes a task when it returns retry. More...

#include <retry.hpp>

Inheritance diagram for yorch::retry_task< Task, Policy >:
Collaboration diagram for yorch::retry_task< Task, Policy >:

Public Member Functions

constexpr retry_task (Task &&stored_task, Policy &&stored_policy) noexcept(std::is_nothrow_move_constructible_v< Task > &&std::is_nothrow_move_constructible_v< Policy >)
 
constexpr retry_task (const Task &stored_task, const Policy &stored_policy) noexcept(std::is_nothrow_copy_constructible_v< Task > &&std::is_nothrow_copy_constructible_v< Policy >)
 
template<typename Ctx , typename Prev >
requires adapter_wrappable_task<Task, Ctx, Prev> && retry_policy<Policy>
constexpr decltype(auto) invoke_raw (exec_context< Ctx, Prev > &ec) noexcept(noexcept(task.invoke_raw(ec)) &&noexcept(policy.should_retry(std::size_t {})) &&noexcept(detail::handle_retry_exhausted(policy, std::declval< std::remove_cvref_t< detail::raw_task_result_t< Task &, Ctx, Prev > > >())))
 Executes the wrapped task and re-runs it while policy permits.
 
template<typename Ctx , typename Prev , typename U = Task>
requires direct_output_task<U, Ctx, Prev> && retry_policy<Policy>
constexpr step_result invoke_into (exec_context< Ctx, Prev > &ec, direct_out< detail::declared_task_output_t< U > > out) noexcept(noexcept(task.invoke_into(ec, out)) &&noexcept(policy.should_retry(std::size_t {})) &&noexcept(detail::handle_retry_exhausted(policy, step_result::retry())))
 

Public Attributes

Task task
 
Policy policy
 

Detailed Description

template<typename Task, typename Policy>
struct yorch::retry_task< Task, Policy >

Retry adapter that re-invokes a task when it returns retry.

This wrapper leaves the task's raw result type unchanged. Only results that can explicitly carry step_status::retry participate in the retry loop: step_result and task_result<T>. Plain value and void results are forwarded unchanged because they cannot request retry through the current status model.

Template Parameters
TaskStored task type.
PolicyStored retry policy type.

Definition at line 68 of file retry.hpp.

Constructor & Destructor Documentation

◆ retry_task() [1/2]

template<typename Task , typename Policy >
constexpr yorch::retry_task< Task, Policy >::retry_task ( Task &&  stored_task,
Policy &&  stored_policy 
)
inlineconstexprnoexcept

Definition at line 75 of file retry.hpp.

◆ retry_task() [2/2]

template<typename Task , typename Policy >
constexpr yorch::retry_task< Task, Policy >::retry_task ( const Task &  stored_task,
const Policy &  stored_policy 
)
inlineconstexprnoexcept

Definition at line 81 of file retry.hpp.

Member Function Documentation

◆ invoke_into()

template<typename Task , typename Policy >
template<typename Ctx , typename Prev , typename U = Task>
requires direct_output_task<U, Ctx, Prev> && retry_policy<Policy>
constexpr step_result yorch::retry_task< Task, Policy >::invoke_into ( exec_context< Ctx, Prev > &  ec,
direct_out< detail::declared_task_output_t< U > >  out 
)
inlineconstexprnoexcept

Definition at line 140 of file retry.hpp.

◆ invoke_raw()

template<typename Task , typename Policy >
template<typename Ctx , typename Prev >
requires adapter_wrappable_task<Task, Ctx, Prev> && retry_policy<Policy>
constexpr decltype(auto) yorch::retry_task< Task, Policy >::invoke_raw ( exec_context< Ctx, Prev > &  ec)
inlineconstexprnoexcept

Executes the wrapped task and re-runs it while policy permits.

Each retry attempt re-enters the wrapped task from scratch with the same borrowed execution context. Side effects from earlier attempts are not rolled back by this adapter.

Template Parameters
CtxContext schema.
PrevDirect-parent slot view type.
Parameters
ecBorrowed execution context.
Returns
The first non-retry raw result, or the policy-selected result once the retry budget is exhausted.

Definition at line 102 of file retry.hpp.

Member Data Documentation

◆ policy

template<typename Task , typename Policy >
Policy yorch::retry_task< Task, Policy >::policy

Definition at line 73 of file retry.hpp.

◆ task

template<typename Task , typename Policy >
Task yorch::retry_task< Task, Policy >::task

Definition at line 72 of file retry.hpp.


The documentation for this struct was generated from the following file: