Lumiera
0.pre.03
»edit your freedom«
|
#include "vault/gear/activity.hpp"
Record to describe an Activity, to happen within the Scheduler's control flow.
Definition at line 235 of file activity.hpp.
Public Types | |
enum | Verb { INVOKE, WORKSTART, WORKSTOP, NOTIFY, GATE, POST, FEED, HOOK, TICK } |
All possible kinds of activities. More... | |
Public Member Functions | |
Activity (Verb verb) noexcept | |
Activity (uint64_t o1, uint64_t o2) noexcept | |
Activity (JobFunctor &job, Time nominalTime, Activity &feed) noexcept | |
Activity (Activity *target, Time limitWhen=Time::ANYTIME) noexcept | |
Activity (int expectNotifications, Time deadline=Time::NEVER) noexcept | |
Activity (Time when, Activity *followUp) noexcept | |
Activity (Time start, Time after, Activity *followUp) noexcept | |
Activity (activity::Hook &callback, size_t arg) noexcept | |
template<class EXE > | |
activity::Proc | activate (Time now, EXE &executionCtx) |
Core Operation: Activate and perform this Activity. More... | |
Time | constrainedDeath (Time death) |
Time | constrainedStart (Time start) |
template<class EXE > | |
activity::Proc | dispatch (Time now, EXE &executionCtx) |
Entrance point for an activation, which has been dispatched indirectly through the dispatch and/or priority queue; typically this is achieved by invoking the post -λ on the executionCtx, or by activating a POST -Activity. More... | |
void | incDependencies () |
bool | is (Activity::Verb expectedVerb) const |
operator std::string () const | |
diagnostic representation | |
void | setNotificationTarget (Activity *target, Time limitStart=Time::ANYTIME) |
std::string | showData () const |
std::string | showVerb () const |
Public Attributes | |
ArgumentData | data_ |
Activity * | next |
Activities are organised into chains to represent relations based on verbs. | |
const Verb | verb_ |
Classes | |
union | ArgumentData |
Storage of Argument data dependent on Activity::verb_. More... | |
struct | Callback |
Extension point to invoke. More... | |
struct | Condition |
Access gate condition to evaluate. More... | |
struct | Feed |
Payload data to provide. More... | |
struct | Invocation |
External work functor to activate. More... | |
struct | Notification |
Notification towards another Activity. More... | |
struct | TimeWindow |
Time window to define for activation. More... | |
struct | Timing |
Timing observation to propagate. More... | |
Private Types | |
using | Instant = activity::Instant |
Private Member Functions | |
template<class EXE > | |
activity::Proc | callHook (Time now, EXE &executionCtx) |
template<class EXE > | |
activity::Proc | checkGate (Time now, EXE &) |
template<class EXE > | |
activity::Proc | doTick (Time now, EXE &executionCtx) |
activity::Proc | invokeFunktor (Time) noexcept |
template<class EXE > | |
activity::Proc | notifyHook (Time now, EXE &executionCtx) |
template<class EXE > | |
activity::Proc | postNotify (Time now, EXE &executionCtx) |
template<class EXE > | |
activity::Proc | postSelf (Time now, EXE &executionCtx) |
activity::Proc | receiveGateNotification (Time now) |
void | setDefaultArg (Verb verb) noexcept |
template<class EXE > | |
activity::Proc | signalStart (Time now, EXE &executionCtx) |
template<class EXE > | |
activity::Proc | signalStop (Time now, EXE &executionCtx) |
enum Verb |
All possible kinds of activities.
Enumerator | |
---|---|
INVOKE | dispatch a JobFunctor into a worker thread |
WORKSTART | signal start of some processing and transition grooming mode ⟼ *work mode |
WORKSTOP | correspondingly signal end of some processing |
NOTIFY | push a message to another Activity |
GATE | probe window + count-down; activate next Activity, else re-schedule |
POST | post a message providing a chain of further time-bound Activities |
FEED | supply additional payload data for a preceding Activity |
HOOK | invoke an extension point through the activity::Hook interface |
TICK | internal engine »heart beat« for internal maintenance hook(s) |
Definition at line 241 of file activity.hpp.
union vault::gear::Activity::ArgumentData |
Class Members | ||
---|---|---|
Feed | feed | |
Timing | timing | |
Callback | callback | |
Condition | condition | |
TimeWindow | timeWindow | |
Invocation | invocation | |
Notification | notification |
struct vault::gear::Activity::Callback |
struct vault::gear::Activity::Feed |
struct vault::gear::Activity::Invocation |
struct vault::gear::Activity::Notification |
struct vault::gear::Activity::TimeWindow |
struct vault::gear::Activity::Timing |
activity::Proc activate | ( | Time | now, |
EXE & | executionCtx | ||
) |
Core Operation: Activate and perform this Activity.
EXE | concrete binding for the execution context |
now | current _»wall clock time« (time used for scheduling) |
post
: dispatch the given Activity with start timework
: drop the GroomingToken
and start processingdone
: record the end time of a media computationtick
: regular maintenance hook next
Definition at line 635 of file activity.hpp.
Referenced by ActivityLang::activateChain(), ActivityDetector_test::insert_ActivationTap(), SchedulerActivity_test::verifyActivity_Gate_block(), SchedulerActivity_test::verifyActivity_Gate_dead(), SchedulerActivity_test::verifyActivity_Gate_opened(), SchedulerActivity_test::verifyActivity_Gate_pass(), ActivityDetector_test::watch_ActivationProbe(), ActivityDetector_test::watch_gate(), and ActivityDetector_test::watch_notification().
activity::Proc dispatch | ( | Time | now, |
EXE & | executionCtx | ||
) |
Entrance point for an activation, which has been dispatched indirectly through the dispatch and/or priority queue; typically this is achieved by invoking the post
-λ on the executionCtx, or by activating a POST
-Activity.
Control flow passing here has acquired the GroomingToken
and can thus assume single threaded execution until WORKSTART
.
Notably this entrance is used to implement gating to wait for prerequisites; when a notification is passed to a GATE
-Activity, the embedded counter is decremented; after all prerequisites are „checked off“ this way, the Activity-chain behind the Gate is activated.
now | the scheduler-time; assuming that a call through the post -λ will only be actually de-queued when scheduler-time equals the start time defined in the POST activity and passed through the post -λ as parameter. |
NOTIFY
-Activity: it is not activated itself, rather the #notify operation is invoked on its target argument; this is necessary since a notification passes control-flow outside the regular linear next
-chain. Definition at line 685 of file activity.hpp.
Referenced by ActivityLang::dispatchChain(), SchedulerActivity_test::verifyActivity_Gate_notify(), and SchedulerActivity_test::verifyActivity_Gate_opened().
start | constrain by a POST-Activity's start time |
Definition at line 452 of file activity.hpp.
death | constrain by a POST-Activity's deadline |
Definition at line 459 of file activity.hpp.