@fnndsc/cumin 3.16.0 → 3.17.0
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/cache/index.d.ts +4 -3
- package/dist/cache/index.js +13 -1
- package/dist/cache/index.js.map +1 -1
- package/dist/cache/listCache.d.ts +41 -14
- package/dist/cache/listCache.js +97 -23
- package/dist/cache/listCache.js.map +1 -1
- package/dist/cache/listCheckpoint.js +1 -1
- package/dist/cache/listCheckpoint.js.map +1 -1
- package/dist/cache/listingInvalidation.d.ts +47 -0
- package/dist/cache/listingInvalidation.js +170 -0
- package/dist/cache/listingInvalidation.js.map +1 -0
- package/dist/cache/procCache.d.ts +105 -18
- package/dist/cache/procCache.js +155 -11
- package/dist/cache/procCache.js.map +1 -1
- package/dist/chrisapi/contract.d.ts +2 -0
- package/dist/chrisapi/contract.js.map +1 -1
- package/dist/context/chrisContext.d.ts +23 -1
- package/dist/context/chrisContext.js +41 -2
- package/dist/context/chrisContext.js.map +1 -1
- package/dist/feeds/chrisFeed.d.ts +19 -0
- package/dist/feeds/chrisFeed.js +66 -0
- package/dist/feeds/chrisFeed.js.map +1 -1
- package/dist/io/chrisIO.d.ts +16 -3
- package/dist/io/chrisIO.js +77 -5
- package/dist/io/chrisIO.js.map +1 -1
- package/package.json +1 -1
package/dist/cache/index.d.ts
CHANGED
|
@@ -3,12 +3,13 @@
|
|
|
3
3
|
*
|
|
4
4
|
* @module
|
|
5
5
|
*/
|
|
6
|
-
export { ListCache, listCache_get } from './listCache.js';
|
|
6
|
+
export { ListCache, listCache_get, LIST_CACHE_SIGNAL_BACKED_TTL_MS, LIST_CACHE_SIGNAL_FREE_TTL_MS, LIST_CACHE_PLUGIN_INDEX_TTL_MS, LIST_CACHE_MAX_ENTRIES, } from './listCache.js';
|
|
7
7
|
export type { CacheStats, CacheResult, CacheOptions, ListCacheSnapshot, ListCacheEntrySnapshot } from './listCache.js';
|
|
8
8
|
export { listCheckpointPath_get, listCheckpoint_restore, listCheckpoint_save, listCheckpoint_watch, } from './listCheckpoint.js';
|
|
9
9
|
export type { ListCheckpointRestoreResult } from './listCheckpoint.js';
|
|
10
|
-
export {
|
|
11
|
-
export
|
|
10
|
+
export { listingsForFeeds_note, listingsForFeeds_drop, listingsForRoster_note, listingInvalidation_flush, listingInvalidation_reset, LISTING_INVALIDATION_WINDOW_MS, } from './listingInvalidation.js';
|
|
11
|
+
export { ProcCache, procCache_get, status_isTerminal, feed_isActive, feedTopology_changed, PROC_TERMINAL_STATUSES, PROC_ARRIVAL_TTL_MS } from './procCache.js';
|
|
12
|
+
export type { RosterFolders, ProcInstance, ProcFeed, ProcFeedScopeCounts, ProcWarmupProgress, ProcFeedLoadProgress, ProcCacheState, ProcCacheLifecycle, ProcCacheSnapshot, ProcFeedSnapshot, ProcCacheChange, ProcCacheListener, } from './procCache.js';
|
|
12
13
|
export type { ProcPromptState, ProcPromptProgress } from '@fnndsc/menu';
|
|
13
14
|
export { procCheckpointPath_get, procCheckpointDir_get, procCheckpoint_restore, procCheckpoint_save, procCheckpointFeed_save, procCheckpointRoster_save, procCheckpoint_watch, } from './procCheckpoint.js';
|
|
14
15
|
export type { ProcCheckpointRestoreResult } from './procCheckpoint.js';
|
package/dist/cache/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.procCheckpoint_watch = exports.procCheckpointRoster_save = exports.procCheckpointFeed_save = exports.procCheckpoint_save = exports.procCheckpoint_restore = exports.procCheckpointDir_get = exports.procCheckpointPath_get = exports.PROC_TERMINAL_STATUSES = exports.feedTopology_changed = exports.feed_isActive = exports.status_isTerminal = exports.procCache_get = exports.ProcCache = exports.listCheckpoint_watch = exports.listCheckpoint_save = exports.listCheckpoint_restore = exports.listCheckpointPath_get = exports.listCache_get = exports.ListCache = void 0;
|
|
3
|
+
exports.procCheckpoint_watch = exports.procCheckpointRoster_save = exports.procCheckpointFeed_save = exports.procCheckpoint_save = exports.procCheckpoint_restore = exports.procCheckpointDir_get = exports.procCheckpointPath_get = exports.PROC_ARRIVAL_TTL_MS = exports.PROC_TERMINAL_STATUSES = exports.feedTopology_changed = exports.feed_isActive = exports.status_isTerminal = exports.procCache_get = exports.ProcCache = exports.LISTING_INVALIDATION_WINDOW_MS = exports.listingInvalidation_reset = exports.listingInvalidation_flush = exports.listingsForRoster_note = exports.listingsForFeeds_drop = exports.listingsForFeeds_note = exports.listCheckpoint_watch = exports.listCheckpoint_save = exports.listCheckpoint_restore = exports.listCheckpointPath_get = exports.LIST_CACHE_MAX_ENTRIES = exports.LIST_CACHE_PLUGIN_INDEX_TTL_MS = exports.LIST_CACHE_SIGNAL_FREE_TTL_MS = exports.LIST_CACHE_SIGNAL_BACKED_TTL_MS = exports.listCache_get = exports.ListCache = void 0;
|
|
4
4
|
/**
|
|
5
5
|
* @file Cache module exports.
|
|
6
6
|
*
|
|
@@ -9,11 +9,22 @@ exports.procCheckpoint_watch = exports.procCheckpointRoster_save = exports.procC
|
|
|
9
9
|
var listCache_js_1 = require("./listCache.js");
|
|
10
10
|
Object.defineProperty(exports, "ListCache", { enumerable: true, get: function () { return listCache_js_1.ListCache; } });
|
|
11
11
|
Object.defineProperty(exports, "listCache_get", { enumerable: true, get: function () { return listCache_js_1.listCache_get; } });
|
|
12
|
+
Object.defineProperty(exports, "LIST_CACHE_SIGNAL_BACKED_TTL_MS", { enumerable: true, get: function () { return listCache_js_1.LIST_CACHE_SIGNAL_BACKED_TTL_MS; } });
|
|
13
|
+
Object.defineProperty(exports, "LIST_CACHE_SIGNAL_FREE_TTL_MS", { enumerable: true, get: function () { return listCache_js_1.LIST_CACHE_SIGNAL_FREE_TTL_MS; } });
|
|
14
|
+
Object.defineProperty(exports, "LIST_CACHE_PLUGIN_INDEX_TTL_MS", { enumerable: true, get: function () { return listCache_js_1.LIST_CACHE_PLUGIN_INDEX_TTL_MS; } });
|
|
15
|
+
Object.defineProperty(exports, "LIST_CACHE_MAX_ENTRIES", { enumerable: true, get: function () { return listCache_js_1.LIST_CACHE_MAX_ENTRIES; } });
|
|
12
16
|
var listCheckpoint_js_1 = require("./listCheckpoint.js");
|
|
13
17
|
Object.defineProperty(exports, "listCheckpointPath_get", { enumerable: true, get: function () { return listCheckpoint_js_1.listCheckpointPath_get; } });
|
|
14
18
|
Object.defineProperty(exports, "listCheckpoint_restore", { enumerable: true, get: function () { return listCheckpoint_js_1.listCheckpoint_restore; } });
|
|
15
19
|
Object.defineProperty(exports, "listCheckpoint_save", { enumerable: true, get: function () { return listCheckpoint_js_1.listCheckpoint_save; } });
|
|
16
20
|
Object.defineProperty(exports, "listCheckpoint_watch", { enumerable: true, get: function () { return listCheckpoint_js_1.listCheckpoint_watch; } });
|
|
21
|
+
var listingInvalidation_js_1 = require("./listingInvalidation.js");
|
|
22
|
+
Object.defineProperty(exports, "listingsForFeeds_note", { enumerable: true, get: function () { return listingInvalidation_js_1.listingsForFeeds_note; } });
|
|
23
|
+
Object.defineProperty(exports, "listingsForFeeds_drop", { enumerable: true, get: function () { return listingInvalidation_js_1.listingsForFeeds_drop; } });
|
|
24
|
+
Object.defineProperty(exports, "listingsForRoster_note", { enumerable: true, get: function () { return listingInvalidation_js_1.listingsForRoster_note; } });
|
|
25
|
+
Object.defineProperty(exports, "listingInvalidation_flush", { enumerable: true, get: function () { return listingInvalidation_js_1.listingInvalidation_flush; } });
|
|
26
|
+
Object.defineProperty(exports, "listingInvalidation_reset", { enumerable: true, get: function () { return listingInvalidation_js_1.listingInvalidation_reset; } });
|
|
27
|
+
Object.defineProperty(exports, "LISTING_INVALIDATION_WINDOW_MS", { enumerable: true, get: function () { return listingInvalidation_js_1.LISTING_INVALIDATION_WINDOW_MS; } });
|
|
17
28
|
var procCache_js_1 = require("./procCache.js");
|
|
18
29
|
Object.defineProperty(exports, "ProcCache", { enumerable: true, get: function () { return procCache_js_1.ProcCache; } });
|
|
19
30
|
Object.defineProperty(exports, "procCache_get", { enumerable: true, get: function () { return procCache_js_1.procCache_get; } });
|
|
@@ -21,6 +32,7 @@ Object.defineProperty(exports, "status_isTerminal", { enumerable: true, get: fun
|
|
|
21
32
|
Object.defineProperty(exports, "feed_isActive", { enumerable: true, get: function () { return procCache_js_1.feed_isActive; } });
|
|
22
33
|
Object.defineProperty(exports, "feedTopology_changed", { enumerable: true, get: function () { return procCache_js_1.feedTopology_changed; } });
|
|
23
34
|
Object.defineProperty(exports, "PROC_TERMINAL_STATUSES", { enumerable: true, get: function () { return procCache_js_1.PROC_TERMINAL_STATUSES; } });
|
|
35
|
+
Object.defineProperty(exports, "PROC_ARRIVAL_TTL_MS", { enumerable: true, get: function () { return procCache_js_1.PROC_ARRIVAL_TTL_MS; } });
|
|
24
36
|
var procCheckpoint_js_1 = require("./procCheckpoint.js");
|
|
25
37
|
Object.defineProperty(exports, "procCheckpointPath_get", { enumerable: true, get: function () { return procCheckpoint_js_1.procCheckpointPath_get; } });
|
|
26
38
|
Object.defineProperty(exports, "procCheckpointDir_get", { enumerable: true, get: function () { return procCheckpoint_js_1.procCheckpointDir_get; } });
|
package/dist/cache/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/cache/index.ts"],"names":[],"mappings":";;;AAAA;;;;GAIG;AACH,+
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/cache/index.ts"],"names":[],"mappings":";;;AAAA;;;;GAIG;AACH,+CAOwB;AANtB,yGAAA,SAAS,OAAA;AACT,6GAAA,aAAa,OAAA;AACb,+HAAA,+BAA+B,OAAA;AAC/B,6HAAA,6BAA6B,OAAA;AAC7B,8HAAA,8BAA8B,OAAA;AAC9B,sHAAA,sBAAsB,OAAA;AAGxB,yDAK6B;AAJ3B,2HAAA,sBAAsB,OAAA;AACtB,2HAAA,sBAAsB,OAAA;AACtB,wHAAA,mBAAmB,OAAA;AACnB,yHAAA,oBAAoB,OAAA;AAGtB,mEAOkC;AANhC,+HAAA,qBAAqB,OAAA;AACrB,+HAAA,qBAAqB,OAAA;AACrB,gIAAA,sBAAsB,OAAA;AACtB,mIAAA,yBAAyB,OAAA;AACzB,mIAAA,yBAAyB,OAAA;AACzB,wIAAA,8BAA8B,OAAA;AAEhC,+CAA+J;AAAtJ,yGAAA,SAAS,OAAA;AAAE,6GAAA,aAAa,OAAA;AAAE,iHAAA,iBAAiB,OAAA;AAAE,6GAAA,aAAa,OAAA;AAAE,oHAAA,oBAAoB,OAAA;AAAE,sHAAA,sBAAsB,OAAA;AAAE,mHAAA,mBAAmB,OAAA;AA0BtI,yDAQ6B;AAP3B,2HAAA,sBAAsB,OAAA;AACtB,0HAAA,qBAAqB,OAAA;AACrB,2HAAA,sBAAsB,OAAA;AACtB,wHAAA,mBAAmB,OAAA;AACnB,4HAAA,uBAAuB,OAAA;AACvB,8HAAA,yBAAyB,OAAA;AACzB,yHAAA,oBAAoB,OAAA"}
|
|
@@ -1,17 +1,22 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* Lifetime for a path `/proc` reports movement on.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
4
|
+
* Long by design: arrivals, departures and job completions mark these
|
|
5
|
+
* dirty as they happen, so the clock is a backstop against a missed
|
|
6
|
+
* notification rather than the mechanism.
|
|
7
|
+
*/
|
|
8
|
+
export declare const LIST_CACHE_SIGNAL_BACKED_TTL_MS: number;
|
|
9
|
+
/** Lifetime for a path nothing reports movement on. */
|
|
10
|
+
export declare const LIST_CACHE_SIGNAL_FREE_TTL_MS: number;
|
|
11
|
+
/**
|
|
12
|
+
* Lifetime for the plugin and pipeline indexes.
|
|
12
13
|
*
|
|
13
|
-
*
|
|
14
|
+
* Registration is an administrative act on a CUBE, not something a
|
|
15
|
+
* session causes, and it happens on a scale of months.
|
|
14
16
|
*/
|
|
17
|
+
export declare const LIST_CACHE_PLUGIN_INDEX_TTL_MS: number;
|
|
18
|
+
/** How many path listings the cache retains before evicting the oldest. */
|
|
19
|
+
export declare const LIST_CACHE_MAX_ENTRIES: number;
|
|
15
20
|
/**
|
|
16
21
|
* Result returned by cache_get with freshness information.
|
|
17
22
|
*/
|
|
@@ -69,6 +74,8 @@ export interface CacheStats {
|
|
|
69
74
|
entries: number;
|
|
70
75
|
/** Estimated total memory usage in bytes. */
|
|
71
76
|
totalSize: number;
|
|
77
|
+
/** Age of the oldest retained entry in milliseconds, or null when empty. */
|
|
78
|
+
oldestAge: number | null;
|
|
72
79
|
}
|
|
73
80
|
/**
|
|
74
81
|
* Singleton cache for directory listings with TTL and dirty tracking.
|
|
@@ -112,10 +119,19 @@ export declare class ListCache {
|
|
|
112
119
|
private cache;
|
|
113
120
|
/** Maximum cache entries (LRU eviction). */
|
|
114
121
|
private maxEntries;
|
|
115
|
-
/**
|
|
122
|
+
/** Lifetime for a path no configured prefix covers. */
|
|
116
123
|
private defaultTTL;
|
|
117
|
-
/**
|
|
124
|
+
/**
|
|
125
|
+
* Prefix-keyed lifetimes, longest prefix winning.
|
|
126
|
+
*
|
|
127
|
+
* A path is governed by a signal or by a clock, never argued over by
|
|
128
|
+
* both. Where `/proc` reports movement, the clock is only a backstop
|
|
129
|
+
* against a missed notification and can be long. Where nothing reports,
|
|
130
|
+
* a guess is all that is available and it stays short.
|
|
131
|
+
*/
|
|
118
132
|
private ttlConfig;
|
|
133
|
+
/** Whether this session has already reported that the cache filled. */
|
|
134
|
+
private evictionReported;
|
|
119
135
|
/** Cache statistics. */
|
|
120
136
|
private stats;
|
|
121
137
|
/** Listeners told after any mutation a persister would want to see. */
|
|
@@ -136,9 +152,11 @@ export declare class ListCache {
|
|
|
136
152
|
*/
|
|
137
153
|
snapshot_create(): ListCacheSnapshot;
|
|
138
154
|
/**
|
|
139
|
-
*
|
|
155
|
+
* Merges a snapshot's entries into the cache, keeping their original
|
|
140
156
|
* timestamps: what was stale stays stale and is revalidated on its next
|
|
141
|
-
* visit.
|
|
157
|
+
* visit. A path already cached in this process is newer than anything on
|
|
158
|
+
* disk and is kept as is. Entries beyond the LRU bound are dropped
|
|
159
|
+
* oldest-first.
|
|
142
160
|
*
|
|
143
161
|
* @param snapshot - A validated snapshot.
|
|
144
162
|
*/
|
|
@@ -168,6 +186,15 @@ export declare class ListCache {
|
|
|
168
186
|
* @param options - Optional TTL and dirty flag.
|
|
169
187
|
*/
|
|
170
188
|
cache_set<T = unknown>(path: string, data: T, options?: CacheOptions): void;
|
|
189
|
+
/**
|
|
190
|
+
* Every path the cache currently holds.
|
|
191
|
+
*
|
|
192
|
+
* Returned as a snapshot so a caller may mark or invalidate while
|
|
193
|
+
* iterating without mutating the map underneath itself.
|
|
194
|
+
*
|
|
195
|
+
* @returns The cached paths, least recently used first.
|
|
196
|
+
*/
|
|
197
|
+
paths_get(): string[];
|
|
171
198
|
/**
|
|
172
199
|
* Marks a cached path as dirty (needs refresh).
|
|
173
200
|
* Used when local mutations might have changed the data.
|
package/dist/cache/listCache.js
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ListCache = exports.LIST_CACHE_MAX_ENTRIES = exports.LIST_CACHE_PLUGIN_INDEX_TTL_MS = exports.LIST_CACHE_SIGNAL_FREE_TTL_MS = exports.LIST_CACHE_SIGNAL_BACKED_TTL_MS = void 0;
|
|
4
|
+
exports.listCache_get = listCache_get;
|
|
2
5
|
/**
|
|
3
6
|
* @file Enhanced Directory Listing Cache with TTL and dirty tracking.
|
|
4
7
|
*
|
|
@@ -13,9 +16,26 @@
|
|
|
13
16
|
*
|
|
14
17
|
* @module
|
|
15
18
|
*/
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
+
const errorStack_1 = require("../error/errorStack");
|
|
20
|
+
/**
|
|
21
|
+
* Lifetime for a path `/proc` reports movement on.
|
|
22
|
+
*
|
|
23
|
+
* Long by design: arrivals, departures and job completions mark these
|
|
24
|
+
* dirty as they happen, so the clock is a backstop against a missed
|
|
25
|
+
* notification rather than the mechanism.
|
|
26
|
+
*/
|
|
27
|
+
exports.LIST_CACHE_SIGNAL_BACKED_TTL_MS = 60 * 60 * 1000;
|
|
28
|
+
/** Lifetime for a path nothing reports movement on. */
|
|
29
|
+
exports.LIST_CACHE_SIGNAL_FREE_TTL_MS = 3 * 60 * 1000;
|
|
30
|
+
/**
|
|
31
|
+
* Lifetime for the plugin and pipeline indexes.
|
|
32
|
+
*
|
|
33
|
+
* Registration is an administrative act on a CUBE, not something a
|
|
34
|
+
* session causes, and it happens on a scale of months.
|
|
35
|
+
*/
|
|
36
|
+
exports.LIST_CACHE_PLUGIN_INDEX_TTL_MS = 24 * 60 * 60 * 1000;
|
|
37
|
+
/** How many path listings the cache retains before evicting the oldest. */
|
|
38
|
+
exports.LIST_CACHE_MAX_ENTRIES = 500;
|
|
19
39
|
/**
|
|
20
40
|
* Singleton cache for directory listings with TTL and dirty tracking.
|
|
21
41
|
*
|
|
@@ -81,17 +101,24 @@ class ListCache {
|
|
|
81
101
|
return { entries };
|
|
82
102
|
}
|
|
83
103
|
/**
|
|
84
|
-
*
|
|
104
|
+
* Merges a snapshot's entries into the cache, keeping their original
|
|
85
105
|
* timestamps: what was stale stays stale and is revalidated on its next
|
|
86
|
-
* visit.
|
|
106
|
+
* visit. A path already cached in this process is newer than anything on
|
|
107
|
+
* disk and is kept as is. Entries beyond the LRU bound are dropped
|
|
108
|
+
* oldest-first.
|
|
87
109
|
*
|
|
88
110
|
* @param snapshot - A validated snapshot.
|
|
89
111
|
*/
|
|
90
112
|
snapshot_restore(snapshot) {
|
|
113
|
+
const live = new Map(this.cache);
|
|
91
114
|
this.cache.clear();
|
|
92
115
|
for (const entry of snapshot.entries) {
|
|
116
|
+
if (live.has(entry.path))
|
|
117
|
+
continue;
|
|
93
118
|
this.cache.set(entry.path, { data: entry.data, timestamp: entry.timestamp, dirty: entry.dirty, ttl: entry.ttl });
|
|
94
119
|
}
|
|
120
|
+
for (const [path, entry] of live)
|
|
121
|
+
this.cache.set(path, entry);
|
|
95
122
|
this.evict_lru();
|
|
96
123
|
this.change_emit();
|
|
97
124
|
}
|
|
@@ -102,16 +129,33 @@ class ListCache {
|
|
|
102
129
|
/** Cache storage: path → entry. */
|
|
103
130
|
this.cache = new Map();
|
|
104
131
|
/** Maximum cache entries (LRU eviction). */
|
|
105
|
-
this.maxEntries =
|
|
106
|
-
/**
|
|
107
|
-
this.defaultTTL =
|
|
108
|
-
/**
|
|
132
|
+
this.maxEntries = exports.LIST_CACHE_MAX_ENTRIES;
|
|
133
|
+
/** Lifetime for a path no configured prefix covers. */
|
|
134
|
+
this.defaultTTL = exports.LIST_CACHE_SIGNAL_FREE_TTL_MS;
|
|
135
|
+
/**
|
|
136
|
+
* Prefix-keyed lifetimes, longest prefix winning.
|
|
137
|
+
*
|
|
138
|
+
* A path is governed by a signal or by a clock, never argued over by
|
|
139
|
+
* both. Where `/proc` reports movement, the clock is only a backstop
|
|
140
|
+
* against a missed notification and can be long. Where nothing reports,
|
|
141
|
+
* a guess is all that is available and it stays short.
|
|
142
|
+
*/
|
|
109
143
|
this.ttlConfig = new Map([
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
['/
|
|
113
|
-
['/
|
|
144
|
+
// Signal-covered: the roster and job-completion notifications decide
|
|
145
|
+
// when these go stale (see listing_dirtyByFeed).
|
|
146
|
+
['/home', exports.LIST_CACHE_SIGNAL_BACKED_TTL_MS],
|
|
147
|
+
['/SHARED', exports.LIST_CACHE_SIGNAL_BACKED_TTL_MS],
|
|
148
|
+
['/PUBLIC', exports.LIST_CACHE_SIGNAL_BACKED_TTL_MS],
|
|
149
|
+
// Signal-free: nothing reports movement, so a clock is the only option.
|
|
150
|
+
// Plugin registration is an administrative act on a scale of months,
|
|
151
|
+
// so a day is closer to true than an hour; `refresh` is the escape
|
|
152
|
+
// hatch when an operator knows a plugin was just registered.
|
|
153
|
+
['/bin', exports.LIST_CACHE_PLUGIN_INDEX_TTL_MS],
|
|
154
|
+
['/usr/share', exports.LIST_CACHE_PLUGIN_INDEX_TTL_MS],
|
|
155
|
+
['/PIPELINES', exports.LIST_CACHE_PLUGIN_INDEX_TTL_MS],
|
|
114
156
|
]);
|
|
157
|
+
/** Whether this session has already reported that the cache filled. */
|
|
158
|
+
this.evictionReported = false;
|
|
115
159
|
/** Cache statistics. */
|
|
116
160
|
this.stats = {
|
|
117
161
|
hits: 0,
|
|
@@ -182,6 +226,17 @@ class ListCache {
|
|
|
182
226
|
this.evict_lru();
|
|
183
227
|
this.change_emit();
|
|
184
228
|
}
|
|
229
|
+
/**
|
|
230
|
+
* Every path the cache currently holds.
|
|
231
|
+
*
|
|
232
|
+
* Returned as a snapshot so a caller may mark or invalidate while
|
|
233
|
+
* iterating without mutating the map underneath itself.
|
|
234
|
+
*
|
|
235
|
+
* @returns The cached paths, least recently used first.
|
|
236
|
+
*/
|
|
237
|
+
paths_get() {
|
|
238
|
+
return Array.from(this.cache.keys());
|
|
239
|
+
}
|
|
185
240
|
/**
|
|
186
241
|
* Marks a cached path as dirty (needs refresh).
|
|
187
242
|
* Used when local mutations might have changed the data.
|
|
@@ -263,18 +318,23 @@ class ListCache {
|
|
|
263
318
|
* @returns TTL in milliseconds.
|
|
264
319
|
*/
|
|
265
320
|
ttl_get(path) {
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
321
|
+
const exact = this.ttlConfig.get(path);
|
|
322
|
+
if (exact !== undefined)
|
|
323
|
+
return exact;
|
|
324
|
+
// Longest matching prefix wins, so a deeper entry can override a
|
|
325
|
+
// shallower one. Matching is on whole segments: `/bindings` must not
|
|
326
|
+
// inherit `/bin`'s lifetime.
|
|
327
|
+
let bestLength = -1;
|
|
328
|
+
let bestTTL = this.defaultTTL;
|
|
329
|
+
for (const [prefix, ttl] of this.ttlConfig) {
|
|
330
|
+
if (!path.startsWith(prefix + '/'))
|
|
331
|
+
continue;
|
|
332
|
+
if (prefix.length > bestLength) {
|
|
333
|
+
bestLength = prefix.length;
|
|
334
|
+
bestTTL = ttl;
|
|
275
335
|
}
|
|
276
336
|
}
|
|
277
|
-
return
|
|
337
|
+
return bestTTL;
|
|
278
338
|
}
|
|
279
339
|
/**
|
|
280
340
|
* Evicts oldest entries if cache exceeds max size.
|
|
@@ -285,6 +345,14 @@ class ListCache {
|
|
|
285
345
|
if (oldestKey !== undefined) {
|
|
286
346
|
this.cache.delete(oldestKey);
|
|
287
347
|
this.stats.evictions++;
|
|
348
|
+
// An eviction is not an error, but it is worth knowing about: the
|
|
349
|
+
// dropped listing also leaves the checkpoint, so a restart comes
|
|
350
|
+
// back thinner than the session that wrote it. Said once, because
|
|
351
|
+
// a session that crosses the cap will cross it repeatedly.
|
|
352
|
+
if (!this.evictionReported) {
|
|
353
|
+
this.evictionReported = true;
|
|
354
|
+
errorStack_1.errorStack.stack_push('warning', `listing cache is full at ${this.maxEntries} paths; the least recently used listings are being dropped and will not survive to the next session`);
|
|
355
|
+
}
|
|
288
356
|
}
|
|
289
357
|
else {
|
|
290
358
|
break; // Should never happen, but safety check
|
|
@@ -298,9 +366,13 @@ class ListCache {
|
|
|
298
366
|
*/
|
|
299
367
|
stats_get() {
|
|
300
368
|
let totalSize = 0;
|
|
369
|
+
let oldestTimestamp = null;
|
|
301
370
|
for (const entry of this.cache.values()) {
|
|
302
371
|
// Rough estimate: JSON string length
|
|
303
372
|
totalSize += JSON.stringify(entry.data).length;
|
|
373
|
+
if (oldestTimestamp === null || entry.timestamp < oldestTimestamp) {
|
|
374
|
+
oldestTimestamp = entry.timestamp;
|
|
375
|
+
}
|
|
304
376
|
}
|
|
305
377
|
return {
|
|
306
378
|
hits: this.stats.hits,
|
|
@@ -309,6 +381,7 @@ class ListCache {
|
|
|
309
381
|
evictions: this.stats.evictions,
|
|
310
382
|
entries: this.cache.size,
|
|
311
383
|
totalSize,
|
|
384
|
+
oldestAge: oldestTimestamp === null ? null : Date.now() - oldestTimestamp,
|
|
312
385
|
};
|
|
313
386
|
}
|
|
314
387
|
/**
|
|
@@ -320,6 +393,7 @@ class ListCache {
|
|
|
320
393
|
this.stats.misses = 0;
|
|
321
394
|
this.stats.staleHits = 0;
|
|
322
395
|
this.stats.evictions = 0;
|
|
396
|
+
this.evictionReported = false;
|
|
323
397
|
}
|
|
324
398
|
}
|
|
325
399
|
exports.ListCache = ListCache;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"listCache.js","sourceRoot":"","sources":["../../src/cache/listCache.ts"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"listCache.js","sourceRoot":"","sources":["../../src/cache/listCache.ts"],"names":[],"mappings":";;;AA6gBA,sCAEC;AA/gBD;;;;;;;;;;;;;GAaG;AACH,oDAAiD;AAEjD;;;;;;GAMG;AACU,QAAA,+BAA+B,GAAW,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;AAEtE,uDAAuD;AAC1C,QAAA,6BAA6B,GAAW,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC;AAEnE;;;;;GAKG;AACU,QAAA,8BAA8B,GAAW,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;AAE1E,2EAA2E;AAC9D,QAAA,sBAAsB,GAAW,GAAG,CAAC;AA6FlD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,MAAa,SAAS;IAgDpB;;;;;;OAMG;IACH,kBAAkB,CAAC,QAAoB;QACrC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;QAC7B,OAAO,GAAS,EAAE,GAAG,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC;IAC1D,CAAC;IAEO,WAAW;Q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AAE,IAAI,CAAC,KAAK,CAAC,IAAI;YACxB,SAAS;YACT,SAAS,EAAE,eAAe,KAAK,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,eAAe;SAC1E,CAAC;IACJ,CAAC;IAED;;;OAGG;IACH,WAAW;QACT,IAAI,CAAC,KAAK,CAAC,IAAI,GAAG,CAAC,CAAC;QACpB,IAAI,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC;QACtB,IAAI,CAAC,KAAK,CAAC,SAAS,GAAG,CAAC,CAAC;QACzB,IAAI,CAAC,KAAK,CAAC,SAAS,GAAG,CAAC,CAAC;QACzB,IAAI,CAAC,gBAAgB,GAAG,KAAK,CAAC;IAChC,CAAC;CACF;AAhWD,8BAgWC;AAED;;;;GAIG;AACH,SAAgB,aAAa;IAC3B,OAAO,SAAS,CAAC,YAAY,EAAE,CAAC;AAClC,CAAC"}
|
|
@@ -48,7 +48,7 @@ function entry_check(value) {
|
|
|
48
48
|
return false;
|
|
49
49
|
const entry = value;
|
|
50
50
|
return typeof entry.path === 'string' && entry.path.startsWith('/') &&
|
|
51
|
-
|
|
51
|
+
entry.data !== undefined && entry.data !== null &&
|
|
52
52
|
typeof entry.timestamp === 'number' && Number.isFinite(entry.timestamp) &&
|
|
53
53
|
typeof entry.dirty === 'boolean' &&
|
|
54
54
|
typeof entry.ttl === 'number' && Number.isFinite(entry.ttl) && entry.ttl > 0;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"listCheckpoint.js","sourceRoot":"","sources":["../../src/cache/listCheckpoint.ts"],"names":[],"mappings":";;;AA2DA,wDAGC;AAiCD,wDAqBC;AASD,kDAiBC;AAaD,oDAuBC;AAlLD;;;;;;;;;;;;GAYG;AACH,mCAAgD;AAChD,2BAAoC;AACpC,2BAA6B;AAC7B,+BAAqC;AACrC,2CAAiG;AAEjG,MAAM,sBAAsB,GAAW,CAAC,CAAC;AAEzC,oE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AK,GAAG,IAAI,CAAC;IACf,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* How long feed movement collects before the cache is walked.
|
|
3
|
+
*
|
|
4
|
+
* Short on purpose: the whole point is that the mark beats the operator's
|
|
5
|
+
* next listing of that folder.
|
|
6
|
+
*/
|
|
7
|
+
export declare const LISTING_INVALIDATION_WINDOW_MS: number;
|
|
8
|
+
/**
|
|
9
|
+
* Notes that a feed's contents moved, so its cached folder listings are
|
|
10
|
+
* behind. Call when a job crosses into a terminal state — that is when
|
|
11
|
+
* output becomes visible.
|
|
12
|
+
*
|
|
13
|
+
* @param feedIDs - Feeds whose contents changed.
|
|
14
|
+
*/
|
|
15
|
+
export declare function listingsForFeeds_note(feedIDs: readonly number[]): void;
|
|
16
|
+
/**
|
|
17
|
+
* Notes that feeds arrived in, or vanished from, a parent folder.
|
|
18
|
+
*
|
|
19
|
+
* An arrival changes the *parent* listing rather than anything inside the
|
|
20
|
+
* feed, which is why this takes the folders as well: a feed shared to this
|
|
21
|
+
* identity adds a row to a folder that may itself be perfectly fresh.
|
|
22
|
+
*
|
|
23
|
+
* @param feedIDs - Feeds that arrived or departed.
|
|
24
|
+
* @param parentPaths - Folder listings whose membership therefore changed.
|
|
25
|
+
*/
|
|
26
|
+
export declare function listingsForRoster_note(feedIDs: readonly number[], parentPaths: readonly string[]): void;
|
|
27
|
+
/**
|
|
28
|
+
* Removes every cached listing belonging to feeds that are gone.
|
|
29
|
+
*
|
|
30
|
+
* A departure is not staleness. A feed this identity can no longer see has
|
|
31
|
+
* no contents to serve, and dirty entries are still served while they
|
|
32
|
+
* refresh, so marking one would keep showing a tree that has been taken
|
|
33
|
+
* away. This deletes instead, and does so at once rather than on the
|
|
34
|
+
* window, because there is nothing to race.
|
|
35
|
+
*
|
|
36
|
+
* @param feedIDs - Feeds that vanished from the roster.
|
|
37
|
+
* @returns The cache paths removed.
|
|
38
|
+
*/
|
|
39
|
+
export declare function listingsForFeeds_drop(feedIDs: readonly number[]): string[];
|
|
40
|
+
/**
|
|
41
|
+
* Applies any pending movement at once, without waiting for the window.
|
|
42
|
+
*
|
|
43
|
+
* @returns The cache paths marked dirty.
|
|
44
|
+
*/
|
|
45
|
+
export declare function listingInvalidation_flush(): string[];
|
|
46
|
+
/** Discards pending movement without applying it (tests, cache reset). */
|
|
47
|
+
export declare function listingInvalidation_reset(): void;
|