@luvio/environments 0.139.0 → 0.139.2

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.
@@ -129,10 +129,8 @@ function publishDurableStoreEntries(durableRecords, put, publishMetadata) {
129
129
  * will refresh the snapshot from network, and then run the results from network
130
130
  * through L2 ingestion, returning the subsequent revived snapshot.
131
131
  */
132
- function reviveSnapshot(baseEnvironment, durableStore,
133
- // TODO [W-10165787]: We should only allow Unfulfilled snapshot be passed in
134
- unavailableSnapshot, durableStoreErrorHandler, buildL1Snapshot, reviveMetrics = { l2Trips: [] }) {
135
- const { recordId, select, seenRecords, state } = unavailableSnapshot;
132
+ function reviveSnapshot(baseEnvironment, durableStore, unavailableSnapshot, durableStoreErrorHandler, buildL1Snapshot, reviveMetrics = { l2Trips: [] }) {
133
+ const { recordId, select, missingLinks, seenRecords, state } = unavailableSnapshot;
136
134
  // L2 can only revive Unfulfilled snapshots that have a selector since they have the
137
135
  // info needed to revive (like missingLinks) and rebuild. Otherwise return L1 snapshot.
138
136
  if (state !== 'Unfulfilled' || select === undefined) {
@@ -145,6 +143,7 @@ unavailableSnapshot, durableStoreErrorHandler, buildL1Snapshot, reviveMetrics =
145
143
  // we attempt to read all keys from L2 - so combine recordId with any seenRecords
146
144
  const keysToReviveSet = new StoreKeySet().add(recordId);
147
145
  keysToReviveSet.merge(seenRecords);
146
+ keysToReviveSet.merge(missingLinks);
148
147
  const keysToRevive = keysToReviveSet.keysAsArray();
149
148
  const canonicalKeys = keysToRevive.map((x) => serializeStructuredKey(baseEnvironment.storeGetCanonicalKey(x)));
150
149
  const start = Date.now();
@@ -178,10 +177,11 @@ unavailableSnapshot, durableStoreErrorHandler, buildL1Snapshot, reviveMetrics =
178
177
  if (snapshot.state === 'Unfulfilled') {
179
178
  // have to check if the new snapshot has any additional seenRecords
180
179
  // and revive again if so
181
- const { seenRecords: newSnapshotSeenRecords, recordId: newSnapshotRecordId } = snapshot;
180
+ const { seenRecords: newSnapshotSeenRecords, missingLinks: newSnapshotMissingLinks, recordId: newSnapshotRecordId, } = snapshot;
182
181
  const newKeysToReviveSet = new StoreKeySet();
183
182
  newKeysToReviveSet.add(newSnapshotRecordId);
184
183
  newKeysToReviveSet.merge(newSnapshotSeenRecords);
184
+ newKeysToReviveSet.merge(newSnapshotMissingLinks);
185
185
  const newKeys = newKeysToReviveSet.keysAsArray();
186
186
  // in case DS returned additional entries we combine the requested
187
187
  // and returned keys
@@ -1,4 +1,4 @@
1
- import type { Environment, Snapshot, UnAvailableSnapshot, StoreMetadata, NormalizedKeyMetadata } from '@luvio/engine';
1
+ import type { Environment, Snapshot, StoreMetadata, NormalizedKeyMetadata, UnfulfilledSnapshot } from '@luvio/engine';
2
2
  import type { DurableStore, DurableStoreEntries } from '../DurableStore';
3
3
  import type { DurableStoreRejectionHandler } from './error';
4
4
  import { StoreKeySet } from '@luvio/engine';
@@ -34,5 +34,5 @@ interface ReviveResult<D, V> {
34
34
  * will refresh the snapshot from network, and then run the results from network
35
35
  * through L2 ingestion, returning the subsequent revived snapshot.
36
36
  */
37
- export declare function reviveSnapshot<D, V = unknown>(baseEnvironment: Environment, durableStore: DurableStore, unavailableSnapshot: UnAvailableSnapshot<D, V>, durableStoreErrorHandler: DurableStoreRejectionHandler, buildL1Snapshot: () => Snapshot<D, V>, reviveMetrics?: ReviveMetrics): Promise<ReviveResult<D, V>>;
37
+ export declare function reviveSnapshot<D, V = unknown>(baseEnvironment: Environment, durableStore: DurableStore, unavailableSnapshot: UnfulfilledSnapshot<D, V>, durableStoreErrorHandler: DurableStoreRejectionHandler, buildL1Snapshot: () => Snapshot<D, V>, reviveMetrics?: ReviveMetrics): Promise<ReviveResult<D, V>>;
38
38
  export {};
@@ -133,10 +133,8 @@
133
133
  * will refresh the snapshot from network, and then run the results from network
134
134
  * through L2 ingestion, returning the subsequent revived snapshot.
135
135
  */
136
- function reviveSnapshot(baseEnvironment, durableStore,
137
- // TODO [W-10165787]: We should only allow Unfulfilled snapshot be passed in
138
- unavailableSnapshot, durableStoreErrorHandler, buildL1Snapshot, reviveMetrics = { l2Trips: [] }) {
139
- const { recordId, select, seenRecords, state } = unavailableSnapshot;
136
+ function reviveSnapshot(baseEnvironment, durableStore, unavailableSnapshot, durableStoreErrorHandler, buildL1Snapshot, reviveMetrics = { l2Trips: [] }) {
137
+ const { recordId, select, missingLinks, seenRecords, state } = unavailableSnapshot;
140
138
  // L2 can only revive Unfulfilled snapshots that have a selector since they have the
141
139
  // info needed to revive (like missingLinks) and rebuild. Otherwise return L1 snapshot.
142
140
  if (state !== 'Unfulfilled' || select === undefined) {
@@ -149,6 +147,7 @@
149
147
  // we attempt to read all keys from L2 - so combine recordId with any seenRecords
150
148
  const keysToReviveSet = new engine.StoreKeySet().add(recordId);
151
149
  keysToReviveSet.merge(seenRecords);
150
+ keysToReviveSet.merge(missingLinks);
152
151
  const keysToRevive = keysToReviveSet.keysAsArray();
153
152
  const canonicalKeys = keysToRevive.map((x) => engine.serializeStructuredKey(baseEnvironment.storeGetCanonicalKey(x)));
154
153
  const start = Date.now();
@@ -182,10 +181,11 @@
182
181
  if (snapshot.state === 'Unfulfilled') {
183
182
  // have to check if the new snapshot has any additional seenRecords
184
183
  // and revive again if so
185
- const { seenRecords: newSnapshotSeenRecords, recordId: newSnapshotRecordId } = snapshot;
184
+ const { seenRecords: newSnapshotSeenRecords, missingLinks: newSnapshotMissingLinks, recordId: newSnapshotRecordId, } = snapshot;
186
185
  const newKeysToReviveSet = new engine.StoreKeySet();
187
186
  newKeysToReviveSet.add(newSnapshotRecordId);
188
187
  newKeysToReviveSet.merge(newSnapshotSeenRecords);
188
+ newKeysToReviveSet.merge(newSnapshotMissingLinks);
189
189
  const newKeys = newKeysToReviveSet.keysAsArray();
190
190
  // in case DS returned additional entries we combine the requested
191
191
  // and returned keys
@@ -1,4 +1,4 @@
1
- import type { Environment, Snapshot, UnAvailableSnapshot, StoreMetadata, NormalizedKeyMetadata } from '@luvio/engine';
1
+ import type { Environment, Snapshot, StoreMetadata, NormalizedKeyMetadata, UnfulfilledSnapshot } from '@luvio/engine';
2
2
  import type { DurableStore, DurableStoreEntries } from '../DurableStore';
3
3
  import type { DurableStoreRejectionHandler } from './error';
4
4
  import { StoreKeySet } from '@luvio/engine';
@@ -34,5 +34,5 @@ interface ReviveResult<D, V> {
34
34
  * will refresh the snapshot from network, and then run the results from network
35
35
  * through L2 ingestion, returning the subsequent revived snapshot.
36
36
  */
37
- export declare function reviveSnapshot<D, V = unknown>(baseEnvironment: Environment, durableStore: DurableStore, unavailableSnapshot: UnAvailableSnapshot<D, V>, durableStoreErrorHandler: DurableStoreRejectionHandler, buildL1Snapshot: () => Snapshot<D, V>, reviveMetrics?: ReviveMetrics): Promise<ReviveResult<D, V>>;
37
+ export declare function reviveSnapshot<D, V = unknown>(baseEnvironment: Environment, durableStore: DurableStore, unavailableSnapshot: UnfulfilledSnapshot<D, V>, durableStoreErrorHandler: DurableStoreRejectionHandler, buildL1Snapshot: () => Snapshot<D, V>, reviveMetrics?: ReviveMetrics): Promise<ReviveResult<D, V>>;
38
38
  export {};
@@ -198,11 +198,9 @@
198
198
  * will refresh the snapshot from network, and then run the results from network
199
199
  * through L2 ingestion, returning the subsequent revived snapshot.
200
200
  */
201
- function reviveSnapshot(baseEnvironment, durableStore,
202
- // TODO [W-10165787]: We should only allow Unfulfilled snapshot be passed in
203
- unavailableSnapshot, durableStoreErrorHandler, buildL1Snapshot, reviveMetrics) {
201
+ function reviveSnapshot(baseEnvironment, durableStore, unavailableSnapshot, durableStoreErrorHandler, buildL1Snapshot, reviveMetrics) {
204
202
  if (reviveMetrics === void 0) { reviveMetrics = { l2Trips: [] }; }
205
- var recordId = unavailableSnapshot.recordId, select = unavailableSnapshot.select, seenRecords = unavailableSnapshot.seenRecords, state = unavailableSnapshot.state;
203
+ var recordId = unavailableSnapshot.recordId, select = unavailableSnapshot.select, missingLinks = unavailableSnapshot.missingLinks, seenRecords = unavailableSnapshot.seenRecords, state = unavailableSnapshot.state;
206
204
  // L2 can only revive Unfulfilled snapshots that have a selector since they have the
207
205
  // info needed to revive (like missingLinks) and rebuild. Otherwise return L1 snapshot.
208
206
  if (state !== 'Unfulfilled' || select === undefined) {
@@ -215,6 +213,7 @@
215
213
  // we attempt to read all keys from L2 - so combine recordId with any seenRecords
216
214
  var keysToReviveSet = new engine.StoreKeySet().add(recordId);
217
215
  keysToReviveSet.merge(seenRecords);
216
+ keysToReviveSet.merge(missingLinks);
218
217
  var keysToRevive = keysToReviveSet.keysAsArray();
219
218
  var canonicalKeys = keysToRevive.map(function (x) {
220
219
  return engine.serializeStructuredKey(baseEnvironment.storeGetCanonicalKey(x));
@@ -250,10 +249,11 @@
250
249
  if (snapshot.state === 'Unfulfilled') {
251
250
  // have to check if the new snapshot has any additional seenRecords
252
251
  // and revive again if so
253
- var newSnapshotSeenRecords = snapshot.seenRecords, newSnapshotRecordId = snapshot.recordId;
252
+ var newSnapshotSeenRecords = snapshot.seenRecords, newSnapshotMissingLinks = snapshot.missingLinks, newSnapshotRecordId = snapshot.recordId;
254
253
  var newKeysToReviveSet = new engine.StoreKeySet();
255
254
  newKeysToReviveSet.add(newSnapshotRecordId);
256
255
  newKeysToReviveSet.merge(newSnapshotSeenRecords);
256
+ newKeysToReviveSet.merge(newSnapshotMissingLinks);
257
257
  var newKeys = newKeysToReviveSet.keysAsArray();
258
258
  // in case DS returned additional entries we combine the requested
259
259
  // and returned keys
@@ -1,4 +1,4 @@
1
- import type { Environment, Snapshot, UnAvailableSnapshot, StoreMetadata, NormalizedKeyMetadata } from '@luvio/engine';
1
+ import type { Environment, Snapshot, StoreMetadata, NormalizedKeyMetadata, UnfulfilledSnapshot } from '@luvio/engine';
2
2
  import type { DurableStore, DurableStoreEntries } from '../DurableStore';
3
3
  import type { DurableStoreRejectionHandler } from './error';
4
4
  import { StoreKeySet } from '@luvio/engine';
@@ -34,5 +34,5 @@ interface ReviveResult<D, V> {
34
34
  * will refresh the snapshot from network, and then run the results from network
35
35
  * through L2 ingestion, returning the subsequent revived snapshot.
36
36
  */
37
- export declare function reviveSnapshot<D, V = unknown>(baseEnvironment: Environment, durableStore: DurableStore, unavailableSnapshot: UnAvailableSnapshot<D, V>, durableStoreErrorHandler: DurableStoreRejectionHandler, buildL1Snapshot: () => Snapshot<D, V>, reviveMetrics?: ReviveMetrics): Promise<ReviveResult<D, V>>;
37
+ export declare function reviveSnapshot<D, V = unknown>(baseEnvironment: Environment, durableStore: DurableStore, unavailableSnapshot: UnfulfilledSnapshot<D, V>, durableStoreErrorHandler: DurableStoreRejectionHandler, buildL1Snapshot: () => Snapshot<D, V>, reviveMetrics?: ReviveMetrics): Promise<ReviveResult<D, V>>;
38
38
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@luvio/environments",
3
- "version": "0.139.0",
3
+ "version": "0.139.2",
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.139.0"
26
+ "@luvio/engine": "^0.139.2"
27
27
  },
28
28
  "volta": {
29
29
  "extends": "../../../package.json"