@luvio/environments 0.138.0 → 0.138.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.
Files changed (43) hide show
  1. package/dist/es/es2018/environments.js +858 -852
  2. package/dist/es/es2018/{DurableStore.d.ts → types/DurableStore.d.ts} +134 -134
  3. package/dist/{umd/es5 → es/es2018/types}/DurableTTLStore.d.ts +25 -25
  4. package/dist/{umd/es5 → es/es2018/types}/events.d.ts +18 -18
  5. package/dist/{umd/es5 → es/es2018/types}/main.d.ts +5 -5
  6. package/dist/es/es2018/{makeDurable → types/makeDurable}/error.d.ts +11 -11
  7. package/dist/es/es2018/{makeDurable → types/makeDurable}/flush.d.ts +4 -4
  8. package/dist/{umd/es5 → es/es2018/types}/makeDurable/revive.d.ts +38 -38
  9. package/dist/es/es2018/{makeDurable → types/makeDurable}/stagingStore.d.ts +6 -6
  10. package/dist/es/es2018/{makeDurable → types/makeDurable}/ttl.d.ts +3 -3
  11. package/dist/es/es2018/{makeDurable → types/makeDurable}/utils.d.ts +2 -2
  12. package/dist/es/es2018/{makeDurable.d.ts → types/makeDurable.d.ts} +44 -44
  13. package/dist/es/es2018/{utils → types/utils}/deep-freeze.d.ts +1 -1
  14. package/dist/es/es2018/{utils → types/utils}/language.d.ts +19 -19
  15. package/dist/umd/es2018/environments.js +858 -852
  16. package/dist/umd/es2018/{DurableStore.d.ts → types/DurableStore.d.ts} +134 -134
  17. package/dist/{es/es2018 → umd/es2018/types}/DurableTTLStore.d.ts +25 -25
  18. package/dist/{es/es2018 → umd/es2018/types}/events.d.ts +18 -18
  19. package/dist/umd/es2018/{main.d.ts → types/main.d.ts} +5 -5
  20. package/dist/umd/{es5 → es2018/types}/makeDurable/error.d.ts +11 -11
  21. package/dist/umd/es2018/{makeDurable → types/makeDurable}/flush.d.ts +4 -4
  22. package/dist/{es/es2018 → umd/es2018/types}/makeDurable/revive.d.ts +38 -38
  23. package/dist/umd/{es5 → es2018/types}/makeDurable/stagingStore.d.ts +6 -6
  24. package/dist/umd/es2018/{makeDurable → types/makeDurable}/ttl.d.ts +3 -3
  25. package/dist/umd/es2018/{makeDurable → types/makeDurable}/utils.d.ts +2 -2
  26. package/dist/umd/{es5 → es2018/types}/makeDurable.d.ts +44 -44
  27. package/dist/umd/es2018/{utils → types/utils}/deep-freeze.d.ts +1 -1
  28. package/dist/umd/es2018/{utils → types/utils}/language.d.ts +19 -19
  29. package/dist/umd/es5/environments.js +942 -936
  30. package/dist/umd/es5/{DurableStore.d.ts → types/DurableStore.d.ts} +134 -134
  31. package/dist/umd/{es2018 → es5/types}/DurableTTLStore.d.ts +25 -25
  32. package/dist/umd/{es2018 → es5/types}/events.d.ts +18 -18
  33. package/dist/{es/es2018 → umd/es5/types}/main.d.ts +5 -5
  34. package/dist/umd/{es2018 → es5/types}/makeDurable/error.d.ts +11 -11
  35. package/dist/umd/es5/{makeDurable → types/makeDurable}/flush.d.ts +4 -4
  36. package/dist/umd/{es2018 → es5/types}/makeDurable/revive.d.ts +38 -38
  37. package/dist/umd/{es2018 → es5/types}/makeDurable/stagingStore.d.ts +6 -6
  38. package/dist/umd/es5/{makeDurable → types/makeDurable}/ttl.d.ts +3 -3
  39. package/dist/umd/es5/{makeDurable → types/makeDurable}/utils.d.ts +2 -2
  40. package/dist/umd/{es2018 → es5/types}/makeDurable.d.ts +44 -44
  41. package/dist/umd/es5/{utils → types/utils}/deep-freeze.d.ts +1 -1
  42. package/dist/umd/es5/{utils → types/utils}/language.d.ts +19 -19
  43. package/package.json +4 -4
@@ -1,134 +1,134 @@
1
- import type { StoreMetadata } from '@luvio/engine';
2
- export declare const DURABLE_METADATA_VERSION = "0.111.0";
3
- interface DurableStoreMetadata extends StoreMetadata {
4
- metadataVersion: string;
5
- }
6
- /**
7
- * Contains store entry data along with any metadata for that entry that needs
8
- * to be persisted to durable storage
9
- *
10
- * IMPORTANT: if you update this interface, you must also create a
11
- * deprecated interface, and check for durable store entries of this
12
- * type in isDeprecatedDurableStoreEntry so that revive discards
13
- * invalid entries.
14
- */
15
- export interface DurableStoreEntry<T = unknown> {
16
- data: T;
17
- metadata?: DurableStoreMetadata;
18
- }
19
- export declare function isDeprecatedDurableStoreEntry(durableRecord: unknown): boolean;
20
- export interface DeprecatedDurableStoreEntry1<T = unknown> {
21
- data: T;
22
- expiration?: {
23
- fresh: number;
24
- stale: number;
25
- };
26
- }
27
- export interface DurableStoreEntries<EntryTypes> {
28
- [key: string]: DurableStoreEntry<Extract<EntryTypes, unknown>>;
29
- }
30
- export declare type DurableStoreOperationType = 'setEntries' | 'evictEntries';
31
- export interface BaseOperation {
32
- type: DurableStoreOperationType;
33
- segment: string;
34
- }
35
- export interface DurableStoreSetOperation<T> extends BaseOperation {
36
- type: 'setEntries';
37
- entries: DurableStoreEntries<T>;
38
- }
39
- export interface DurableStoreEvictOperation extends BaseOperation {
40
- type: 'evictEntries';
41
- ids: string[];
42
- }
43
- export declare type DurableStoreOperation<T> = DurableStoreSetOperation<T> | DurableStoreEvictOperation;
44
- export declare type DefaultDurableSegmentName = 'DEFAULT';
45
- export declare const DefaultDurableSegment: DefaultDurableSegmentName;
46
- export interface DurableStoreChange {
47
- /** The entry IDs of the entries that have changed */
48
- ids: string[];
49
- /** The type of change for the entry IDs*/
50
- type: DurableStoreOperationType;
51
- /** The segment containing the changed entry IDs */
52
- segment: string;
53
- /**
54
- * Set to true if the durable store entries were changed by an external
55
- * source (eg: a background thread) or by an external environment (ie: an
56
- * environment that isn't the makeDurable environment). If you are unsure
57
- * leave this undefined.
58
- */
59
- isExternalChange?: boolean;
60
- }
61
- export declare type OnDurableStoreChangedListener = (changes: DurableStoreChange[]) => Promise<void>;
62
- /**
63
- * The DurableStore implementation must have the following behaviors:
64
- * - It must handle read/write synchronization (ie: reads should wait for any
65
- * pending writes to finish).
66
- * - It must raise DurableStoreChange events on the next tick following a call to
67
- * setEntries/evictEntries/batchOperations. Even if the implementation can write
68
- * synchronously the onChanged event cannot be on that same synchronous tick.
69
- *
70
- * @export
71
- * @interface DurableStore
72
- */
73
- export interface DurableStore {
74
- /**
75
- * Given a list of cache entryIds's this method asynchronously returns
76
- * DurableStoreEntries (ie: object map) of entryIds and their values.
77
- *
78
- * If the segment isn't found this will return undefined.
79
- *
80
- * If the segment is found this will return a map of results, even if not
81
- * all entries are present in the DS.
82
- *
83
- * Only the store segment specified is queried
84
- *
85
- * @param {string[]} entryIds
86
- * @param {string} segment The durable store segment to query
87
- * @returns {Promise<DurableStoreEntries | undefined>}
88
- */
89
- getEntries<T>(entryIds: string[], segment: string): Promise<DurableStoreEntries<T> | undefined>;
90
- /**
91
- * This method retrieves all entries in the given store segment.
92
- *
93
- * If the segment isn't found this will return undefined. If the segment is found
94
- * but there are no entries in that segment this will return an empty
95
- * DurableStoreEntries object.
96
- *
97
- * @param {string} segment The durable store segment to query
98
- * @returns {Promise<DurableStoreEntries | undefined>}
99
- */
100
- getAllEntries<T>(segment: string): Promise<DurableStoreEntries<T> | undefined>;
101
- /**
102
- * This method saves the given entries to durable store in the given store segment
103
- *
104
- * @param {DurableStoreEntries} entries A key/value map Object
105
- * @param {string} segment The durable store segment in which to set the entries
106
- * @returns {Promise<void>}
107
- */
108
- setEntries<T>(entries: DurableStoreEntries<T>, segment: string): Promise<void>;
109
- /**
110
- * This method sends a collection of mutation operations to the durable store.
111
- *
112
- * @param {DurableStoreOperation[]} operations The collection of durable store operations.
113
- * @returns {Promise<void>}
114
- */
115
- batchOperations<T>(operations: DurableStoreOperation<T>[]): Promise<void>;
116
- /**
117
- * This method deletes the given entries from the durable store in the given store segment
118
- *
119
- * @param {string} entryId
120
- * @param {string} segment The durable store segment from which to evict the given entries
121
- * @returns {Promise<void>}
122
- */
123
- evictEntries(entryIds: string[], segment: string): Promise<void>;
124
- /**
125
- * Register a listener for change events to durable store ids. Implementations
126
- * should call any registered listeners when setEntries or evictEntries is called.
127
- *
128
- * This should return a function that, when called, dereferences the passed in "listener" callback.
129
- * @param {OnDurableStoreChangedListener} listener The callback to invoke when durable store entries change.
130
- * @returns {() => Promise<void>} The function to unsubscribe from durable store changes
131
- */
132
- registerOnChangedListener(listener: OnDurableStoreChangedListener): () => Promise<void>;
133
- }
134
- export {};
1
+ import type { StoreMetadata } from '@luvio/engine';
2
+ export declare const DURABLE_METADATA_VERSION = "0.111.0";
3
+ interface DurableStoreMetadata extends StoreMetadata {
4
+ metadataVersion: string;
5
+ }
6
+ /**
7
+ * Contains store entry data along with any metadata for that entry that needs
8
+ * to be persisted to durable storage
9
+ *
10
+ * IMPORTANT: if you update this interface, you must also create a
11
+ * deprecated interface, and check for durable store entries of this
12
+ * type in isDeprecatedDurableStoreEntry so that revive discards
13
+ * invalid entries.
14
+ */
15
+ export interface DurableStoreEntry<T = unknown> {
16
+ data: T;
17
+ metadata?: DurableStoreMetadata;
18
+ }
19
+ export declare function isDeprecatedDurableStoreEntry(durableRecord: unknown): boolean;
20
+ export interface DeprecatedDurableStoreEntry1<T = unknown> {
21
+ data: T;
22
+ expiration?: {
23
+ fresh: number;
24
+ stale: number;
25
+ };
26
+ }
27
+ export interface DurableStoreEntries<EntryTypes> {
28
+ [key: string]: DurableStoreEntry<Extract<EntryTypes, unknown>>;
29
+ }
30
+ export declare type DurableStoreOperationType = 'setEntries' | 'evictEntries';
31
+ export interface BaseOperation {
32
+ type: DurableStoreOperationType;
33
+ segment: string;
34
+ }
35
+ export interface DurableStoreSetOperation<T> extends BaseOperation {
36
+ type: 'setEntries';
37
+ entries: DurableStoreEntries<T>;
38
+ }
39
+ export interface DurableStoreEvictOperation extends BaseOperation {
40
+ type: 'evictEntries';
41
+ ids: string[];
42
+ }
43
+ export declare type DurableStoreOperation<T> = DurableStoreSetOperation<T> | DurableStoreEvictOperation;
44
+ export declare type DefaultDurableSegmentName = 'DEFAULT';
45
+ export declare const DefaultDurableSegment: DefaultDurableSegmentName;
46
+ export interface DurableStoreChange {
47
+ /** The entry IDs of the entries that have changed */
48
+ ids: string[];
49
+ /** The type of change for the entry IDs*/
50
+ type: DurableStoreOperationType;
51
+ /** The segment containing the changed entry IDs */
52
+ segment: string;
53
+ /**
54
+ * Set to true if the durable store entries were changed by an external
55
+ * source (eg: a background thread) or by an external environment (ie: an
56
+ * environment that isn't the makeDurable environment). If you are unsure
57
+ * leave this undefined.
58
+ */
59
+ isExternalChange?: boolean;
60
+ }
61
+ export declare type OnDurableStoreChangedListener = (changes: DurableStoreChange[]) => Promise<void>;
62
+ /**
63
+ * The DurableStore implementation must have the following behaviors:
64
+ * - It must handle read/write synchronization (ie: reads should wait for any
65
+ * pending writes to finish).
66
+ * - It must raise DurableStoreChange events on the next tick following a call to
67
+ * setEntries/evictEntries/batchOperations. Even if the implementation can write
68
+ * synchronously the onChanged event cannot be on that same synchronous tick.
69
+ *
70
+ * @export
71
+ * @interface DurableStore
72
+ */
73
+ export interface DurableStore {
74
+ /**
75
+ * Given a list of cache entryIds's this method asynchronously returns
76
+ * DurableStoreEntries (ie: object map) of entryIds and their values.
77
+ *
78
+ * If the segment isn't found this will return undefined.
79
+ *
80
+ * If the segment is found this will return a map of results, even if not
81
+ * all entries are present in the DS.
82
+ *
83
+ * Only the store segment specified is queried
84
+ *
85
+ * @param {string[]} entryIds
86
+ * @param {string} segment The durable store segment to query
87
+ * @returns {Promise<DurableStoreEntries | undefined>}
88
+ */
89
+ getEntries<T>(entryIds: string[], segment: string): Promise<DurableStoreEntries<T> | undefined>;
90
+ /**
91
+ * This method retrieves all entries in the given store segment.
92
+ *
93
+ * If the segment isn't found this will return undefined. If the segment is found
94
+ * but there are no entries in that segment this will return an empty
95
+ * DurableStoreEntries object.
96
+ *
97
+ * @param {string} segment The durable store segment to query
98
+ * @returns {Promise<DurableStoreEntries | undefined>}
99
+ */
100
+ getAllEntries<T>(segment: string): Promise<DurableStoreEntries<T> | undefined>;
101
+ /**
102
+ * This method saves the given entries to durable store in the given store segment
103
+ *
104
+ * @param {DurableStoreEntries} entries A key/value map Object
105
+ * @param {string} segment The durable store segment in which to set the entries
106
+ * @returns {Promise<void>}
107
+ */
108
+ setEntries<T>(entries: DurableStoreEntries<T>, segment: string): Promise<void>;
109
+ /**
110
+ * This method sends a collection of mutation operations to the durable store.
111
+ *
112
+ * @param {DurableStoreOperation[]} operations The collection of durable store operations.
113
+ * @returns {Promise<void>}
114
+ */
115
+ batchOperations<T>(operations: DurableStoreOperation<T>[]): Promise<void>;
116
+ /**
117
+ * This method deletes the given entries from the durable store in the given store segment
118
+ *
119
+ * @param {string} entryId
120
+ * @param {string} segment The durable store segment from which to evict the given entries
121
+ * @returns {Promise<void>}
122
+ */
123
+ evictEntries(entryIds: string[], segment: string): Promise<void>;
124
+ /**
125
+ * Register a listener for change events to durable store ids. Implementations
126
+ * should call any registered listeners when setEntries or evictEntries is called.
127
+ *
128
+ * This should return a function that, when called, dereferences the passed in "listener" callback.
129
+ * @param {OnDurableStoreChangedListener} listener The callback to invoke when durable store entries change.
130
+ * @returns {() => Promise<void>} The function to unsubscribe from durable store changes
131
+ */
132
+ registerOnChangedListener(listener: OnDurableStoreChangedListener): () => Promise<void>;
133
+ }
134
+ export {};
@@ -1,25 +1,25 @@
1
- import type { DurableStore } from './DurableStore';
2
- export declare const TTL_DURABLE_SEGMENT = "TTL_DURABLE_SEGMENT";
3
- export interface DefaultDurableTTLOverride extends DurableTTLOverride {
4
- namespace: 'TTL_DEFAULT_KEY';
5
- representationName: 'TTL_DEFAULT_KEY';
6
- }
7
- export interface DurableTTLOverride {
8
- namespace: string;
9
- representationName: string;
10
- ttl: number;
11
- }
12
- export interface TTLOverridesMap {
13
- defaultTTL: DefaultDurableTTLOverride | undefined;
14
- overrides: DurableTTLOverride[];
15
- }
16
- /**
17
- * Class to set and get the TTL override values in the Durable Store
18
- */
19
- export declare class DurableTTLStore {
20
- private durableStore;
21
- constructor(durableStore: DurableStore);
22
- setDefaultDurableTTLOverrides(ttl: number): Promise<void>;
23
- setDurableTTLOverride(namespace: string, representationName: string, ttl: number): Promise<void>;
24
- getDurableTTLOverrides(): Promise<TTLOverridesMap>;
25
- }
1
+ import type { DurableStore } from './DurableStore';
2
+ export declare const TTL_DURABLE_SEGMENT = "TTL_DURABLE_SEGMENT";
3
+ export interface DefaultDurableTTLOverride extends DurableTTLOverride {
4
+ namespace: 'TTL_DEFAULT_KEY';
5
+ representationName: 'TTL_DEFAULT_KEY';
6
+ }
7
+ export interface DurableTTLOverride {
8
+ namespace: string;
9
+ representationName: string;
10
+ ttl: number;
11
+ }
12
+ export interface TTLOverridesMap {
13
+ defaultTTL: DefaultDurableTTLOverride | undefined;
14
+ overrides: DurableTTLOverride[];
15
+ }
16
+ /**
17
+ * Class to set and get the TTL override values in the Durable Store
18
+ */
19
+ export declare class DurableTTLStore {
20
+ private durableStore;
21
+ constructor(durableStore: DurableStore);
22
+ setDefaultDurableTTLOverrides(ttl: number): Promise<void>;
23
+ setDurableTTLOverride(namespace: string, representationName: string, ttl: number): Promise<void>;
24
+ getDurableTTLOverrides(): Promise<TTLOverridesMap>;
25
+ }
@@ -1,18 +1,18 @@
1
- import type { EnvironmentAdapterEvent } from '@luvio/engine';
2
- import type { LuvioAdapterEventObserver, Snapshot } from '@luvio/engine';
3
- interface ReviveStartEvent {
4
- type: 'l2-revive-start';
5
- }
6
- interface ReviveEndEvent {
7
- type: 'l2-revive-end';
8
- duration: number;
9
- snapshot: Snapshot<unknown, unknown>;
10
- l2Trips: {
11
- duration: number;
12
- keysRequestedCount: number;
13
- }[];
14
- }
15
- export declare type DurableEnvironmentAdapterEventData = ReviveStartEvent | ReviveEndEvent;
16
- export declare function isDurableEnvironmentEvent(event: EnvironmentAdapterEvent<unknown>): event is EnvironmentAdapterEvent<DurableEnvironmentAdapterEventData>;
17
- export declare function emitDurableEnvironmentAdapterEvent(eventData: DurableEnvironmentAdapterEventData, observers: LuvioAdapterEventObserver[] | undefined): void;
18
- export {};
1
+ import type { EnvironmentAdapterEvent } from '@luvio/engine';
2
+ import type { LuvioAdapterEventObserver, Snapshot } from '@luvio/engine';
3
+ interface ReviveStartEvent {
4
+ type: 'l2-revive-start';
5
+ }
6
+ interface ReviveEndEvent {
7
+ type: 'l2-revive-end';
8
+ duration: number;
9
+ snapshot: Snapshot<unknown, unknown>;
10
+ l2Trips: {
11
+ duration: number;
12
+ keysRequestedCount: number;
13
+ }[];
14
+ }
15
+ export declare type DurableEnvironmentAdapterEventData = ReviveStartEvent | ReviveEndEvent;
16
+ export declare function isDurableEnvironmentEvent(event: EnvironmentAdapterEvent<unknown>): event is EnvironmentAdapterEvent<DurableEnvironmentAdapterEventData>;
17
+ export declare function emitDurableEnvironmentAdapterEvent(eventData: DurableEnvironmentAdapterEventData, observers: LuvioAdapterEventObserver[] | undefined): void;
18
+ export {};
@@ -1,5 +1,5 @@
1
- export { DurableStore, DurableStoreEntries, DurableStoreEntry, DurableStoreChange, OnDurableStoreChangedListener, DefaultDurableSegment, DefaultDurableSegmentName, DurableStoreOperation, DurableStoreOperationType, DURABLE_METADATA_VERSION, } from './DurableStore';
2
- export { DurableTTLOverride, DefaultDurableTTLOverride } from './DurableTTLStore';
3
- export { makeDurable, DurableEnvironment } from './makeDurable';
4
- export { publishDurableStoreEntries } from './makeDurable/revive';
5
- export { isDurableEnvironmentEvent } from './events';
1
+ export { DurableStore, DurableStoreEntries, DurableStoreEntry, DurableStoreChange, OnDurableStoreChangedListener, DefaultDurableSegment, DefaultDurableSegmentName, DurableStoreOperation, DurableStoreOperationType, DURABLE_METADATA_VERSION, } from './DurableStore';
2
+ export { DurableTTLOverride, DefaultDurableTTLOverride } from './DurableTTLStore';
3
+ export { makeDurable, DurableEnvironment } from './makeDurable';
4
+ export { publishDurableStoreEntries } from './makeDurable/revive';
5
+ export { isDurableEnvironmentEvent } from './events';
@@ -1,11 +1,11 @@
1
- import type { Luvio } from '@luvio/engine';
2
- export declare const DURABLE_STORE_ERROR = "durable-store-error";
3
- export declare type InstrumentationFunction = Luvio['instrument'];
4
- export declare type DurableStoreRejectionHandler = (e: any) => void;
5
- /**
6
- * Returns a function that processes errors from durable store promise rejections.
7
- * If running in a non-production environment, the error is rethrown.
8
- * When running in production the error is sent to instrumentation.
9
- * @param instrument Instrumentation function implementation
10
- */
11
- export declare function handleDurableStoreRejection(instrument: InstrumentationFunction | undefined): DurableStoreRejectionHandler;
1
+ import type { Luvio } from '@luvio/engine';
2
+ export declare const DURABLE_STORE_ERROR = "durable-store-error";
3
+ export declare type InstrumentationFunction = Luvio['instrument'];
4
+ export declare type DurableStoreRejectionHandler = (e: any) => void;
5
+ /**
6
+ * Returns a function that processes errors from durable store promise rejections.
7
+ * If running in a non-production environment, the error is rethrown.
8
+ * When running in production the error is sent to instrumentation.
9
+ * @param instrument Instrumentation function implementation
10
+ */
11
+ export declare function handleDurableStoreRejection(instrument: InstrumentationFunction | undefined): DurableStoreRejectionHandler;
@@ -1,4 +1,4 @@
1
- import type { InMemoryStore } from '@luvio/engine';
2
- import type { DurableStore } from '../DurableStore';
3
- import type { DurableStoreRejectionHandler } from './error';
4
- export declare function flushInMemoryStoreValuesToDurableStore(store: InMemoryStore, durableStore: DurableStore, durableStoreErrorHandler: DurableStoreRejectionHandler): Promise<void>;
1
+ import type { InMemoryStore } from '@luvio/engine';
2
+ import type { DurableStore } from '../DurableStore';
3
+ import type { DurableStoreRejectionHandler } from './error';
4
+ export declare function flushInMemoryStoreValuesToDurableStore(store: InMemoryStore, durableStore: DurableStore, durableStoreErrorHandler: DurableStoreRejectionHandler): Promise<void>;
@@ -1,38 +1,38 @@
1
- import type { Environment, Snapshot, UnAvailableSnapshot, StoreMetadata, NormalizedKeyMetadata } from '@luvio/engine';
2
- import type { DurableStore, DurableStoreEntries } from '../DurableStore';
3
- import type { DurableStoreRejectionHandler } from './error';
4
- import { StoreKeySet } from '@luvio/engine';
5
- declare type ReviveResponse = {
6
- revivedKeys: StoreKeySet<string | NormalizedKeyMetadata>;
7
- hadUnexpectedShape: boolean;
8
- };
9
- /**
10
- * Takes a set of entries from DurableStore and publishes them via the passed in funcs.
11
- * This respects expiration and checks for valid DurableStore data shapes. This should
12
- * be used over manually parsing DurableStoreEntries
13
- *
14
- * @param durableRecords The DurableStoreEntries to parse
15
- * @param publish A function to call with the data of each DurableStoreEntry
16
- * @param publishMetadata A function to call with the metadata of each DurableStoreEntry
17
- * @param pendingWriter the PendingWriter (this is going away soon)
18
- * @returns
19
- */
20
- export declare function publishDurableStoreEntries(durableRecords: DurableStoreEntries<unknown> | undefined, publish: (key: string | NormalizedKeyMetadata, record: unknown) => void, publishMetadata: (key: string, metadata: StoreMetadata) => void): ReviveResponse;
21
- interface ReviveMetrics {
22
- l2Trips: {
23
- keysRequestedCount: number;
24
- duration: number;
25
- }[];
26
- }
27
- interface ReviveResult<D, V> {
28
- snapshot: Snapshot<D, V>;
29
- metrics: ReviveMetrics;
30
- }
31
- /**
32
- * This method returns a Promise to a snapshot that is revived from L2 cache. If
33
- * L2 does not have the entries necessary to fulfill the snapshot then this method
34
- * will refresh the snapshot from network, and then run the results from network
35
- * through L2 ingestion, returning the subsequent revived snapshot.
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>>;
38
- export {};
1
+ import type { Environment, Snapshot, UnAvailableSnapshot, StoreMetadata, NormalizedKeyMetadata } from '@luvio/engine';
2
+ import type { DurableStore, DurableStoreEntries } from '../DurableStore';
3
+ import type { DurableStoreRejectionHandler } from './error';
4
+ import { StoreKeySet } from '@luvio/engine';
5
+ declare type ReviveResponse = {
6
+ revivedKeys: StoreKeySet<string | NormalizedKeyMetadata>;
7
+ hadUnexpectedShape: boolean;
8
+ };
9
+ /**
10
+ * Takes a set of entries from DurableStore and publishes them via the passed in funcs.
11
+ * This respects expiration and checks for valid DurableStore data shapes. This should
12
+ * be used over manually parsing DurableStoreEntries
13
+ *
14
+ * @param durableRecords The DurableStoreEntries to parse
15
+ * @param publish A function to call with the data of each DurableStoreEntry
16
+ * @param publishMetadata A function to call with the metadata of each DurableStoreEntry
17
+ * @param pendingWriter the PendingWriter (this is going away soon)
18
+ * @returns
19
+ */
20
+ export declare function publishDurableStoreEntries(durableRecords: DurableStoreEntries<unknown> | undefined, publish: (key: string | NormalizedKeyMetadata, record: unknown) => void, publishMetadata: (key: string, metadata: StoreMetadata) => void): ReviveResponse;
21
+ interface ReviveMetrics {
22
+ l2Trips: {
23
+ keysRequestedCount: number;
24
+ duration: number;
25
+ }[];
26
+ }
27
+ interface ReviveResult<D, V> {
28
+ snapshot: Snapshot<D, V>;
29
+ metrics: ReviveMetrics;
30
+ }
31
+ /**
32
+ * This method returns a Promise to a snapshot that is revived from L2 cache. If
33
+ * L2 does not have the entries necessary to fulfill the snapshot then this method
34
+ * will refresh the snapshot from network, and then run the results from network
35
+ * through L2 ingestion, returning the subsequent revived snapshot.
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>>;
38
+ export {};
@@ -1,6 +1,6 @@
1
- import type { Environment, InMemoryStore } from '@luvio/engine';
2
- /**
3
- * Returns an empty InMemoryStore that can be used for ingestion. Copies over
4
- * the TTLOverrides from the given Environment's Store.
5
- */
6
- export declare function buildIngestStagingStore(environment: Environment): InMemoryStore;
1
+ import type { Environment, InMemoryStore } from '@luvio/engine';
2
+ /**
3
+ * Returns an empty InMemoryStore that can be used for ingestion. Copies over
4
+ * the TTLOverrides from the given Environment's Store.
5
+ */
6
+ export declare function buildIngestStagingStore(environment: Environment): InMemoryStore;
@@ -1,3 +1,3 @@
1
- import type { Environment } from '@luvio/engine';
2
- import type { DurableTTLStore } from '../DurableTTLStore';
3
- export declare function reviveTTLOverrides(ttlStore: DurableTTLStore, environment: Environment): Promise<void>;
1
+ import type { Environment } from '@luvio/engine';
2
+ import type { DurableTTLStore } from '../DurableTTLStore';
3
+ export declare function reviveTTLOverrides(ttlStore: DurableTTLStore, environment: Environment): Promise<void>;
@@ -1,2 +1,2 @@
1
- import type { StoreRecordError } from '@luvio/engine';
2
- export declare function isStoreEntryError(storeRecord: unknown): storeRecord is StoreRecordError;
1
+ import type { StoreRecordError } from '@luvio/engine';
2
+ export declare function isStoreEntryError(storeRecord: unknown): storeRecord is StoreRecordError;
@@ -1,44 +1,44 @@
1
- import type { Environment, RecordSource, InMemoryStore } from '@luvio/engine';
2
- import type { DurableStore } from './DurableStore';
3
- import type { InstrumentationFunction } from './makeDurable/error';
4
- import type { TTLOverridesMap } from './DurableTTLStore';
5
- export interface DurableEnvironment extends Environment {
6
- /**
7
- * Disposes the environment and detaches the durable store listener
8
- */
9
- dispose(): Promise<void>;
10
- /**
11
- * publishes the pending changes to the durable store
12
- */
13
- publishChangesToDurableStore(): Promise<void>;
14
- /**
15
- * gets all the stored ttl overrides stored in the durable store
16
- */
17
- getDurableTTLOverrides(): Promise<TTLOverridesMap>;
18
- /**
19
- * Gets the ingest staging store records if called during the ingestion
20
- * flow, otherwise returns an empty object.
21
- */
22
- getIngestStagingStoreRecords(): RecordSource;
23
- /**
24
- * Gets the ingest staging store metadata if called during the ingestion
25
- * flow, otherwise returns an empty object.
26
- */
27
- getIngestStagingStoreMetadata(): InMemoryStore['fallbackStringKeyInMemoryStore']['metadata'];
28
- }
29
- export declare const AdapterContextSegment = "ADAPTER-CONTEXT";
30
- export declare const ADAPTER_CONTEXT_ID_SUFFIX = "__NAMED_CONTEXT";
31
- interface MakeDurableOptions {
32
- durableStore: DurableStore;
33
- instrumentation?: InstrumentationFunction;
34
- }
35
- /**
36
- * Configures the environment to persist data into a durable store and attempt to resolve
37
- * data from the persistent store before hitting the network.
38
- *
39
- * @param environment The base environment
40
- * @param durableStore A DurableStore implementation
41
- * @param instrumentation An instrumentation function implementation
42
- */
43
- export declare function makeDurable(environment: Environment, { durableStore, instrumentation }: MakeDurableOptions): DurableEnvironment;
44
- export {};
1
+ import type { Environment, RecordSource, InMemoryStore } from '@luvio/engine';
2
+ import type { DurableStore } from './DurableStore';
3
+ import type { InstrumentationFunction } from './makeDurable/error';
4
+ import type { TTLOverridesMap } from './DurableTTLStore';
5
+ export interface DurableEnvironment extends Environment {
6
+ /**
7
+ * Disposes the environment and detaches the durable store listener
8
+ */
9
+ dispose(): Promise<void>;
10
+ /**
11
+ * publishes the pending changes to the durable store
12
+ */
13
+ publishChangesToDurableStore(): Promise<void>;
14
+ /**
15
+ * gets all the stored ttl overrides stored in the durable store
16
+ */
17
+ getDurableTTLOverrides(): Promise<TTLOverridesMap>;
18
+ /**
19
+ * Gets the ingest staging store records if called during the ingestion
20
+ * flow, otherwise returns an empty object.
21
+ */
22
+ getIngestStagingStoreRecords(): RecordSource;
23
+ /**
24
+ * Gets the ingest staging store metadata if called during the ingestion
25
+ * flow, otherwise returns an empty object.
26
+ */
27
+ getIngestStagingStoreMetadata(): InMemoryStore['fallbackStringKeyInMemoryStore']['metadata'];
28
+ }
29
+ export declare const AdapterContextSegment = "ADAPTER-CONTEXT";
30
+ export declare const ADAPTER_CONTEXT_ID_SUFFIX = "__NAMED_CONTEXT";
31
+ interface MakeDurableOptions {
32
+ durableStore: DurableStore;
33
+ instrumentation?: InstrumentationFunction;
34
+ }
35
+ /**
36
+ * Configures the environment to persist data into a durable store and attempt to resolve
37
+ * data from the persistent store before hitting the network.
38
+ *
39
+ * @param environment The base environment
40
+ * @param durableStore A DurableStore implementation
41
+ * @param instrumentation An instrumentation function implementation
42
+ */
43
+ export declare function makeDurable(environment: Environment, { durableStore, instrumentation }: MakeDurableOptions): DurableEnvironment;
44
+ export {};
@@ -1 +1 @@
1
- export declare function deepFreeze(value: any): void;
1
+ export declare function deepFreeze(value: any): void;