@rotorsoft/act 1.25.3 → 1.26.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -657,6 +657,8 @@ var InMemoryStore = class {
657
657
  _next_id = 0;
658
658
  // stored stream positions and other metadata
659
659
  _streams = /* @__PURE__ */ new Map();
660
+ /** Correlate checkpoint (#1484): how far the log has been READ. */
661
+ _correlated_at = -1;
660
662
  // last committed version per stream — O(1) replacement for filter-on-commit
661
663
  _stream_versions = /* @__PURE__ */ new Map();
662
664
  // max non-snapshot event id per stream — drives the has-work probe in
@@ -674,6 +676,7 @@ var InMemoryStore = class {
674
676
  _reset_indexes() {
675
677
  this._events.length = 0;
676
678
  this._next_id = 0;
679
+ this._correlated_at = -1;
677
680
  this._stream_versions.clear();
678
681
  this._max_event_id_by_stream.clear();
679
682
  this._max_non_snap_event_id = -1;
@@ -905,7 +908,9 @@ var InMemoryStore = class {
905
908
  * @param streams - Streams to register with optional source + priority.
906
909
  * @returns subscribed count and current max watermark.
907
910
  */
908
- async subscribe(streams) {
911
+ async subscribe(streams, correlated_at) {
912
+ if (correlated_at !== void 0 && correlated_at > this._correlated_at)
913
+ this._correlated_at = correlated_at;
909
914
  await sleep();
910
915
  let subscribed = 0;
911
916
  for (const {
@@ -930,7 +935,7 @@ var InMemoryStore = class {
930
935
  for (const s of this._streams.values()) {
931
936
  if (s.at > watermark) watermark = s.at;
932
937
  }
933
- return { subscribed, watermark };
938
+ return { subscribed, watermark, correlated_at: this._correlated_at };
934
939
  }
935
940
  /**
936
941
  * Acknowledge completion of processing for leased streams.