@luvio/environments 0.138.8 → 0.138.10
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.
- package/dist/es/es2018/environments.js +6 -18
- package/dist/es/es2018/types/makeDurable/revive.d.ts +1 -1
- package/dist/umd/es2018/environments.js +5 -17
- package/dist/umd/es2018/types/makeDurable/revive.d.ts +1 -1
- package/dist/umd/es5/environments.js +5 -27
- package/dist/umd/es5/types/makeDurable/revive.d.ts +1 -1
- package/package.json +2 -2
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { StoreKeySet, serializeStructuredKey, emitAdapterEvent,
|
|
1
|
+
import { StoreKeySet, serializeStructuredKey, emitAdapterEvent, 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';
|
|
@@ -80,7 +80,7 @@ function isStoreEntryError(storeRecord) {
|
|
|
80
80
|
* @param pendingWriter the PendingWriter (this is going away soon)
|
|
81
81
|
* @returns
|
|
82
82
|
*/
|
|
83
|
-
function publishDurableStoreEntries(durableRecords,
|
|
83
|
+
function publishDurableStoreEntries(durableRecords, put, publishMetadata) {
|
|
84
84
|
const revivedKeys = new StoreKeySet();
|
|
85
85
|
let hadUnexpectedShape = false;
|
|
86
86
|
if (durableRecords === undefined) {
|
|
@@ -118,7 +118,7 @@ function publishDurableStoreEntries(durableRecords, publish, publishMetadata) {
|
|
|
118
118
|
// freeze errors on way into L1
|
|
119
119
|
deepFreeze(data.error);
|
|
120
120
|
}
|
|
121
|
-
|
|
121
|
+
put(key, data);
|
|
122
122
|
revivedKeys.add(key);
|
|
123
123
|
}
|
|
124
124
|
return { revivedKeys, hadUnexpectedShape };
|
|
@@ -158,7 +158,7 @@ unavailableSnapshot, durableStoreErrorHandler, buildL1Snapshot, reviveMetrics =
|
|
|
158
158
|
// TODO [W-10072584]: instead of implicitly using L1 we should take in
|
|
159
159
|
// publish and publishMetadata funcs, so callers can decide where to
|
|
160
160
|
// revive to (like they pass in how to do the buildL1Snapshot)
|
|
161
|
-
baseEnvironment.
|
|
161
|
+
baseEnvironment.storePut.bind(baseEnvironment), baseEnvironment.publishStoreMetadata.bind(baseEnvironment));
|
|
162
162
|
// if the data coming back from DS had an unexpected shape then just
|
|
163
163
|
// return the L1 snapshot
|
|
164
164
|
if (hadUnexpectedShape === true) {
|
|
@@ -281,16 +281,6 @@ class DurableTTLStore {
|
|
|
281
281
|
}
|
|
282
282
|
}
|
|
283
283
|
|
|
284
|
-
function copy(source) {
|
|
285
|
-
if (typeof source !== 'object' || source === null) {
|
|
286
|
-
return source;
|
|
287
|
-
}
|
|
288
|
-
if (isArray(source)) {
|
|
289
|
-
// TS doesn't trust that this new array is an array unless we cast it
|
|
290
|
-
return [...source];
|
|
291
|
-
}
|
|
292
|
-
return { ...source };
|
|
293
|
-
}
|
|
294
284
|
function flushInMemoryStoreValuesToDurableStore(store, durableStore, durableStoreErrorHandler) {
|
|
295
285
|
const durableRecords = create(null);
|
|
296
286
|
const evictedRecords = create(null);
|
|
@@ -309,9 +299,7 @@ function flushInMemoryStoreValuesToDurableStore(store, durableStore, durableStor
|
|
|
309
299
|
}
|
|
310
300
|
const metadata = storeMetadata[key];
|
|
311
301
|
durableRecords[key] = {
|
|
312
|
-
|
|
313
|
-
// async setEntries call
|
|
314
|
-
data: copy(record),
|
|
302
|
+
data: record,
|
|
315
303
|
};
|
|
316
304
|
if (metadata !== undefined) {
|
|
317
305
|
durableRecords[key].metadata = {
|
|
@@ -435,7 +423,7 @@ function isUnfulfilledSnapshot(cachedSnapshotResult) {
|
|
|
435
423
|
function makeDurable(environment, { durableStore, instrumentation }) {
|
|
436
424
|
let ingestStagingStore = null;
|
|
437
425
|
const durableTTLStore = new DurableTTLStore(durableStore);
|
|
438
|
-
const mergeKeysPromiseMap = new
|
|
426
|
+
const mergeKeysPromiseMap = new Map();
|
|
439
427
|
// When a context store is mutated we write it to L2, which causes DS on change
|
|
440
428
|
// event. If this instance of makeDurable caused that L2 write we can ignore that
|
|
441
429
|
// on change event. This Set helps us do that.
|
|
@@ -17,7 +17,7 @@ type ReviveResponse = {
|
|
|
17
17
|
* @param pendingWriter the PendingWriter (this is going away soon)
|
|
18
18
|
* @returns
|
|
19
19
|
*/
|
|
20
|
-
export declare function publishDurableStoreEntries(durableRecords: DurableStoreEntries<unknown> | undefined,
|
|
20
|
+
export declare function publishDurableStoreEntries(durableRecords: DurableStoreEntries<unknown> | undefined, put: (key: string | NormalizedKeyMetadata, record: unknown) => void, publishMetadata: (key: string, metadata: StoreMetadata) => void): ReviveResponse;
|
|
21
21
|
interface ReviveMetrics {
|
|
22
22
|
l2Trips: {
|
|
23
23
|
keysRequestedCount: number;
|
|
@@ -84,7 +84,7 @@
|
|
|
84
84
|
* @param pendingWriter the PendingWriter (this is going away soon)
|
|
85
85
|
* @returns
|
|
86
86
|
*/
|
|
87
|
-
function publishDurableStoreEntries(durableRecords,
|
|
87
|
+
function publishDurableStoreEntries(durableRecords, put, publishMetadata) {
|
|
88
88
|
const revivedKeys = new engine.StoreKeySet();
|
|
89
89
|
let hadUnexpectedShape = false;
|
|
90
90
|
if (durableRecords === undefined) {
|
|
@@ -122,7 +122,7 @@
|
|
|
122
122
|
// freeze errors on way into L1
|
|
123
123
|
deepFreeze(data.error);
|
|
124
124
|
}
|
|
125
|
-
|
|
125
|
+
put(key, data);
|
|
126
126
|
revivedKeys.add(key);
|
|
127
127
|
}
|
|
128
128
|
return { revivedKeys, hadUnexpectedShape };
|
|
@@ -162,7 +162,7 @@
|
|
|
162
162
|
// TODO [W-10072584]: instead of implicitly using L1 we should take in
|
|
163
163
|
// publish and publishMetadata funcs, so callers can decide where to
|
|
164
164
|
// revive to (like they pass in how to do the buildL1Snapshot)
|
|
165
|
-
baseEnvironment.
|
|
165
|
+
baseEnvironment.storePut.bind(baseEnvironment), baseEnvironment.publishStoreMetadata.bind(baseEnvironment));
|
|
166
166
|
// if the data coming back from DS had an unexpected shape then just
|
|
167
167
|
// return the L1 snapshot
|
|
168
168
|
if (hadUnexpectedShape === true) {
|
|
@@ -285,16 +285,6 @@
|
|
|
285
285
|
}
|
|
286
286
|
}
|
|
287
287
|
|
|
288
|
-
function copy(source) {
|
|
289
|
-
if (typeof source !== 'object' || source === null) {
|
|
290
|
-
return source;
|
|
291
|
-
}
|
|
292
|
-
if (isArray(source)) {
|
|
293
|
-
// TS doesn't trust that this new array is an array unless we cast it
|
|
294
|
-
return [...source];
|
|
295
|
-
}
|
|
296
|
-
return { ...source };
|
|
297
|
-
}
|
|
298
288
|
function flushInMemoryStoreValuesToDurableStore(store, durableStore, durableStoreErrorHandler) {
|
|
299
289
|
const durableRecords = create(null);
|
|
300
290
|
const evictedRecords = create(null);
|
|
@@ -313,9 +303,7 @@
|
|
|
313
303
|
}
|
|
314
304
|
const metadata = storeMetadata[key];
|
|
315
305
|
durableRecords[key] = {
|
|
316
|
-
|
|
317
|
-
// async setEntries call
|
|
318
|
-
data: copy(record),
|
|
306
|
+
data: record,
|
|
319
307
|
};
|
|
320
308
|
if (metadata !== undefined) {
|
|
321
309
|
durableRecords[key].metadata = {
|
|
@@ -439,7 +427,7 @@
|
|
|
439
427
|
function makeDurable(environment, { durableStore, instrumentation }) {
|
|
440
428
|
let ingestStagingStore = null;
|
|
441
429
|
const durableTTLStore = new DurableTTLStore(durableStore);
|
|
442
|
-
const mergeKeysPromiseMap = new
|
|
430
|
+
const mergeKeysPromiseMap = new Map();
|
|
443
431
|
// When a context store is mutated we write it to L2, which causes DS on change
|
|
444
432
|
// event. If this instance of makeDurable caused that L2 write we can ignore that
|
|
445
433
|
// on change event. This Set helps us do that.
|
|
@@ -17,7 +17,7 @@ type ReviveResponse = {
|
|
|
17
17
|
* @param pendingWriter the PendingWriter (this is going away soon)
|
|
18
18
|
* @returns
|
|
19
19
|
*/
|
|
20
|
-
export declare function publishDurableStoreEntries(durableRecords: DurableStoreEntries<unknown> | undefined,
|
|
20
|
+
export declare function publishDurableStoreEntries(durableRecords: DurableStoreEntries<unknown> | undefined, put: (key: string | NormalizedKeyMetadata, record: unknown) => void, publishMetadata: (key: string, metadata: StoreMetadata) => void): ReviveResponse;
|
|
21
21
|
interface ReviveMetrics {
|
|
22
22
|
l2Trips: {
|
|
23
23
|
keysRequestedCount: number;
|
|
@@ -85,16 +85,6 @@
|
|
|
85
85
|
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
86
86
|
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
87
87
|
}
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
function __spreadArray(to, from, pack) {
|
|
91
|
-
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
92
|
-
if (ar || !(i in from)) {
|
|
93
|
-
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
94
|
-
ar[i] = from[i];
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
return to.concat(ar || Array.prototype.slice.call(from));
|
|
98
88
|
}
|
|
99
89
|
|
|
100
90
|
var keys = Object.keys, create = Object.create, freeze = Object.freeze;
|
|
@@ -159,7 +149,7 @@
|
|
|
159
149
|
* @param pendingWriter the PendingWriter (this is going away soon)
|
|
160
150
|
* @returns
|
|
161
151
|
*/
|
|
162
|
-
function publishDurableStoreEntries(durableRecords,
|
|
152
|
+
function publishDurableStoreEntries(durableRecords, put, publishMetadata) {
|
|
163
153
|
var revivedKeys = new engine.StoreKeySet();
|
|
164
154
|
var hadUnexpectedShape = false;
|
|
165
155
|
if (durableRecords === undefined) {
|
|
@@ -197,7 +187,7 @@
|
|
|
197
187
|
// freeze errors on way into L1
|
|
198
188
|
deepFreeze(data.error);
|
|
199
189
|
}
|
|
200
|
-
|
|
190
|
+
put(key, data);
|
|
201
191
|
revivedKeys.add(key);
|
|
202
192
|
}
|
|
203
193
|
return { revivedKeys: revivedKeys, hadUnexpectedShape: hadUnexpectedShape };
|
|
@@ -240,7 +230,7 @@
|
|
|
240
230
|
// TODO [W-10072584]: instead of implicitly using L1 we should take in
|
|
241
231
|
// publish and publishMetadata funcs, so callers can decide where to
|
|
242
232
|
// revive to (like they pass in how to do the buildL1Snapshot)
|
|
243
|
-
baseEnvironment.
|
|
233
|
+
baseEnvironment.storePut.bind(baseEnvironment), baseEnvironment.publishStoreMetadata.bind(baseEnvironment)), revivedKeys = _a.revivedKeys, hadUnexpectedShape = _a.hadUnexpectedShape;
|
|
244
234
|
// if the data coming back from DS had an unexpected shape then just
|
|
245
235
|
// return the L1 snapshot
|
|
246
236
|
if (hadUnexpectedShape === true) {
|
|
@@ -366,16 +356,6 @@
|
|
|
366
356
|
return DurableTTLStore;
|
|
367
357
|
}());
|
|
368
358
|
|
|
369
|
-
function copy(source) {
|
|
370
|
-
if (typeof source !== 'object' || source === null) {
|
|
371
|
-
return source;
|
|
372
|
-
}
|
|
373
|
-
if (isArray(source)) {
|
|
374
|
-
// TS doesn't trust that this new array is an array unless we cast it
|
|
375
|
-
return __spreadArray([], source, true);
|
|
376
|
-
}
|
|
377
|
-
return __assign({}, source);
|
|
378
|
-
}
|
|
379
359
|
function flushInMemoryStoreValuesToDurableStore(store, durableStore, durableStoreErrorHandler) {
|
|
380
360
|
var durableRecords = create(null);
|
|
381
361
|
var evictedRecords = create(null);
|
|
@@ -394,9 +374,7 @@
|
|
|
394
374
|
}
|
|
395
375
|
var metadata = storeMetadata[key];
|
|
396
376
|
durableRecords[key] = {
|
|
397
|
-
|
|
398
|
-
// async setEntries call
|
|
399
|
-
data: copy(record),
|
|
377
|
+
data: record,
|
|
400
378
|
};
|
|
401
379
|
if (metadata !== undefined) {
|
|
402
380
|
durableRecords[key].metadata = __assign(__assign({}, metadata), { metadataVersion: DURABLE_METADATA_VERSION });
|
|
@@ -543,7 +521,7 @@
|
|
|
543
521
|
var durableStore = _a.durableStore, instrumentation = _a.instrumentation;
|
|
544
522
|
var ingestStagingStore = null;
|
|
545
523
|
var durableTTLStore = new DurableTTLStore(durableStore);
|
|
546
|
-
var mergeKeysPromiseMap = new
|
|
524
|
+
var mergeKeysPromiseMap = new Map();
|
|
547
525
|
// When a context store is mutated we write it to L2, which causes DS on change
|
|
548
526
|
// event. If this instance of makeDurable caused that L2 write we can ignore that
|
|
549
527
|
// on change event. This Set helps us do that.
|
|
@@ -17,7 +17,7 @@ type ReviveResponse = {
|
|
|
17
17
|
* @param pendingWriter the PendingWriter (this is going away soon)
|
|
18
18
|
* @returns
|
|
19
19
|
*/
|
|
20
|
-
export declare function publishDurableStoreEntries(durableRecords: DurableStoreEntries<unknown> | undefined,
|
|
20
|
+
export declare function publishDurableStoreEntries(durableRecords: DurableStoreEntries<unknown> | undefined, put: (key: string | NormalizedKeyMetadata, record: unknown) => void, publishMetadata: (key: string, metadata: StoreMetadata) => void): ReviveResponse;
|
|
21
21
|
interface ReviveMetrics {
|
|
22
22
|
l2Trips: {
|
|
23
23
|
keysRequestedCount: number;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@luvio/environments",
|
|
3
|
-
"version": "0.138.
|
|
3
|
+
"version": "0.138.10",
|
|
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.138.
|
|
26
|
+
"@luvio/engine": "^0.138.10"
|
|
27
27
|
},
|
|
28
28
|
"volta": {
|
|
29
29
|
"extends": "../../../package.json"
|