5050
5151#include " DecongestionService.h"
5252#include " Framework/DataProcessingHelpers.h"
53+ #include " Framework/DataModelViews.h"
5354#include " DataRelayerHelpers.h"
5455#include " Headers/DataHeader.h"
5556#include " Headers/DataHeaderHelpers.h"
@@ -585,7 +586,7 @@ auto decongestionCallbackLate = [](AsyncTask& task, size_t aid) -> void {
585586// the inputs which are shared between this device and others
586587// to the next one in the daisy chain.
587588// FIXME: do it in a smarter way than O(N^2)
588- static auto forwardInputs = [](ServiceRegistryRef registry, TimesliceSlot slot, std::vector<MessageSet >& currentSetOfInputs,
589+ static auto forwardInputs = [](ServiceRegistryRef registry, TimesliceSlot slot, std::vector<std::vector<fair::mq::MessagePtr> >& currentSetOfInputs,
589590 TimesliceIndex::OldestOutputInfo oldestTimeslice, bool copy, bool consume = true ) {
590591 auto & proxy = registry.get <FairMQDeviceProxy>();
591592
@@ -617,7 +618,7 @@ static auto forwardInputs = [](ServiceRegistryRef registry, TimesliceSlot slot,
617618 O2_SIGNPOST_END (forwarding, sid, " forwardInputs" , " Forwarding done" );
618619};
619620
620- static auto cleanEarlyForward = [](ServiceRegistryRef registry, TimesliceSlot slot, std::vector<MessageSet >& currentSetOfInputs,
621+ static auto cleanEarlyForward = [](ServiceRegistryRef registry, TimesliceSlot slot, std::vector<std::vector<fair::mq::MessagePtr> >& currentSetOfInputs,
621622 TimesliceIndex::OldestOutputInfo oldestTimeslice, bool copy, bool consume = true ) {
622623 auto & proxy = registry.get <FairMQDeviceProxy>();
623624
@@ -627,7 +628,7 @@ static auto cleanEarlyForward = [](ServiceRegistryRef registry, TimesliceSlot sl
627628 // Always copy them, because we do not want to actually send them.
628629 // We merely need the side effect of the consume, if applicable.
629630 for (size_t ii = 0 , ie = currentSetOfInputs.size (); ii < ie; ++ii) {
630- auto span = std::span<fair::mq::MessagePtr>(currentSetOfInputs[ii]. messages );
631+ auto span = std::span<fair::mq::MessagePtr>(currentSetOfInputs[ii]);
631632 DataProcessingHelpers::cleanForwardedMessages (span, consume);
632633 }
633634
@@ -1278,7 +1279,7 @@ void DataProcessingDevice::Run()
12781279 // - we can trigger further events from the queue
12791280 // - we can guarantee this is the last thing we do in the loop (
12801281 // assuming no one else is adding to the queue before this point).
1281- auto onDrop = [®istry = mServiceRegistry , lid](TimesliceSlot slot, std::vector<MessageSet >& dropped, TimesliceIndex::OldestOutputInfo oldestOutputInfo) {
1282+ auto onDrop = [®istry = mServiceRegistry , lid](TimesliceSlot slot, std::vector<std::vector<fair::mq::MessagePtr> >& dropped, TimesliceIndex::OldestOutputInfo oldestOutputInfo) {
12821283 O2_SIGNPOST_START (device, lid, " run_loop" , " Dropping message from slot %" PRIu64 " . Forwarding as needed." , (uint64_t )slot.index );
12831284 ServiceRegistryRef ref{registry};
12841285 ref.get <AsyncQueue>();
@@ -1944,7 +1945,7 @@ void DataProcessingDevice::handleData(ServiceRegistryRef ref, InputChannelInfo&
19441945 nPayloadsPerHeader = 1 ;
19451946 ii += (nMessages / 2 ) - 1 ;
19461947 }
1947- auto onDrop = [ref](TimesliceSlot slot, std::vector<MessageSet >& dropped, TimesliceIndex::OldestOutputInfo oldestOutputInfo) {
1948+ auto onDrop = [ref](TimesliceSlot slot, std::vector<std::vector<fair::mq::MessagePtr> >& dropped, TimesliceIndex::OldestOutputInfo oldestOutputInfo) {
19481949 O2_SIGNPOST_ID_GENERATE (cid, async_queue);
19491950 O2_SIGNPOST_EVENT_EMIT (async_queue, cid, " onDrop" , " Dropping message from slot %zu. Forwarding as needed. Timeslice %zu" ,
19501951 slot.index , oldestOutputInfo.timeslice .value );
@@ -2122,7 +2123,7 @@ bool DataProcessingDevice::tryDispatchComputation(ServiceRegistryRef ref, std::v
21222123 // want to support multithreaded dispatching of operations, I can simply
21232124 // move these to some thread local store and the rest of the lambdas
21242125 // should work just fine.
2125- std::vector<MessageSet > currentSetOfInputs;
2126+ std::vector<std::vector<fair::mq::MessagePtr> > currentSetOfInputs;
21262127
21272128 //
21282129 auto getInputSpan = [ref, ¤tSetOfInputs](TimesliceSlot slot, bool consume = true ) {
@@ -2133,7 +2134,7 @@ bool DataProcessingDevice::tryDispatchComputation(ServiceRegistryRef ref, std::v
21332134 currentSetOfInputs = relayer.consumeExistingInputsForTimeslice (slot);
21342135 }
21352136 auto getter = [¤tSetOfInputs](size_t i, size_t partindex) -> DataRef {
2136- if ((currentSetOfInputs[i]. messages | count_payloads{}) > partindex) {
2137+ if ((currentSetOfInputs[i] | count_payloads{}) > partindex) {
21372138 const char * headerptr = nullptr ;
21382139 const char * payloadptr = nullptr ;
21392140 size_t payloadSize = 0 ;
@@ -2142,9 +2143,9 @@ bool DataProcessingDevice::tryDispatchComputation(ServiceRegistryRef ref, std::v
21422143 // sequence is the header message
21432144 // - each part has one or more payload messages
21442145 // - InputRecord provides all payloads as header-payload pair
2145- auto const indices = currentSetOfInputs[i]. messages | get_pair{partindex};
2146- auto const & headerMsg = currentSetOfInputs[i]. messages [indices.headerIdx ];
2147- auto const & payloadMsg = currentSetOfInputs[i]. messages [indices.payloadIdx ];
2146+ auto const indices = currentSetOfInputs[i] | get_pair{partindex};
2147+ auto const & headerMsg = currentSetOfInputs[i][indices.headerIdx ];
2148+ auto const & payloadMsg = currentSetOfInputs[i][indices.payloadIdx ];
21482149 headerptr = static_cast <char const *>(headerMsg->GetData ());
21492150 payloadptr = payloadMsg ? static_cast <char const *>(payloadMsg->GetData ()) : nullptr ;
21502151 payloadSize = payloadMsg ? payloadMsg->GetSize () : 0 ;
@@ -2153,10 +2154,10 @@ bool DataProcessingDevice::tryDispatchComputation(ServiceRegistryRef ref, std::v
21532154 return DataRef{};
21542155 };
21552156 auto nofPartsGetter = [¤tSetOfInputs](size_t i) -> size_t {
2156- return (currentSetOfInputs[i]. messages | count_payloads{});
2157+ return (currentSetOfInputs[i] | count_payloads{});
21572158 };
21582159 auto refCountGetter = [¤tSetOfInputs](size_t idx) -> int {
2159- auto & header = static_cast <const fair::mq::shmem::Message&>(*(currentSetOfInputs[idx]. messages | get_header{0 }));
2160+ auto & header = static_cast <const fair::mq::shmem::Message&>(*(currentSetOfInputs[idx] | get_header{0 }));
21602161 return header.GetRefCount ();
21612162 };
21622163 return InputSpan{getter, nofPartsGetter, refCountGetter, currentSetOfInputs.size ()};
@@ -2215,7 +2216,7 @@ bool DataProcessingDevice::tryDispatchComputation(ServiceRegistryRef ref, std::v
22152216 continue ;
22162217 }
22172218 // This will hopefully delete the message.
2218- currentSetOfInputs[ii].messages . clear ();
2219+ currentSetOfInputs[ii].clear ();
22192220 }
22202221 };
22212222
0 commit comments