| 85 | } |
| 86 | |
| 87 | Timestamp SessionManager::globalTimeReference() const { |
| 88 | // Zero (absolute display) when the toggle is off. When on, the earliest raw |
| 89 | // sample ever observed across ALL datasets, applied uniformly. Per-dataset |
| 90 | // mins are pinned so live retention cannot slide the display origin forward. |
| 91 | if (!use_time_offset_) { |
| 92 | return 0; |
| 93 | } |
| 94 | if (!global_min_cache_.has_value()) { |
| 95 | Timestamp global_min = std::numeric_limits<Timestamp>::max(); |
| 96 | bool found = false; |
| 97 | for (const DatasetId dataset_id : data_engine_.listDatasets()) { |
| 98 | // rememberDatasetMinTimestamp pins the earliest-ever min in a single scan |
| 99 | // (the current raw min only moves forward under retention, never below it). |
| 100 | const auto bounds = datasetRawBounds(dataset_id); |
| 101 | if (!bounds.has_value()) { |
| 102 | continue; |
| 103 | } |
| 104 | global_min = std::min(global_min, rememberDatasetMinTimestamp(dataset_id, bounds->first)); |
| 105 | found = true; |
| 106 | } |
| 107 | global_min_cache_ = found ? global_min : 0; |
| 108 | } |
| 109 | return *global_min_cache_; |
| 110 | } |
| 111 | |
| 112 | std::optional<std::pair<Timestamp, Timestamp>> SessionManager::datasetRawBounds(DatasetId dataset_id) const { |
| 113 | // The one scalar(DataEngine) + object(ObjectStore) time-bounds union. Shared by |