| 341 | } |
| 342 | |
| 343 | bool RemoveEntriesWithLesserTime(OnType ts) { |
| 344 | DEBUG_SYNC(node_, "memo ", index_, " remove: ts=", ts, DEBUG_MANIP(std::endl)); |
| 345 | bool updated = false; |
| 346 | // remove future entries with lesser time |
| 347 | for (auto fe = future_entries_.begin(); fe != future_entries_.end();) { |
| 348 | auto& queue = fe->second; |
| 349 | while (!queue.empty() && queue.front().time < ts) { |
| 350 | queue.pop(); |
| 351 | updated = true; // queue changed |
| 352 | } |
| 353 | // remove entry if its queue was just emptied |
| 354 | if (queue.empty()) { |
| 355 | fe = future_entries_.erase(fe); |
| 356 | } else { |
| 357 | ++fe; |
| 358 | } |
| 359 | } |
| 360 | // remove last-known entries with lesser time |
| 361 | for (auto e = entries_.begin(); e != entries_.end();) { |
| 362 | if (e->second.time < ts) { |
| 363 | // drop last-known entry and move next future entry, if exists, in its place |
| 364 | auto fe = future_entries_.find(e->first); |
| 365 | if (fe != future_entries_.end() && !fe->second.empty()) { |
| 366 | auto& queue = fe->second; |
| 367 | e->second.swap(queue.front()); |
| 368 | queue.pop(); |
| 369 | ++e; |
| 370 | } else { |
| 371 | e = entries_.erase(e); |
| 372 | } |
| 373 | updated = true; // entry changed |
| 374 | } else { |
| 375 | ++e; |
| 376 | } |
| 377 | } |
| 378 | // remove known lesser times |
| 379 | while (!times_.empty() && times_.front() < ts) { |
| 380 | times_.pop_front(); |
| 381 | } |
| 382 | // update current time |
| 383 | return UpdateTime(ts) || updated; |
| 384 | } |
| 385 | }; |
| 386 | |
| 387 | // a specialized higher-performance variation of Hashing64 logic from hash_join_node |
no test coverage detected