Block-Flow: verify handling of Activity records within the Epoch
This commit is contained in:
parent
af8f84a72d
commit
d0fd7f32a9
3 changed files with 131 additions and 34 deletions
|
|
@ -166,7 +166,7 @@ namespace mem {
|
|||
|
||||
public:
|
||||
explicit
|
||||
ExtentFamily(size_t initialCnt =0)
|
||||
ExtentFamily(size_t initialCnt =1)
|
||||
: extents_{initialCnt}
|
||||
, start_{0} // Extents allocated yet marked unused
|
||||
, after_{0}
|
||||
|
|
|
|||
|
|
@ -31,14 +31,15 @@
|
|||
//#include "lib/time/timevalue.hpp"
|
||||
//#include "lib/format-cout.hpp"
|
||||
#include "lib/test/diagnostic-output.hpp" ////////////////////////////////TODO
|
||||
//#include "lib/util.hpp"
|
||||
#include "lib/util.hpp"
|
||||
|
||||
//#include <utility>
|
||||
|
||||
using test::Test;
|
||||
//using std::move;
|
||||
//using util::isSameObject;
|
||||
using util::isSameObject;
|
||||
using lib::test::randTime;
|
||||
using lib::test::showType;
|
||||
|
||||
|
||||
namespace vault{
|
||||
|
|
@ -108,18 +109,103 @@ namespace test {
|
|||
|
||||
|
||||
|
||||
/** @test TODO cover the handling of Epochs
|
||||
* @todo WIP 7/23 ⟶ 🔁define ⟶ implement
|
||||
/** @test cover properties and handling of Epochs (low-level)
|
||||
* - demonstrate that Epoch is placed into an Extent
|
||||
* - verify that both Extent and Epoch access the same memory block
|
||||
* - demonstrate the standard setup and initialisation of an Epoch
|
||||
* - allocate some Activities into the storage and observe free-managment
|
||||
* - detect when the Epoch is filled up
|
||||
* - verify alive / dead decision relative to given deadline
|
||||
* @note this test covers helpers and implementation structures of BlockFlow,
|
||||
* without actually using a BlockFlow instance; rather, the typical handling
|
||||
* and low-level bookkeeping aspects are emulated and observed
|
||||
*/
|
||||
void
|
||||
handleEpoch()
|
||||
{
|
||||
using Extent = Allocator::Extent;
|
||||
// the raw storage Extent is a compact block
|
||||
// providing uninitialised storage typed as `vault::gear::Activity`
|
||||
|
||||
Allocator alloc;
|
||||
alloc.openNew();
|
||||
Extent& extent = *alloc.begin();
|
||||
CHECK (extent.size() == Extent::SIZ::value);
|
||||
CHECK (sizeof(extent) == extent.size() * sizeof(Activity));
|
||||
CHECK (showType<Extent::value_type>() == "vault::gear::Activity"_expect);
|
||||
|
||||
// we can just access some slot and place data there
|
||||
extent[55].data_.feed.one = 555555555555555;
|
||||
|
||||
// now establish an Epoch in this storage block:
|
||||
Epoch& epoch = Epoch::setup (alloc.begin(), Time{0,10});
|
||||
|
||||
// the underlying storage is not touched yet...
|
||||
CHECK (epoch[55].data_.feed.one == 555555555555555);
|
||||
|
||||
// but in the first slot, an »EpochGate« has been implanted
|
||||
Epoch::EpochGate& gate = epoch.gate();
|
||||
CHECK (isSameObject (gate, epoch[0]));
|
||||
CHECK (isSameObject (epoch[0], extent[0]));
|
||||
CHECK (Time{gate.deadline()} == Time(0,10));
|
||||
CHECK (Time{gate.deadline()} == Time{epoch[0].data_.condition.dead});
|
||||
CHECK (Activity::GATE == epoch[0].verb_);
|
||||
|
||||
// the gate's `next`-pointer is (ab)used to manage the next allocation slot
|
||||
CHECK (isSameObject (*gate.next, epoch[extent.size()-1]));
|
||||
|
||||
// the storage there is not yet used, but will be overwritten by the ctor call
|
||||
epoch[extent.size()-1].data_.timing.instant = Time{5,5};
|
||||
|
||||
// allocate a new Activity into the next free slot
|
||||
BlockFlow::AllocatorHandle allocHandle{alloc.begin()};
|
||||
Activity& timeStart = allocHandle.create (Activity::TIMESTART);
|
||||
CHECK (isSameObject (timeStart, epoch[extent.size()-1]));
|
||||
|
||||
// this Activity object is properly initialised (and memory was altered)
|
||||
CHECK (epoch[extent.size()-1].data_.timing.instant != Time(5,5));
|
||||
CHECK (epoch[extent.size()-1].data_.timing.instant == Time::NEVER);
|
||||
CHECK (timeStart.verb_ == Activity::TIMESTART);
|
||||
CHECK (timeStart.data_.timing.instant == Time::NEVER);
|
||||
CHECK (timeStart.data_.timing.quality == 0);
|
||||
|
||||
// and the free-pointer was decremented to point to the next free slot
|
||||
CHECK (isSameObject (*gate.next, epoch[extent.size()-2]));
|
||||
|
||||
// which also implies that there is still ample space left...
|
||||
CHECK (gate.hasFreeSlot());
|
||||
|
||||
// so let's eat this space up...
|
||||
for (uint i=extent.size()-2; i>1; --i)
|
||||
allocHandle.create();
|
||||
|
||||
// one final slot is left (beyond of the EpochGate itself)
|
||||
CHECK (isSameObject (*gate.next, epoch[1]));
|
||||
CHECK (gate.hasFreeSlot());
|
||||
|
||||
allocHandle.create (size_t(111), size_t(222));
|
||||
CHECK (epoch[1].verb_ == Activity::FEED);
|
||||
CHECK (epoch[1].data_.feed.one = 111);
|
||||
CHECK (epoch[1].data_.feed.two = 222);
|
||||
|
||||
// aaand the boat is full...
|
||||
CHECK (not gate.hasFreeSlot());
|
||||
CHECK (isSameObject (*gate.next, epoch[0]));
|
||||
|
||||
// a given Epoch can be checked for relevance against a deadline
|
||||
CHECK (gate.deadline() == Time(0,10));
|
||||
|
||||
CHECK ( gate.isAlive (Time(0,5)));
|
||||
CHECK ( gate.isAlive (Time(999,9)));
|
||||
CHECK (not gate.isAlive (Time(0,10)));
|
||||
CHECK (not gate.isAlive (Time(1,10)));
|
||||
////////////////////////////////////////////////////////////////////////////////////////TICKET #1298 : actually use a GATE implementation and then also check the count-down latch
|
||||
}
|
||||
|
||||
|
||||
|
||||
/** @test TODO place Activity record into storage
|
||||
* @todo WIP 7/23 ⟶ define ⟶ implement
|
||||
* @todo WIP 7/23 ⟶ 🔁define ⟶ implement
|
||||
*/
|
||||
void
|
||||
placeActivity()
|
||||
|
|
|
|||
|
|
@ -78867,22 +78867,22 @@ Date:   Thu Apr 20 18:53:17 2023 +0200<br/>
|
|||
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1689199958807" ID="ID_1109817733" MODIFIED="1689199964871" TEXT="verifyAPI">
|
||||
<icon BUILTIN="flag-yellow"/>
|
||||
</node>
|
||||
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1689199390484" ID="ID_679990341" MODIFIED="1689199615217" TEXT="handleEpoch">
|
||||
<icon BUILTIN="flag-yellow"/>
|
||||
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1689202254231" ID="ID_322073846" MODIFIED="1689202266310" TEXT="Eigenschaften einer neu erstellten Epoche">
|
||||
<icon BUILTIN="flag-yellow"/>
|
||||
<node BACKGROUND_COLOR="#eef0c5" COLOR="#990000" CREATED="1689199390484" ID="ID_679990341" MODIFIED="1689294955243" TEXT="handleEpoch">
|
||||
<icon BUILTIN="pencil"/>
|
||||
<node COLOR="#338800" CREATED="1689202254231" ID="ID_322073846" MODIFIED="1689294940657" TEXT="Eigenschaften einer neu erstellten Epoche">
|
||||
<icon BUILTIN="button_ok"/>
|
||||
</node>
|
||||
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1689202440952" ID="ID_1233864251" MODIFIED="1689202450565" TEXT="EpochGate-Verhalten">
|
||||
<icon BUILTIN="flag-yellow"/>
|
||||
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1689202440952" ID="ID_1233864251" MODIFIED="1689295508928" TEXT="EpochGate-Verhalten">
|
||||
<icon BUILTIN="hourglass"/>
|
||||
</node>
|
||||
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1689202329260" ID="ID_1491199644" MODIFIED="1689202334829" TEXT="Belegen eines Slot">
|
||||
<icon BUILTIN="flag-yellow"/>
|
||||
<node COLOR="#338800" CREATED="1689202329260" ID="ID_1491199644" MODIFIED="1689294946303" TEXT="Belegen eines Slot">
|
||||
<icon BUILTIN="button_ok"/>
|
||||
</node>
|
||||
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1689202342763" ID="ID_1522127566" MODIFIED="1689202365416" TEXT="volle Epoche erkennen">
|
||||
<icon BUILTIN="flag-yellow"/>
|
||||
<node COLOR="#338800" CREATED="1689202342763" ID="ID_1522127566" MODIFIED="1689295488226" TEXT="volle Epoche erkennen">
|
||||
<icon BUILTIN="button_ok"/>
|
||||
</node>
|
||||
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1689202395764" ID="ID_1382459579" MODIFIED="1689202409602" TEXT="Entscheidung aktiv/obsolet">
|
||||
<icon BUILTIN="flag-yellow"/>
|
||||
<node COLOR="#338800" CREATED="1689202395764" ID="ID_1382459579" MODIFIED="1689295734831" TEXT="Entscheidung aktiv/obsolet">
|
||||
<icon BUILTIN="button_ok"/>
|
||||
</node>
|
||||
</node>
|
||||
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1689199616791" ID="ID_752152349" MODIFIED="1689200031345" TEXT="placeActivity">
|
||||
|
|
@ -79801,30 +79801,30 @@ Date:   Thu Apr 20 18:53:17 2023 +0200<br/>
|
|||
</node>
|
||||
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1688515962746" HGAP="25" ID="ID_468510160" MODIFIED="1688559368790" TEXT="Strukturen" VSHIFT="4">
|
||||
<icon BUILTIN="flag-yellow"/>
|
||||
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1688515974697" ID="ID_1054833524" MODIFIED="1688772907535" TEXT="hält eine ExtentFamily<Activity,siz>">
|
||||
<icon BUILTIN="flag-yellow"/>
|
||||
<node COLOR="#338800" CREATED="1688515974697" ID="ID_1054833524" MODIFIED="1689296818673" TEXT="hält eine ExtentFamily<Activity,siz>">
|
||||
<icon BUILTIN="button_ok"/>
|
||||
</node>
|
||||
<node BACKGROUND_COLOR="#eef0c5" COLOR="#990000" CREATED="1688555107931" ID="ID_285024973" MODIFIED="1688862187262" TEXT="Datentyp: Epoch">
|
||||
<icon BUILTIN="pencil"/>
|
||||
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1688555141913" ID="ID_406773800" MODIFIED="1688555169035" TEXT="als Subtyp der Extent-Storage">
|
||||
<icon BUILTIN="flag-yellow"/>
|
||||
<node COLOR="#338800" CREATED="1688555141913" ID="ID_406773800" MODIFIED="1689296815496" TEXT="als Subtyp der Extent-Storage">
|
||||
<icon BUILTIN="button_ok"/>
|
||||
</node>
|
||||
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1688855335861" ID="ID_805170537" MODIFIED="1688855478519" TEXT="verwaltet ein EpochGate">
|
||||
<arrowlink COLOR="#87335c" DESTINATION="ID_262514506" ENDARROW="Default" ENDINCLINATION="-51;-3;" ID="Arrow_ID_1549134996" STARTARROW="None" STARTINCLINATION="57;6;"/>
|
||||
<icon BUILTIN="flag-yellow"/>
|
||||
<node COLOR="#338800" CREATED="1688855335861" ID="ID_805170537" MODIFIED="1689296881046" TEXT="verwaltet ein EpochGate">
|
||||
<arrowlink COLOR="#336987" DESTINATION="ID_262514506" ENDARROW="Default" ENDINCLINATION="-88;-7;" ID="Arrow_ID_1549134996" STARTARROW="None" STARTINCLINATION="57;6;"/>
|
||||
<icon BUILTIN="button_ok"/>
|
||||
</node>
|
||||
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1688855508871" ID="ID_1411819334" MODIFIED="1688855516993" TEXT="verwaltet einen Füllstand">
|
||||
<icon BUILTIN="flag-yellow"/>
|
||||
<node COLOR="#338800" CREATED="1688855508871" ID="ID_1411819334" MODIFIED="1689296800776" TEXT="verwaltet einen Füllstand">
|
||||
<icon BUILTIN="button_ok"/>
|
||||
<node BACKGROUND_COLOR="#e0ceaa" COLOR="#690f14" CREATED="1688855600025" ID="ID_250176571" MODIFIED="1688855663180" TEXT="notgedrungenermaßen als Pointer">
|
||||
<arrowlink COLOR="#5d59c8" DESTINATION="ID_1249055593" ENDARROW="Default" ENDINCLINATION="-17;-67;" ID="Arrow_ID_246272817" STARTARROW="None" STARTINCLINATION="115;9;"/>
|
||||
<icon BUILTIN="smily_bad"/>
|
||||
</node>
|
||||
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1688855675271" ID="ID_1730018277" MODIFIED="1688855696429" TEXT="wird rückwärts laufend verwendet">
|
||||
<icon BUILTIN="flag-yellow"/>
|
||||
<node COLOR="#338800" CREATED="1688855675271" ID="ID_1730018277" MODIFIED="1689296797030" TEXT="wird rückwärts laufend verwendet">
|
||||
<icon BUILTIN="button_ok"/>
|
||||
<node CREATED="1688855956754" ID="ID_649163779" MODIFIED="1688855974112" TEXT="initialisiert auf das letzte Element im Extent"/>
|
||||
<node CREATED="1688855974789" ID="ID_842856173" MODIFIED="1688855979243" TEXT="jeweils dekrementiert"/>
|
||||
</node>
|
||||
<node CREATED="1688855917759" ID="ID_970541500" MODIFIED="1688855950792" TEXT="Abbruchbedingung: next == & EpochGate">
|
||||
<node COLOR="#435e98" CREATED="1688855917759" ID="ID_970541500" MODIFIED="1689296803550" TEXT="Abbruchbedingung: next == & EpochGate">
|
||||
<icon BUILTIN="idea"/>
|
||||
</node>
|
||||
</node>
|
||||
|
|
@ -79853,7 +79853,7 @@ Date:   Thu Apr 20 18:53:17 2023 +0200<br/>
|
|||
</node>
|
||||
<node COLOR="#435e98" CREATED="1689247882172" ID="ID_1363520850" MODIFIED="1689265724651" TEXT="mögliche Ansätze">
|
||||
<icon BUILTIN="yes"/>
|
||||
<node COLOR="#5b280f" CREATED="1689247931732" ID="ID_1905005266" MODIFIED="1689248098163" TEXT="einen Epochen-Iterator zum universellen Agens ausbauen">
|
||||
<node COLOR="#5b280f" CREATED="1689247931732" FOLDED="true" ID="ID_1905005266" MODIFIED="1689248098163" TEXT="einen Epochen-Iterator zum universellen Agens ausbauen">
|
||||
<icon BUILTIN="button_cancel"/>
|
||||
<node CREATED="1689248019527" ID="ID_167478839" MODIFIED="1689248115737" TEXT="könnte noch weitere Abkürzungsfunktionen tragen">
|
||||
<icon BUILTIN="idea"/>
|
||||
|
|
@ -79888,7 +79888,7 @@ Date:   Thu Apr 20 18:53:17 2023 +0200<br/>
|
|||
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1689248380839" ID="ID_215002237" MODIFIED="1689248398479" TEXT="BlockFlow stellt dann nur die grundlegenden Konverter bereit">
|
||||
<icon BUILTIN="yes"/>
|
||||
</node>
|
||||
<node COLOR="#435e98" CREATED="1689248522225" ID="ID_1824695865" MODIFIED="1689265504640" TEXT="problematisches Layering der Iteratoren">
|
||||
<node COLOR="#435e98" CREATED="1689248522225" FOLDED="true" ID="ID_1824695865" MODIFIED="1689265504640" TEXT="problematisches Layering der Iteratoren">
|
||||
<icon BUILTIN="messagebox_warning"/>
|
||||
<node CREATED="1689248585384" ID="ID_1368624985" MODIFIED="1689248594457" TEXT="IterStateWrapper hat eine private Core"/>
|
||||
<node CREATED="1689248595565" ID="ID_1453930677" MODIFIED="1689248612015" TEXT="in IterExplorer gäbe es eine Variante mit Vererbung"/>
|
||||
|
|
@ -79952,8 +79952,8 @@ Date:   Thu Apr 20 18:53:17 2023 +0200<br/>
|
|||
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1688516199288" ID="ID_1824919687" MODIFIED="1688516212258" TEXT="Epochen-Deadline">
|
||||
<icon BUILTIN="flag-yellow"/>
|
||||
<node CREATED="1688516220648" ID="ID_1169377280" MODIFIED="1688516237353" TEXT="steht in einem Gate im 1.Slot"/>
|
||||
<node COLOR="#435e98" CREATED="1688553471328" HGAP="24" ID="ID_262514506" MODIFIED="1688868016296" TEXT="dafür eigenen Sub-Typ anliegen: EpochGate" VSHIFT="7">
|
||||
<linktarget COLOR="#87335c" DESTINATION="ID_262514506" ENDARROW="Default" ENDINCLINATION="-51;-3;" ID="Arrow_ID_1549134996" SOURCE="ID_805170537" STARTARROW="None" STARTINCLINATION="57;6;"/>
|
||||
<node COLOR="#435e98" CREATED="1688553471328" HGAP="24" ID="ID_262514506" MODIFIED="1689296881046" TEXT="dafür eigenen Sub-Typ anliegen: EpochGate" VSHIFT="7">
|
||||
<linktarget COLOR="#336987" DESTINATION="ID_262514506" ENDARROW="Default" ENDINCLINATION="-88;-7;" ID="Arrow_ID_1549134996" SOURCE="ID_805170537" STARTARROW="None" STARTINCLINATION="57;6;"/>
|
||||
<icon BUILTIN="yes"/>
|
||||
<node CREATED="1688855534850" ID="ID_568063333" MODIFIED="1688855541413" TEXT="eine Activity vom Typ GATE"/>
|
||||
<node CREATED="1688855549226" ID="ID_739862110" MODIFIED="1688855565203" TEXT="wird aber speziell vorinitialisiert"/>
|
||||
|
|
@ -87849,6 +87849,17 @@ class Something
|
|||
<arrowlink COLOR="#c35b60" DESTINATION="ID_601841679" ENDARROW="Default" ENDINCLINATION="53;0;" ID="Arrow_ID_198244235" STARTARROW="None" STARTINCLINATION="53;0;"/>
|
||||
<icon BUILTIN="flag-yellow"/>
|
||||
</node>
|
||||
<node CREATED="1689294635406" HGAP="23" ID="ID_1624761863" MODIFIED="1689294849730" TEXT="Test/Debug" VSHIFT="35">
|
||||
<cloud COLOR="#e4d4ac"/>
|
||||
<icon BUILTIN="info"/>
|
||||
<node CREATED="1689294864822" ID="ID_1556429085" MODIFIED="1689294870249" TEXT="NoBug">
|
||||
<node CREATED="1689294871597" ID="ID_1116343087" MODIFIED="1689294877880" TEXT="Logging-Tracing">
|
||||
<node CREATED="1689294901089" ID="ID_249859430" MODIFIED="1689294914759" TEXT="export NOBUG_LOG=debugging:WARN,logging:INFO,test:TRACE,diff:TRACE,command:TRACE">
|
||||
<icon BUILTIN="idea"/>
|
||||
</node>
|
||||
</node>
|
||||
</node>
|
||||
</node>
|
||||
</node>
|
||||
<node CREATED="1439176875682" HGAP="47" ID="ID_1487331591" MODIFIED="1582315396874" TEXT="Referenzplattform" VSHIFT="60">
|
||||
<icon BUILTIN="prepare"/>
|
||||
|
|
|
|||
Loading…
Reference in a new issue