@luvio/environments 0.125.0 → 0.126.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, InMemoryStore, buildStaleWhileRevalidateImplementation, Reader } from '@luvio/engine';
1
+ import { 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';
@@ -371,12 +371,7 @@ async function reviveTTLOverrides(ttlStore, environment) {
371
371
  * the TTLOverrides from the given Environment's Store.
372
372
  */
373
373
  function buildIngestStagingStore(environment) {
374
- const store = new InMemoryStore();
375
- // need to make sure any TTL overrides are brought over from real L1
376
- // because publishStoreMetadata uses those overrides
377
- store.ttlOverrides = environment.storeGetTTLOverrides();
378
- store.defaultTTLOverride = environment.storeGetDefaultTTLOverride();
379
- return store;
374
+ return environment.storeBuildIngestionStagingStore();
380
375
  }
381
376
 
382
377
  const AdapterContextSegment = 'ADAPTER-CONTEXT';
@@ -654,11 +649,14 @@ function makeDurable(environment, { durableStore, instrumentation }) {
654
649
  };
655
650
  const storeRedirect = function (existingKey, canonicalKey) {
656
651
  validateNotDisposed();
657
- environment.storeRedirect(existingKey, canonicalKey);
658
- // since redirects don't cause a change to pending writer (thus a base rebuild) we force a broadcast here
659
- // TODO: W-9379772 luvio (and pending writer) should be updated to manage the durable segment where redirects are stored so we don't
660
- // have to force this broadcast in the durable environment only
661
- environment.storeBroadcast(rebuildSnapshot, environment.snapshotAvailable);
652
+ // call redirect on staging store so "old" keys are removed from L2 on
653
+ // the next publishChangesToDurableStore. NOTE: we don't need to call
654
+ // redirect on the base environment store because staging store and base
655
+ // L1 store share the same redirect and reverseRedirectKeys
656
+ if (ingestStagingStore === null) {
657
+ ingestStagingStore = buildIngestStagingStore(environment);
658
+ }
659
+ ingestStagingStore.redirect(existingKey, canonicalKey);
662
660
  };
663
661
  const storeSetTTLOverride = function (namespace, representationName, ttl) {
664
662
  validateNotDisposed();
@@ -1,5 +1,4 @@
1
- import { InMemoryStore } from '@luvio/engine';
2
- import type { Environment } from '@luvio/engine';
1
+ import type { Environment, InMemoryStore } from '@luvio/engine';
3
2
  /**
4
3
  * Returns an empty InMemoryStore that can be used for ingestion. Copies over
5
4
  * the TTLOverrides from the given Environment's Store.
@@ -375,12 +375,7 @@
375
375
  * the TTLOverrides from the given Environment's Store.
376
376
  */
377
377
  function buildIngestStagingStore(environment) {
378
- const store = new engine.InMemoryStore();
379
- // need to make sure any TTL overrides are brought over from real L1
380
- // because publishStoreMetadata uses those overrides
381
- store.ttlOverrides = environment.storeGetTTLOverrides();
382
- store.defaultTTLOverride = environment.storeGetDefaultTTLOverride();
383
- return store;
378
+ return environment.storeBuildIngestionStagingStore();
384
379
  }
385
380
 
386
381
  const AdapterContextSegment = 'ADAPTER-CONTEXT';
@@ -658,11 +653,14 @@
658
653
  };
659
654
  const storeRedirect = function (existingKey, canonicalKey) {
660
655
  validateNotDisposed();
661
- environment.storeRedirect(existingKey, canonicalKey);
662
- // since redirects don't cause a change to pending writer (thus a base rebuild) we force a broadcast here
663
- // TODO: W-9379772 luvio (and pending writer) should be updated to manage the durable segment where redirects are stored so we don't
664
- // have to force this broadcast in the durable environment only
665
- environment.storeBroadcast(rebuildSnapshot, environment.snapshotAvailable);
656
+ // call redirect on staging store so "old" keys are removed from L2 on
657
+ // the next publishChangesToDurableStore. NOTE: we don't need to call
658
+ // redirect on the base environment store because staging store and base
659
+ // L1 store share the same redirect and reverseRedirectKeys
660
+ if (ingestStagingStore === null) {
661
+ ingestStagingStore = buildIngestStagingStore(environment);
662
+ }
663
+ ingestStagingStore.redirect(existingKey, canonicalKey);
666
664
  };
667
665
  const storeSetTTLOverride = function (namespace, representationName, ttl) {
668
666
  validateNotDisposed();
@@ -1,5 +1,4 @@
1
- import { InMemoryStore } from '@luvio/engine';
2
- import type { Environment } from '@luvio/engine';
1
+ import type { Environment, InMemoryStore } from '@luvio/engine';
3
2
  /**
4
3
  * Returns an empty InMemoryStore that can be used for ingestion. Copies over
5
4
  * the TTLOverrides from the given Environment's Store.
@@ -463,12 +463,7 @@
463
463
  * the TTLOverrides from the given Environment's Store.
464
464
  */
465
465
  function buildIngestStagingStore(environment) {
466
- var store = new engine.InMemoryStore();
467
- // need to make sure any TTL overrides are brought over from real L1
468
- // because publishStoreMetadata uses those overrides
469
- store.ttlOverrides = environment.storeGetTTLOverrides();
470
- store.defaultTTLOverride = environment.storeGetDefaultTTLOverride();
471
- return store;
466
+ return environment.storeBuildIngestionStagingStore();
472
467
  }
473
468
 
474
469
  var AdapterContextSegment = 'ADAPTER-CONTEXT';
@@ -760,11 +755,14 @@
760
755
  };
761
756
  var storeRedirect = function (existingKey, canonicalKey) {
762
757
  validateNotDisposed();
763
- environment.storeRedirect(existingKey, canonicalKey);
764
- // since redirects don't cause a change to pending writer (thus a base rebuild) we force a broadcast here
765
- // TODO: W-9379772 luvio (and pending writer) should be updated to manage the durable segment where redirects are stored so we don't
766
- // have to force this broadcast in the durable environment only
767
- environment.storeBroadcast(rebuildSnapshot, environment.snapshotAvailable);
758
+ // call redirect on staging store so "old" keys are removed from L2 on
759
+ // the next publishChangesToDurableStore. NOTE: we don't need to call
760
+ // redirect on the base environment store because staging store and base
761
+ // L1 store share the same redirect and reverseRedirectKeys
762
+ if (ingestStagingStore === null) {
763
+ ingestStagingStore = buildIngestStagingStore(environment);
764
+ }
765
+ ingestStagingStore.redirect(existingKey, canonicalKey);
768
766
  };
769
767
  var storeSetTTLOverride = function (namespace, representationName, ttl) {
770
768
  validateNotDisposed();
@@ -1,5 +1,4 @@
1
- import { InMemoryStore } from '@luvio/engine';
2
- import type { Environment } from '@luvio/engine';
1
+ import type { Environment, InMemoryStore } from '@luvio/engine';
3
2
  /**
4
3
  * Returns an empty InMemoryStore that can be used for ingestion. Copies over
5
4
  * the TTLOverrides from the given Environment's Store.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@luvio/environments",
3
- "version": "0.125.0",
3
+ "version": "0.126.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.125.0"
26
+ "@luvio/engine": "0.126.1"
27
27
  },
28
28
  "bundlesize": [
29
29
  {
@@ -40,6 +40,5 @@
40
40
  ]
41
41
  }
42
42
  }
43
- },
44
- "gitHead": "fdb2143e317fab9db394b7a60a9c5869507b0bbd"
43
+ }
45
44
  }