@luvio/environments 0.134.2 → 0.135.1

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.
@@ -1,4 +1,4 @@
1
- import { emitAdapterEvent, StoreKeyMap, buildStaleWhileRevalidateImplementation, Reader, StoreKeySet } from '@luvio/engine';
1
+ import { StoreKeySet, serializeStructuredKey, emitAdapterEvent, StoreKeyMap, buildStaleWhileRevalidateImplementation, Reader } from '@luvio/engine';
2
2
 
3
3
  // the last version the metadata shape was altered
4
4
  const DURABLE_METADATA_VERSION = '0.111.0';
@@ -81,7 +81,7 @@ function isStoreEntryError(storeRecord) {
81
81
  * @returns
82
82
  */
83
83
  function publishDurableStoreEntries(durableRecords, publish, publishMetadata) {
84
- const revivedKeys = create(null);
84
+ const revivedKeys = new StoreKeySet();
85
85
  let hadUnexpectedShape = false;
86
86
  if (durableRecords === undefined) {
87
87
  return { revivedKeys, hadUnexpectedShape };
@@ -119,7 +119,7 @@ function publishDurableStoreEntries(durableRecords, publish, publishMetadata) {
119
119
  deepFreeze(data.error);
120
120
  }
121
121
  publish(key, data);
122
- revivedKeys[key] = true;
122
+ revivedKeys.add(key);
123
123
  }
124
124
  return { revivedKeys, hadUnexpectedShape };
125
125
  }
@@ -143,9 +143,10 @@ unavailableSnapshot, durableStoreErrorHandler, buildL1Snapshot, reviveMetrics =
143
143
  }
144
144
  // in case L1 store changes/deallocs a record while we are doing the async read
145
145
  // we attempt to read all keys from L2 - so combine recordId with any seenRecords
146
- const keysToReviveSet = assign({ [recordId]: true }, seenRecords);
147
- const keysToRevive = keys(keysToReviveSet);
148
- const canonicalKeys = keysToRevive.map((x) => baseEnvironment.storeGetCanonicalKey(x));
146
+ const keysToReviveSet = new StoreKeySet().add(recordId);
147
+ keysToReviveSet.merge(seenRecords);
148
+ const keysToRevive = keysToReviveSet.keysAsArray();
149
+ const canonicalKeys = keysToRevive.map((x) => serializeStructuredKey(baseEnvironment.storeGetCanonicalKey(x)));
149
150
  const start = Date.now();
150
151
  const { l2Trips } = reviveMetrics;
151
152
  return durableStore.getEntries(canonicalKeys, DefaultDurableSegment).then((durableRecords) => {
@@ -163,7 +164,7 @@ unavailableSnapshot, durableStoreErrorHandler, buildL1Snapshot, reviveMetrics =
163
164
  if (hadUnexpectedShape === true) {
164
165
  return { snapshot: unavailableSnapshot, metrics: reviveMetrics };
165
166
  }
166
- if (keys(revivedKeys).length === 0) {
167
+ if (revivedKeys.size() === 0) {
167
168
  // durable store doesn't have what we asked for so return L1 snapshot
168
169
  return { snapshot: unavailableSnapshot, metrics: reviveMetrics };
169
170
  }
@@ -178,16 +179,19 @@ unavailableSnapshot, durableStoreErrorHandler, buildL1Snapshot, reviveMetrics =
178
179
  // have to check if the new snapshot has any additional seenRecords
179
180
  // and revive again if so
180
181
  const { seenRecords: newSnapshotSeenRecords, recordId: newSnapshotRecordId } = snapshot;
181
- const newKeysToReviveSet = assign({ [newSnapshotRecordId]: true }, newSnapshotSeenRecords);
182
- const newKeys = keys(newKeysToReviveSet);
182
+ const newKeysToReviveSet = new StoreKeySet();
183
+ newKeysToReviveSet.add(newSnapshotRecordId);
184
+ newKeysToReviveSet.merge(newSnapshotSeenRecords);
185
+ const newKeys = newKeysToReviveSet.keysAsArray();
183
186
  // in case DS returned additional entries we combine the requested
184
187
  // and returned keys
185
- const alreadyRequestedOrRevivedSet = assign(keysToReviveSet, revivedKeys);
188
+ const alreadyRequestedOrRevivedSet = keysToReviveSet;
189
+ alreadyRequestedOrRevivedSet.merge(revivedKeys);
186
190
  // if there's any seen keys in the newly rebuilt snapshot that
187
191
  // haven't already been requested or returned then revive again
188
192
  for (let i = 0, len = newKeys.length; i < len; i++) {
189
193
  const newSnapshotSeenKey = newKeys[i];
190
- if (alreadyRequestedOrRevivedSet[newSnapshotSeenKey] !== true) {
194
+ if (!alreadyRequestedOrRevivedSet.has(newSnapshotSeenKey)) {
191
195
  return reviveSnapshot(baseEnvironment, durableStore, snapshot, durableStoreErrorHandler, buildL1Snapshot, reviveMetrics);
192
196
  }
193
197
  }
@@ -737,7 +741,7 @@ function makeDurable(environment, { durableStore, instrumentation }) {
737
741
  const handleSuccessResponse = async function (ingestAndBroadcastFunc, getResponseCacheKeysFunc) {
738
742
  validateNotDisposed();
739
743
  const cacheKeyMap = getResponseCacheKeysFunc();
740
- const cacheKeyMapKeys = Array.from(cacheKeyMap.keys());
744
+ const cacheKeyMapKeys = cacheKeyMap.keysAsArray();
741
745
  const keysToRevive = new StoreKeySet();
742
746
  for (const cacheKeyMapKey of cacheKeyMapKeys) {
743
747
  const cacheKey = cacheKeyMap.get(cacheKeyMapKey);
@@ -746,7 +750,7 @@ function makeDurable(environment, { durableStore, instrumentation }) {
746
750
  }
747
751
  }
748
752
  let snapshotFromMemoryIngest = undefined;
749
- // Once these are structured keys, we will call the serializeStructuredKey() utility method
753
+ // To-do: Once these are structured keys, will need to support them throughout durable logic W-12356727
750
754
  const keysToReviveAsArray = Array.from(keysToRevive.keysAsStrings());
751
755
  if (keysToReviveAsArray.length > 0) {
752
756
  // if we need to do an L2 read then L2 write then we need to synchronize
@@ -770,7 +774,13 @@ function makeDurable(environment, { durableStore, instrumentation }) {
770
774
  const entries = await durableStore.getEntries(keysToReviveAsArray, DefaultDurableSegment);
771
775
  ingestStagingStore = buildIngestStagingStore(environment);
772
776
  publishDurableStoreEntries(entries, (key, record) => {
773
- ingestStagingStore.fallbackStringKeyInMemoryStore.records[key] = record;
777
+ if (typeof key === 'string') {
778
+ ingestStagingStore.fallbackStringKeyInMemoryStore.records[key] =
779
+ record;
780
+ }
781
+ else {
782
+ ingestStagingStore.recordsMap.set(key, record);
783
+ }
774
784
  },
775
785
  // we don't need to prime metadata
776
786
  () => { });
@@ -825,10 +835,15 @@ function makeDurable(environment, { durableStore, instrumentation }) {
825
835
  };
826
836
  const getNotifyChangeStoreEntries = function (keys) {
827
837
  validateNotDisposed();
828
- return durableStore.getEntries(keys, DefaultDurableSegment).then((durableRecords) => {
829
- const entries = {};
838
+ return durableStore
839
+ .getEntries(keys.map(serializeStructuredKey), DefaultDurableSegment)
840
+ .then((durableRecords) => {
841
+ const entries = [];
830
842
  publishDurableStoreEntries(durableRecords, (key, record) => {
831
- entries[key] = record;
843
+ entries.push({
844
+ key,
845
+ record: record,
846
+ });
832
847
  }, () => { });
833
848
  return entries;
834
849
  });
@@ -1,11 +1,9 @@
1
- import type { Environment, Snapshot, UnAvailableSnapshot, StoreMetadata } from '@luvio/engine';
1
+ import type { Environment, Snapshot, UnAvailableSnapshot, StoreMetadata, NormalizedKeyMetadata } from '@luvio/engine';
2
2
  import type { DurableStore, DurableStoreEntries } from '../DurableStore';
3
3
  import type { DurableStoreRejectionHandler } from './error';
4
- declare type ObjectAsSet = {
5
- [key: string]: true;
6
- };
4
+ import { StoreKeySet } from '@luvio/engine';
7
5
  declare type ReviveResponse = {
8
- revivedKeys: ObjectAsSet;
6
+ revivedKeys: StoreKeySet<string | NormalizedKeyMetadata>;
9
7
  hadUnexpectedShape: boolean;
10
8
  };
11
9
  /**
@@ -19,7 +17,7 @@ declare type ReviveResponse = {
19
17
  * @param pendingWriter the PendingWriter (this is going away soon)
20
18
  * @returns
21
19
  */
22
- export declare function publishDurableStoreEntries(durableRecords: DurableStoreEntries<unknown> | undefined, publish: (key: string, record: unknown) => void, publishMetadata: (key: string, metadata: StoreMetadata) => void): ReviveResponse;
20
+ export declare function publishDurableStoreEntries(durableRecords: DurableStoreEntries<unknown> | undefined, publish: (key: string | NormalizedKeyMetadata, record: unknown) => void, publishMetadata: (key: string, metadata: StoreMetadata) => void): ReviveResponse;
23
21
  interface ReviveMetrics {
24
22
  l2Trips: {
25
23
  keysRequestedCount: number;
@@ -85,7 +85,7 @@
85
85
  * @returns
86
86
  */
87
87
  function publishDurableStoreEntries(durableRecords, publish, publishMetadata) {
88
- const revivedKeys = create(null);
88
+ const revivedKeys = new engine.StoreKeySet();
89
89
  let hadUnexpectedShape = false;
90
90
  if (durableRecords === undefined) {
91
91
  return { revivedKeys, hadUnexpectedShape };
@@ -123,7 +123,7 @@
123
123
  deepFreeze(data.error);
124
124
  }
125
125
  publish(key, data);
126
- revivedKeys[key] = true;
126
+ revivedKeys.add(key);
127
127
  }
128
128
  return { revivedKeys, hadUnexpectedShape };
129
129
  }
@@ -147,9 +147,10 @@
147
147
  }
148
148
  // in case L1 store changes/deallocs a record while we are doing the async read
149
149
  // we attempt to read all keys from L2 - so combine recordId with any seenRecords
150
- const keysToReviveSet = assign({ [recordId]: true }, seenRecords);
151
- const keysToRevive = keys(keysToReviveSet);
152
- const canonicalKeys = keysToRevive.map((x) => baseEnvironment.storeGetCanonicalKey(x));
150
+ const keysToReviveSet = new engine.StoreKeySet().add(recordId);
151
+ keysToReviveSet.merge(seenRecords);
152
+ const keysToRevive = keysToReviveSet.keysAsArray();
153
+ const canonicalKeys = keysToRevive.map((x) => engine.serializeStructuredKey(baseEnvironment.storeGetCanonicalKey(x)));
153
154
  const start = Date.now();
154
155
  const { l2Trips } = reviveMetrics;
155
156
  return durableStore.getEntries(canonicalKeys, DefaultDurableSegment).then((durableRecords) => {
@@ -167,7 +168,7 @@
167
168
  if (hadUnexpectedShape === true) {
168
169
  return { snapshot: unavailableSnapshot, metrics: reviveMetrics };
169
170
  }
170
- if (keys(revivedKeys).length === 0) {
171
+ if (revivedKeys.size() === 0) {
171
172
  // durable store doesn't have what we asked for so return L1 snapshot
172
173
  return { snapshot: unavailableSnapshot, metrics: reviveMetrics };
173
174
  }
@@ -182,16 +183,19 @@
182
183
  // have to check if the new snapshot has any additional seenRecords
183
184
  // and revive again if so
184
185
  const { seenRecords: newSnapshotSeenRecords, recordId: newSnapshotRecordId } = snapshot;
185
- const newKeysToReviveSet = assign({ [newSnapshotRecordId]: true }, newSnapshotSeenRecords);
186
- const newKeys = keys(newKeysToReviveSet);
186
+ const newKeysToReviveSet = new engine.StoreKeySet();
187
+ newKeysToReviveSet.add(newSnapshotRecordId);
188
+ newKeysToReviveSet.merge(newSnapshotSeenRecords);
189
+ const newKeys = newKeysToReviveSet.keysAsArray();
187
190
  // in case DS returned additional entries we combine the requested
188
191
  // and returned keys
189
- const alreadyRequestedOrRevivedSet = assign(keysToReviveSet, revivedKeys);
192
+ const alreadyRequestedOrRevivedSet = keysToReviveSet;
193
+ alreadyRequestedOrRevivedSet.merge(revivedKeys);
190
194
  // if there's any seen keys in the newly rebuilt snapshot that
191
195
  // haven't already been requested or returned then revive again
192
196
  for (let i = 0, len = newKeys.length; i < len; i++) {
193
197
  const newSnapshotSeenKey = newKeys[i];
194
- if (alreadyRequestedOrRevivedSet[newSnapshotSeenKey] !== true) {
198
+ if (!alreadyRequestedOrRevivedSet.has(newSnapshotSeenKey)) {
195
199
  return reviveSnapshot(baseEnvironment, durableStore, snapshot, durableStoreErrorHandler, buildL1Snapshot, reviveMetrics);
196
200
  }
197
201
  }
@@ -741,7 +745,7 @@
741
745
  const handleSuccessResponse = async function (ingestAndBroadcastFunc, getResponseCacheKeysFunc) {
742
746
  validateNotDisposed();
743
747
  const cacheKeyMap = getResponseCacheKeysFunc();
744
- const cacheKeyMapKeys = Array.from(cacheKeyMap.keys());
748
+ const cacheKeyMapKeys = cacheKeyMap.keysAsArray();
745
749
  const keysToRevive = new engine.StoreKeySet();
746
750
  for (const cacheKeyMapKey of cacheKeyMapKeys) {
747
751
  const cacheKey = cacheKeyMap.get(cacheKeyMapKey);
@@ -750,7 +754,7 @@
750
754
  }
751
755
  }
752
756
  let snapshotFromMemoryIngest = undefined;
753
- // Once these are structured keys, we will call the serializeStructuredKey() utility method
757
+ // To-do: Once these are structured keys, will need to support them throughout durable logic W-12356727
754
758
  const keysToReviveAsArray = Array.from(keysToRevive.keysAsStrings());
755
759
  if (keysToReviveAsArray.length > 0) {
756
760
  // if we need to do an L2 read then L2 write then we need to synchronize
@@ -774,7 +778,13 @@
774
778
  const entries = await durableStore.getEntries(keysToReviveAsArray, DefaultDurableSegment);
775
779
  ingestStagingStore = buildIngestStagingStore(environment);
776
780
  publishDurableStoreEntries(entries, (key, record) => {
777
- ingestStagingStore.fallbackStringKeyInMemoryStore.records[key] = record;
781
+ if (typeof key === 'string') {
782
+ ingestStagingStore.fallbackStringKeyInMemoryStore.records[key] =
783
+ record;
784
+ }
785
+ else {
786
+ ingestStagingStore.recordsMap.set(key, record);
787
+ }
778
788
  },
779
789
  // we don't need to prime metadata
780
790
  () => { });
@@ -829,10 +839,15 @@
829
839
  };
830
840
  const getNotifyChangeStoreEntries = function (keys) {
831
841
  validateNotDisposed();
832
- return durableStore.getEntries(keys, DefaultDurableSegment).then((durableRecords) => {
833
- const entries = {};
842
+ return durableStore
843
+ .getEntries(keys.map(engine.serializeStructuredKey), DefaultDurableSegment)
844
+ .then((durableRecords) => {
845
+ const entries = [];
834
846
  publishDurableStoreEntries(durableRecords, (key, record) => {
835
- entries[key] = record;
847
+ entries.push({
848
+ key,
849
+ record: record,
850
+ });
836
851
  }, () => { });
837
852
  return entries;
838
853
  });
@@ -1,11 +1,9 @@
1
- import type { Environment, Snapshot, UnAvailableSnapshot, StoreMetadata } from '@luvio/engine';
1
+ import type { Environment, Snapshot, UnAvailableSnapshot, StoreMetadata, NormalizedKeyMetadata } from '@luvio/engine';
2
2
  import type { DurableStore, DurableStoreEntries } from '../DurableStore';
3
3
  import type { DurableStoreRejectionHandler } from './error';
4
- declare type ObjectAsSet = {
5
- [key: string]: true;
6
- };
4
+ import { StoreKeySet } from '@luvio/engine';
7
5
  declare type ReviveResponse = {
8
- revivedKeys: ObjectAsSet;
6
+ revivedKeys: StoreKeySet<string | NormalizedKeyMetadata>;
9
7
  hadUnexpectedShape: boolean;
10
8
  };
11
9
  /**
@@ -19,7 +17,7 @@ declare type ReviveResponse = {
19
17
  * @param pendingWriter the PendingWriter (this is going away soon)
20
18
  * @returns
21
19
  */
22
- export declare function publishDurableStoreEntries(durableRecords: DurableStoreEntries<unknown> | undefined, publish: (key: string, record: unknown) => void, publishMetadata: (key: string, metadata: StoreMetadata) => void): ReviveResponse;
20
+ export declare function publishDurableStoreEntries(durableRecords: DurableStoreEntries<unknown> | undefined, publish: (key: string | NormalizedKeyMetadata, record: unknown) => void, publishMetadata: (key: string, metadata: StoreMetadata) => void): ReviveResponse;
23
21
  interface ReviveMetrics {
24
22
  l2Trips: {
25
23
  keysRequestedCount: number;
@@ -97,7 +97,7 @@
97
97
  return to.concat(ar || Array.prototype.slice.call(from));
98
98
  }
99
99
 
100
- var keys = Object.keys, create = Object.create, assign = Object.assign, freeze = Object.freeze;
100
+ var keys = Object.keys, create = Object.create, freeze = Object.freeze;
101
101
  var isArray = Array.isArray;
102
102
 
103
103
  //Durable store error instrumentation key
@@ -160,7 +160,7 @@
160
160
  * @returns
161
161
  */
162
162
  function publishDurableStoreEntries(durableRecords, publish, publishMetadata) {
163
- var revivedKeys = create(null);
163
+ var revivedKeys = new engine.StoreKeySet();
164
164
  var hadUnexpectedShape = false;
165
165
  if (durableRecords === undefined) {
166
166
  return { revivedKeys: revivedKeys, hadUnexpectedShape: hadUnexpectedShape };
@@ -198,7 +198,7 @@
198
198
  deepFreeze(data.error);
199
199
  }
200
200
  publish(key, data);
201
- revivedKeys[key] = true;
201
+ revivedKeys.add(key);
202
202
  }
203
203
  return { revivedKeys: revivedKeys, hadUnexpectedShape: hadUnexpectedShape };
204
204
  }
@@ -211,7 +211,6 @@
211
211
  function reviveSnapshot(baseEnvironment, durableStore,
212
212
  // TODO [W-10165787]: We should only allow Unfulfilled snapshot be passed in
213
213
  unavailableSnapshot, durableStoreErrorHandler, buildL1Snapshot, reviveMetrics) {
214
- var _a;
215
214
  if (reviveMetrics === void 0) { reviveMetrics = { l2Trips: [] }; }
216
215
  var recordId = unavailableSnapshot.recordId, select = unavailableSnapshot.select, seenRecords = unavailableSnapshot.seenRecords, state = unavailableSnapshot.state;
217
216
  // L2 can only revive Unfulfilled snapshots that have a selector since they have the
@@ -224,28 +223,30 @@
224
223
  }
225
224
  // in case L1 store changes/deallocs a record while we are doing the async read
226
225
  // we attempt to read all keys from L2 - so combine recordId with any seenRecords
227
- var keysToReviveSet = assign((_a = {}, _a[recordId] = true, _a), seenRecords);
228
- var keysToRevive = keys(keysToReviveSet);
229
- var canonicalKeys = keysToRevive.map(function (x) { return baseEnvironment.storeGetCanonicalKey(x); });
226
+ var keysToReviveSet = new engine.StoreKeySet().add(recordId);
227
+ keysToReviveSet.merge(seenRecords);
228
+ var keysToRevive = keysToReviveSet.keysAsArray();
229
+ var canonicalKeys = keysToRevive.map(function (x) {
230
+ return engine.serializeStructuredKey(baseEnvironment.storeGetCanonicalKey(x));
231
+ });
230
232
  var start = Date.now();
231
233
  var l2Trips = reviveMetrics.l2Trips;
232
234
  return durableStore.getEntries(canonicalKeys, DefaultDurableSegment).then(function (durableRecords) {
233
- var _a;
234
235
  l2Trips.push({
235
236
  duration: Date.now() - start,
236
237
  keysRequestedCount: canonicalKeys.length,
237
238
  });
238
- var _b = publishDurableStoreEntries(durableRecords,
239
+ var _a = publishDurableStoreEntries(durableRecords,
239
240
  // TODO [W-10072584]: instead of implicitly using L1 we should take in
240
241
  // publish and publishMetadata funcs, so callers can decide where to
241
242
  // revive to (like they pass in how to do the buildL1Snapshot)
242
- baseEnvironment.storePublish.bind(baseEnvironment), baseEnvironment.publishStoreMetadata.bind(baseEnvironment)), revivedKeys = _b.revivedKeys, hadUnexpectedShape = _b.hadUnexpectedShape;
243
+ baseEnvironment.storePublish.bind(baseEnvironment), baseEnvironment.publishStoreMetadata.bind(baseEnvironment)), revivedKeys = _a.revivedKeys, hadUnexpectedShape = _a.hadUnexpectedShape;
243
244
  // if the data coming back from DS had an unexpected shape then just
244
245
  // return the L1 snapshot
245
246
  if (hadUnexpectedShape === true) {
246
247
  return { snapshot: unavailableSnapshot, metrics: reviveMetrics };
247
248
  }
248
- if (keys(revivedKeys).length === 0) {
249
+ if (revivedKeys.size() === 0) {
249
250
  // durable store doesn't have what we asked for so return L1 snapshot
250
251
  return { snapshot: unavailableSnapshot, metrics: reviveMetrics };
251
252
  }
@@ -260,16 +261,19 @@
260
261
  // have to check if the new snapshot has any additional seenRecords
261
262
  // and revive again if so
262
263
  var newSnapshotSeenRecords = snapshot.seenRecords, newSnapshotRecordId = snapshot.recordId;
263
- var newKeysToReviveSet = assign((_a = {}, _a[newSnapshotRecordId] = true, _a), newSnapshotSeenRecords);
264
- var newKeys = keys(newKeysToReviveSet);
264
+ var newKeysToReviveSet = new engine.StoreKeySet();
265
+ newKeysToReviveSet.add(newSnapshotRecordId);
266
+ newKeysToReviveSet.merge(newSnapshotSeenRecords);
267
+ var newKeys = newKeysToReviveSet.keysAsArray();
265
268
  // in case DS returned additional entries we combine the requested
266
269
  // and returned keys
267
- var alreadyRequestedOrRevivedSet = assign(keysToReviveSet, revivedKeys);
270
+ var alreadyRequestedOrRevivedSet = keysToReviveSet;
271
+ alreadyRequestedOrRevivedSet.merge(revivedKeys);
268
272
  // if there's any seen keys in the newly rebuilt snapshot that
269
273
  // haven't already been requested or returned then revive again
270
274
  for (var i = 0, len = newKeys.length; i < len; i++) {
271
275
  var newSnapshotSeenKey = newKeys[i];
272
- if (alreadyRequestedOrRevivedSet[newSnapshotSeenKey] !== true) {
276
+ if (!alreadyRequestedOrRevivedSet.has(newSnapshotSeenKey)) {
273
277
  return reviveSnapshot(baseEnvironment, durableStore, snapshot, durableStoreErrorHandler, buildL1Snapshot, reviveMetrics);
274
278
  }
275
279
  }
@@ -871,7 +875,7 @@
871
875
  case 0:
872
876
  validateNotDisposed();
873
877
  cacheKeyMap = getResponseCacheKeysFunc();
874
- cacheKeyMapKeys = Array.from(cacheKeyMap.keys());
878
+ cacheKeyMapKeys = cacheKeyMap.keysAsArray();
875
879
  keysToRevive = new engine.StoreKeySet();
876
880
  for (_i = 0, cacheKeyMapKeys_1 = cacheKeyMapKeys; _i < cacheKeyMapKeys_1.length; _i++) {
877
881
  cacheKeyMapKey = cacheKeyMapKeys_1[_i];
@@ -910,7 +914,13 @@
910
914
  entries = _a.sent();
911
915
  ingestStagingStore = buildIngestStagingStore(environment);
912
916
  publishDurableStoreEntries(entries, function (key, record) {
913
- ingestStagingStore.fallbackStringKeyInMemoryStore.records[key] = record;
917
+ if (typeof key === 'string') {
918
+ ingestStagingStore.fallbackStringKeyInMemoryStore.records[key] =
919
+ record;
920
+ }
921
+ else {
922
+ ingestStagingStore.recordsMap.set(key, record);
923
+ }
914
924
  },
915
925
  // we don't need to prime metadata
916
926
  function () { });
@@ -987,10 +997,15 @@
987
997
  };
988
998
  var getNotifyChangeStoreEntries = function (keys) {
989
999
  validateNotDisposed();
990
- return durableStore.getEntries(keys, DefaultDurableSegment).then(function (durableRecords) {
991
- var entries = {};
1000
+ return durableStore
1001
+ .getEntries(keys.map(engine.serializeStructuredKey), DefaultDurableSegment)
1002
+ .then(function (durableRecords) {
1003
+ var entries = [];
992
1004
  publishDurableStoreEntries(durableRecords, function (key, record) {
993
- entries[key] = record;
1005
+ entries.push({
1006
+ key: key,
1007
+ record: record,
1008
+ });
994
1009
  }, function () { });
995
1010
  return entries;
996
1011
  });
@@ -1,11 +1,9 @@
1
- import type { Environment, Snapshot, UnAvailableSnapshot, StoreMetadata } from '@luvio/engine';
1
+ import type { Environment, Snapshot, UnAvailableSnapshot, StoreMetadata, NormalizedKeyMetadata } from '@luvio/engine';
2
2
  import type { DurableStore, DurableStoreEntries } from '../DurableStore';
3
3
  import type { DurableStoreRejectionHandler } from './error';
4
- declare type ObjectAsSet = {
5
- [key: string]: true;
6
- };
4
+ import { StoreKeySet } from '@luvio/engine';
7
5
  declare type ReviveResponse = {
8
- revivedKeys: ObjectAsSet;
6
+ revivedKeys: StoreKeySet<string | NormalizedKeyMetadata>;
9
7
  hadUnexpectedShape: boolean;
10
8
  };
11
9
  /**
@@ -19,7 +17,7 @@ declare type ReviveResponse = {
19
17
  * @param pendingWriter the PendingWriter (this is going away soon)
20
18
  * @returns
21
19
  */
22
- export declare function publishDurableStoreEntries(durableRecords: DurableStoreEntries<unknown> | undefined, publish: (key: string, record: unknown) => void, publishMetadata: (key: string, metadata: StoreMetadata) => void): ReviveResponse;
20
+ export declare function publishDurableStoreEntries(durableRecords: DurableStoreEntries<unknown> | undefined, publish: (key: string | NormalizedKeyMetadata, record: unknown) => void, publishMetadata: (key: string, metadata: StoreMetadata) => void): ReviveResponse;
23
21
  interface ReviveMetrics {
24
22
  l2Trips: {
25
23
  keysRequestedCount: number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@luvio/environments",
3
- "version": "0.134.2",
3
+ "version": "0.135.1",
4
4
  "description": "Luvio Environments",
5
5
  "repository": {
6
6
  "type": "git",
@@ -23,7 +23,7 @@
23
23
  "watch": "yarn build --watch"
24
24
  },
25
25
  "dependencies": {
26
- "@luvio/engine": "^0.134.2"
26
+ "@luvio/engine": "^0.135.1"
27
27
  },
28
28
  "bundlesize": [
29
29
  {