Lumiera  0.pre.03
»edit your freedom«
Activity Class Reference

#include "vault/gear/activity.hpp"

Description

Record to describe an Activity, to happen within the Scheduler's control flow.

Note
Activity is a »POD with constructor«
  • trivially destructible
  • trivially copyable
  • standard layout

Definition at line 226 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_
 
Activitynext
 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)
 

Member Enumeration Documentation

◆ Verb

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 232 of file activity.hpp.


Class Documentation

◆ vault::gear::Activity::ArgumentData

union vault::gear::Activity::ArgumentData
Class Members
Feed feed
Timing timing
Callback callback
Condition condition
TimeWindow timeWindow
Invocation invocation
Notification notification
+ Collaboration diagram for Activity::ArgumentData:

◆ vault::gear::Activity::Callback

struct vault::gear::Activity::Callback
Class Members
Hook * hook
size_t arg
+ Collaboration diagram for Activity::Callback:

◆ vault::gear::Activity::Feed

struct vault::gear::Activity::Feed
Class Members
uint64_t one
uint64_t two
+ Collaboration diagram for Activity::Feed:

◆ vault::gear::Activity::Invocation

struct vault::gear::Activity::Invocation
Class Members
JobFunctor * task
Instant time
+ Collaboration diagram for Activity::Invocation:

◆ vault::gear::Activity::Notification

struct vault::gear::Activity::Notification
Class Members
Activity * target
Instant timing
+ Collaboration diagram for Activity::Notification:

◆ vault::gear::Activity::TimeWindow

struct vault::gear::Activity::TimeWindow
Class Members
Instant life
Instant dead
+ Collaboration diagram for Activity::TimeWindow:

◆ vault::gear::Activity::Timing

struct vault::gear::Activity::Timing
Class Members
Instant instant
size_t quality
+ Collaboration diagram for Activity::Timing:

Member Function Documentation

◆ activate()

activity::Proc activate ( Time  now,
EXE &  executionCtx 
)

Core Operation: Activate and perform this Activity.

Template Parameters
EXEconcrete binding for the execution context
Parameters
nowcurrent _»wall clock time« (time used for scheduling)
Remarks
this defines the Activity state machine and implements behaviour in dependency of the kind of Activity::Verb. Actual implementation defined effects in the Scheduler are abstracted as executionCtx:
  • post : dispatch the given Activity with start time
  • work : drop the GroomingToken and start processing
  • done : record the end time of a media computation
  • tick : regular maintenance hook
Returns
activity::Proc indication how to proceed with execution
  • activity::PASS continue with regular processing of next
  • activity::SKIP ignore the rest of the chain, look for new work
  • activity::HALT serious problem, stop the Scheduler

Definition at line 626 of file activity.hpp.

Referenced by ActivityLang::activateChain(), ActivityDetector_test::insert_ActivationTap(), SchedulerCommutator_test::verify_Significance(), 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().

+ Here is the caller graph for this function:

◆ dispatch()

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.

Parameters
nowthe 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.
Note
special twist for the 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 676 of file activity.hpp.

Referenced by ActivityLang::dispatchChain(), SchedulerActivity_test::verifyActivity_Gate_notify(), and SchedulerActivity_test::verifyActivity_Gate_opened().

+ Here is the caller graph for this function:

◆ constrainedStart()

Time constrainedStart ( Time  start)
inline
Parameters
startconstrain by a POST-Activity's start time

Definition at line 443 of file activity.hpp.

◆ constrainedDeath()

Time constrainedDeath ( Time  death)
inline
Parameters
deathconstrain by a POST-Activity's deadline

Definition at line 450 of file activity.hpp.

+ Inheritance diagram for Activity:
+ Collaboration diagram for Activity:

The documentation for this class was generated from the following files: