@woosh/meep-engine 2.165.7 → 2.167.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/build/bundle-worker-image-decoder.js +1 -1
- package/package.json +1 -1
- package/src/CORRECTNESS_HUNT_2026_07_24.md +142 -0
- package/src/core/binary/BinaryBuffer.js +1 -1
- package/src/core/binary/EncodingBinaryBuffer.d.ts.map +1 -1
- package/src/core/binary/EncodingBinaryBuffer.js +3 -1
- package/src/core/cache/Cache.d.ts.map +1 -1
- package/src/core/cache/Cache.js +0 -4
- package/src/core/cache/CacheElement.d.ts.map +1 -1
- package/src/core/cache/CacheElement.js +4 -0
- package/src/core/cache/FrequencySketch.d.ts +0 -21
- package/src/core/cache/FrequencySketch.d.ts.map +1 -1
- package/src/core/cache/FrequencySketch.js +66 -65
- package/src/core/cache/wtinylfu/CacheElementWTinylfu.d.ts +17 -0
- package/src/core/cache/wtinylfu/CacheElementWTinylfu.d.ts.map +1 -0
- package/src/core/cache/wtinylfu/CacheElementWTinylfu.js +18 -0
- package/src/core/cache/wtinylfu/CacheRegionType.d.ts +10 -0
- package/src/core/cache/wtinylfu/CacheRegionType.d.ts.map +1 -0
- package/src/core/cache/wtinylfu/CacheRegionType.js +10 -0
- package/src/core/cache/wtinylfu/CacheRegionWTinylfu.d.ts +66 -0
- package/src/core/cache/wtinylfu/CacheRegionWTinylfu.d.ts.map +1 -0
- package/src/core/cache/wtinylfu/CacheRegionWTinylfu.js +183 -0
- package/src/core/cache/wtinylfu/CacheWTinylfu.d.ts +279 -0
- package/src/core/cache/wtinylfu/CacheWTinylfu.d.ts.map +1 -0
- package/src/core/cache/wtinylfu/CacheWTinylfu.js +807 -0
- package/src/core/cache/wtinylfu/benchmark/CacheWTinylfu.bench.md +243 -0
- package/src/core/cache/wtinylfu/wtinylfuDecisions.d.ts +80 -0
- package/src/core/cache/wtinylfu/wtinylfuDecisions.d.ts.map +1 -0
- package/src/core/cache/wtinylfu/wtinylfuDecisions.js +102 -0
- package/src/core/collection/RingBuffer.d.ts.map +1 -1
- package/src/core/collection/RingBuffer.js +15 -3
- package/src/core/collection/map/HashMap.d.ts +1 -1
- package/src/core/collection/map/HashMap.d.ts.map +1 -1
- package/src/core/collection/map/HashMap.js +5 -17
- package/src/core/geom/2d/line/line2_compute_segment_point_distance_sqr.d.ts.map +1 -1
- package/src/core/geom/2d/line/line2_compute_segment_point_distance_sqr.js +5 -0
- package/src/core/geom/ConicRay.d.ts.map +1 -1
- package/src/core/geom/ConicRay.js +9 -2
- package/src/core/geom/Quaternion.d.ts.map +1 -1
- package/src/core/geom/Quaternion.js +7 -3
- package/src/core/math/build_gaussian_kernel_1d.d.ts +2 -2
- package/src/core/math/build_gaussian_kernel_1d.d.ts.map +1 -1
- package/src/core/math/build_gaussian_kernel_1d.js +4 -2
- package/src/core/math/build_gaussian_kernel_2d.d.ts +2 -2
- package/src/core/math/build_gaussian_kernel_2d.d.ts.map +1 -1
- package/src/core/math/build_gaussian_kernel_2d.js +4 -2
- package/src/core/math/gaussian.d.ts +2 -2
- package/src/core/math/gaussian.js +2 -2
- package/src/core/math/spline/spline3_bezier_bounds.d.ts.map +1 -1
- package/src/core/math/spline/spline3_bezier_bounds.js +10 -3
- package/src/core/math/spline/spline3_bezier_to_hermite.d.ts +8 -7
- package/src/core/math/spline/spline3_bezier_to_hermite.d.ts.map +1 -1
- package/src/core/math/spline/spline3_bezier_to_hermite.js +13 -12
- package/src/core/math/spline/spline3_hermite_bounds.d.ts.map +1 -1
- package/src/core/math/spline/spline3_hermite_bounds.js +10 -3
- package/src/core/math/spline/spline3_hermite_bounds_t.d.ts.map +1 -1
- package/src/core/math/spline/spline3_hermite_bounds_t.js +115 -109
- package/src/core/math/spline/spline3_hermite_to_bezier.d.ts +2 -0
- package/src/core/math/spline/spline3_hermite_to_bezier.d.ts.map +1 -1
- package/src/core/math/spline/spline3_hermite_to_bezier.js +2 -0
- package/src/core/math/statistics/computeStatisticalMean.js +1 -1
- package/src/core/math/statistics/gaussian_amplitude.d.ts.map +1 -1
- package/src/core/math/statistics/gaussian_amplitude.js +3 -1
- package/src/engine/animation/clip/ecd_bind_animation_curve.d.ts.map +1 -1
- package/src/engine/animation/clip/ecd_bind_animation_curve.js +10 -1
- package/src/engine/animation/clip/hemisphere_align_quaternion_values.d.ts +20 -0
- package/src/engine/animation/clip/hemisphere_align_quaternion_values.d.ts.map +1 -0
- package/src/engine/animation/clip/hemisphere_align_quaternion_values.js +37 -0
- package/src/engine/animation/keyed2/AnimationTrackPlayback.d.ts.map +1 -1
- package/src/engine/animation/keyed2/AnimationTrackPlayback.js +5 -1
- package/src/engine/ecs/EntityComponentDataset.d.ts.map +1 -1
- package/src/engine/ecs/EntityComponentDataset.js +5 -21
- package/src/engine/ecs/fow/FogOfWar.d.ts +22 -0
- package/src/engine/ecs/fow/FogOfWar.d.ts.map +1 -1
- package/src/engine/ecs/fow/FogOfWar.js +202 -54
- package/src/engine/ecs/fow/FogOfWarEdgeMode.d.ts +16 -0
- package/src/engine/ecs/fow/FogOfWarEdgeMode.d.ts.map +1 -0
- package/src/engine/ecs/fow/FogOfWarEdgeMode.js +39 -0
- package/src/engine/ecs/fow/FogOfWarSystem.d.ts.map +1 -1
- package/src/engine/ecs/fow/FogOfWarSystem.js +1 -0
- package/src/engine/ecs/fow/serialization/FogOfWarSerializationAdapter.d.ts.map +1 -1
- package/src/engine/ecs/fow/serialization/FogOfWarSerializationAdapter.js +3 -0
- package/src/engine/ecs/fow/shader/FogOfWarRenderer.d.ts +7 -0
- package/src/engine/ecs/fow/shader/FogOfWarRenderer.d.ts.map +1 -1
- package/src/engine/ecs/fow/shader/FogOfWarRenderer.js +155 -145
- package/src/engine/ecs/fow/shader/screenSpaceFogOfWarShader.d.ts.map +1 -1
- package/src/engine/ecs/fow/shader/screenSpaceFogOfWarShader.js +33 -8
- package/src/engine/ecs/storage/binary/collection/BinaryCollectionDeSerializer.d.ts.map +1 -1
- package/src/engine/ecs/storage/binary/collection/BinaryCollectionDeSerializer.js +3 -1
- package/src/engine/graphics/GraphicsEngine.d.ts +5 -1
- package/src/engine/graphics/GraphicsEngine.d.ts.map +1 -1
- package/src/engine/graphics/GraphicsEngine.js +14 -3
- package/src/engine/graphics/composit/CompositLayer.d.ts.map +1 -1
- package/src/engine/graphics/composit/CompositLayer.js +258 -255
- package/src/engine/graphics/composit/LayerCompositer.d.ts +12 -0
- package/src/engine/graphics/composit/LayerCompositer.d.ts.map +1 -1
- package/src/engine/graphics/composit/LayerCompositer.js +19 -10
- package/src/engine/graphics/ecs/highlight/plugin/OutlineRenderPlugin.d.ts +1 -1
- package/src/engine/graphics/ecs/highlight/plugin/OutlineRenderPlugin.d.ts.map +1 -1
- package/src/engine/graphics/ecs/highlight/plugin/OutlineRenderPlugin.js +10 -4
- package/src/engine/graphics/ecs/highlight/renderer/OutlineRenderer.d.ts +6 -0
- package/src/engine/graphics/ecs/highlight/renderer/OutlineRenderer.d.ts.map +1 -1
- package/src/engine/graphics/ecs/highlight/renderer/OutlineRenderer.js +21 -0
- package/src/engine/graphics/ecs/path/ribbon/RibbonPathBuilder.d.ts.map +1 -1
- package/src/engine/graphics/ecs/path/ribbon/RibbonPathBuilder.js +5 -23
- package/src/engine/graphics/ecs/path/tube/build/estimatePathViaIterativeIntegral.d.ts.map +1 -1
- package/src/engine/graphics/ecs/path/tube/build/estimatePathViaIterativeIntegral.js +6 -4
- package/src/engine/graphics/ecs/water/WaterSystem.d.ts.map +1 -1
- package/src/engine/graphics/ecs/water/WaterSystem.js +9 -3
- package/src/engine/graphics/particles/ecs/ParticleEmitterSystem.d.ts +12 -0
- package/src/engine/graphics/particles/ecs/ParticleEmitterSystem.d.ts.map +1 -1
- package/src/engine/graphics/particles/ecs/ParticleEmitterSystem.js +46 -9
- package/src/engine/graphics/particles/particular/engine/ParticularEngine.d.ts +5 -0
- package/src/engine/graphics/particles/particular/engine/ParticularEngine.d.ts.map +1 -1
- package/src/engine/graphics/particles/particular/engine/ParticularEngine.js +8 -0
- package/src/engine/graphics/particles/particular/engine/shader/MaterialRecord.d.ts +7 -0
- package/src/engine/graphics/particles/particular/engine/shader/MaterialRecord.d.ts.map +1 -1
- package/src/engine/graphics/particles/particular/engine/shader/MaterialRecord.js +8 -0
- package/src/engine/graphics/particles/particular/engine/shader/ShaderManager.d.ts +10 -2
- package/src/engine/graphics/particles/particular/engine/shader/ShaderManager.d.ts.map +1 -1
- package/src/engine/graphics/particles/particular/engine/shader/ShaderManager.js +42 -10
- package/src/engine/graphics/render/buffer/FrameBuffer.d.ts.map +1 -1
- package/src/engine/graphics/render/buffer/FrameBuffer.js +5 -2
- package/src/engine/graphics/render/buffer/simple-fx/ao/AmbientOcclusionPostProcessEffect.d.ts +13 -1
- package/src/engine/graphics/render/buffer/simple-fx/ao/AmbientOcclusionPostProcessEffect.d.ts.map +1 -1
- package/src/engine/graphics/render/buffer/simple-fx/ao/AmbientOcclusionPostProcessEffect.js +40 -7
- package/src/engine/graphics/render/buffer/simple-fx/taa/TemporalSupersamplingRenderPlugin.d.ts.map +1 -1
- package/src/engine/graphics/render/buffer/simple-fx/taa/TemporalSupersamplingRenderPlugin.js +10 -4
- package/src/engine/graphics/render/forward_plus/LightManager.d.ts.map +1 -1
- package/src/engine/graphics/render/forward_plus/LightManager.js +1235 -1232
- package/src/engine/graphics/render/forward_plus/plugin/ForwardPlusRenderingPlugin.d.ts +5 -0
- package/src/engine/graphics/render/forward_plus/plugin/ForwardPlusRenderingPlugin.d.ts.map +1 -1
- package/src/engine/graphics/render/forward_plus/plugin/ForwardPlusRenderingPlugin.js +11 -10
- package/src/engine/graphics/trail/tube/TubeX.d.ts.map +1 -1
- package/src/engine/graphics/trail/tube/TubeX.js +557 -555
- package/src/engine/graphics/trail/x/RibbonXPlugin.d.ts +12 -1
- package/src/engine/graphics/trail/x/RibbonXPlugin.d.ts.map +1 -1
- package/src/engine/graphics/trail/x/RibbonXPlugin.js +15 -8
- package/src/engine/input/ecs/systems/InputControllerSystem.d.ts.map +1 -1
- package/src/engine/input/ecs/systems/InputControllerSystem.js +9 -6
- package/src/engine/navigation/ecs/components/Path.d.ts +5 -2
- package/src/engine/navigation/ecs/components/Path.d.ts.map +1 -1
- package/src/engine/navigation/ecs/components/Path.js +10 -4
- package/src/engine/navigation/ecs/path_following/PathFollowingSystem.js +1 -1
- package/src/engine/physics/fluid/ecs/FluidObstacleSystem.d.ts +4 -4
- package/src/engine/physics/fluid/ecs/FluidSystem.d.ts +3 -3
|
@@ -0,0 +1,279 @@
|
|
|
1
|
+
export class CacheWTinylfu {
|
|
2
|
+
/**
|
|
3
|
+
*
|
|
4
|
+
* @param {number} [maxWeight=Number.POSITIVE_INFINITY] total weight budget of the cache; an element's weight is keyWeigher(key) + valueWeigher(value)
|
|
5
|
+
* @param {number} [promotionThreshold=1] frequency an item must exceed to be promoted out of Trial (Probation)
|
|
6
|
+
* @param {number} [capacityWindow=1] weight cap of the Window region (burst buffer)
|
|
7
|
+
* @param {number} [capacityProtected=1] weight cap of the Protected region (VIP segment of Main)
|
|
8
|
+
* @param {function(key:Key):number} [keyWeigher= key=>0] function to compute weight of a key
|
|
9
|
+
* @param {function(value:Value):number} [valueWeigher= value=>1] function to compute weight of a value
|
|
10
|
+
* @param {function(Key):number} [keyHashFunction]
|
|
11
|
+
* @param {function(Key, Key):boolean} [keyEqualityFunction]
|
|
12
|
+
*/
|
|
13
|
+
constructor({ maxWeight, promotionThreshold, capacityWindow, capacityProtected, keyWeigher, valueWeigher, keyHashFunction, keyEqualityFunction }?: number);
|
|
14
|
+
/**
|
|
15
|
+
* Dispatched when an element is added or its value replaced. send2(key, value)
|
|
16
|
+
* @type {Signal}
|
|
17
|
+
*/
|
|
18
|
+
onSet: Signal;
|
|
19
|
+
/**
|
|
20
|
+
* Dispatched when an element leaves the cache, by eviction or explicit remove. send2(key, value)
|
|
21
|
+
* @type {Signal}
|
|
22
|
+
*/
|
|
23
|
+
onRemoved: Signal;
|
|
24
|
+
/**
|
|
25
|
+
* Dispatched when an element leaves due to capacity, immediately after onRemoved. send2(key, value)
|
|
26
|
+
* @type {Signal}
|
|
27
|
+
*/
|
|
28
|
+
onEvicted: Signal;
|
|
29
|
+
/**
|
|
30
|
+
* Dispatched when admission control turns an element away (reject-guard or lost duel) — it was
|
|
31
|
+
* never stored. Unique to W-TinyLFU. send2(key, value)
|
|
32
|
+
* @type {Signal}
|
|
33
|
+
*/
|
|
34
|
+
onRejected: Signal;
|
|
35
|
+
/**
|
|
36
|
+
* Update the recency & frequency of the cache element
|
|
37
|
+
* @param {CacheElementWTinylfu} element
|
|
38
|
+
* @private
|
|
39
|
+
*/
|
|
40
|
+
private __touch;
|
|
41
|
+
/**
|
|
42
|
+
* Recency + promotion side of an access (no frequency increment).
|
|
43
|
+
* @param {CacheElementWTinylfu} element
|
|
44
|
+
* @private
|
|
45
|
+
*/
|
|
46
|
+
private __onAccess;
|
|
47
|
+
/**
|
|
48
|
+
* Access of a Trial element: promote to Protected if hot enough and it fits, else bump recency.
|
|
49
|
+
* @param {CacheElementWTinylfu} element
|
|
50
|
+
* @private
|
|
51
|
+
*/
|
|
52
|
+
private __onTrialAccess;
|
|
53
|
+
/**
|
|
54
|
+
* Record an access to `element` in the frequency sketch (using its cached key hash).
|
|
55
|
+
* @param {CacheElementWTinylfu} element
|
|
56
|
+
* @private
|
|
57
|
+
*/
|
|
58
|
+
private __incrementSketch;
|
|
59
|
+
/**
|
|
60
|
+
* Estimated access frequency of `element` from the sketch (using its cached key hash).
|
|
61
|
+
* @param {CacheElementWTinylfu} element
|
|
62
|
+
* @returns {number}
|
|
63
|
+
* @private
|
|
64
|
+
*/
|
|
65
|
+
private __frequency;
|
|
66
|
+
/**
|
|
67
|
+
* Is `element` hot enough and small enough to be promoted from Trial to Protected?
|
|
68
|
+
* (frequency above threshold AND fits Protected — contract in {@link shouldPromoteToProtected})
|
|
69
|
+
* @param {CacheElementWTinylfu} element
|
|
70
|
+
* @returns {boolean}
|
|
71
|
+
* @private
|
|
72
|
+
*/
|
|
73
|
+
private __shouldPromoteToProtected;
|
|
74
|
+
/**
|
|
75
|
+
* The admission duel: does the candidate beat the victim on frequency?
|
|
76
|
+
* (contract in {@link winsAdmissionDuel})
|
|
77
|
+
* @param {CacheElementWTinylfu} candidate
|
|
78
|
+
* @param {CacheElementWTinylfu} victim
|
|
79
|
+
* @returns {boolean}
|
|
80
|
+
* @private
|
|
81
|
+
*/
|
|
82
|
+
private __admissionDuel;
|
|
83
|
+
/**
|
|
84
|
+
* Explicitly remove (invalidate) a key. Fires onRemoved, but not onEvicted (not capacity-driven).
|
|
85
|
+
* @param {Key} key
|
|
86
|
+
* @returns {boolean} true if the key was present and removed
|
|
87
|
+
*/
|
|
88
|
+
remove(key: Key): boolean;
|
|
89
|
+
/**
|
|
90
|
+
* Remove all entries. Fires onRemoved for each (explicit removal, so not onEvicted).
|
|
91
|
+
* The frequency sketch is left intact (history decays on its own).
|
|
92
|
+
*/
|
|
93
|
+
clear(): void;
|
|
94
|
+
/**
|
|
95
|
+
* An element's weight: keyWeigher(key) + valueWeigher(value). Asserts each is a non-negative number.
|
|
96
|
+
* @param {Key} key
|
|
97
|
+
* @param {Value} value
|
|
98
|
+
* @returns {number}
|
|
99
|
+
* @private
|
|
100
|
+
*/
|
|
101
|
+
private __computeElementWeight;
|
|
102
|
+
/**
|
|
103
|
+
* Total weight Main (Trial + Protected) is allowed to hold.
|
|
104
|
+
* @returns {number}
|
|
105
|
+
* @private
|
|
106
|
+
*/
|
|
107
|
+
private __mainCapacity;
|
|
108
|
+
/**
|
|
109
|
+
* Would Main exceed its budget once `extraWeight` is added, counting current occupancy?
|
|
110
|
+
* (contract in {@link exceedsMainWeight})
|
|
111
|
+
* @param {number} [extraWeight=0]
|
|
112
|
+
* @returns {boolean}
|
|
113
|
+
* @private
|
|
114
|
+
*/
|
|
115
|
+
private __exceedsMainWeight;
|
|
116
|
+
/**
|
|
117
|
+
* Could `weight` never fit Main, even with Trial fully evicted? (Protected's live weight is the
|
|
118
|
+
* immovable floor — contract in {@link cannotFitMain}.)
|
|
119
|
+
* @param {number} weight
|
|
120
|
+
* @returns {boolean}
|
|
121
|
+
* @private
|
|
122
|
+
*/
|
|
123
|
+
private __cannotFitMain;
|
|
124
|
+
/**
|
|
125
|
+
* Decide where an element of `weight` is routed on admission: Reject, Window, or Trial.
|
|
126
|
+
* (contract in {@link classifyAdmission})
|
|
127
|
+
* @param {number} weight
|
|
128
|
+
* @returns {number} one of AdmissionRoute
|
|
129
|
+
* @private
|
|
130
|
+
*/
|
|
131
|
+
private __classifyAdmission;
|
|
132
|
+
/**
|
|
133
|
+
* Demote a Protected element to Trial. Pure relocation — the caller restores Main's budget.
|
|
134
|
+
* @param {CacheElementWTinylfu} element
|
|
135
|
+
* @private
|
|
136
|
+
*/
|
|
137
|
+
private __demoteToTrial;
|
|
138
|
+
/**
|
|
139
|
+
* Refit a grown Protected element
|
|
140
|
+
* @param {CacheElementWTinylfu} element
|
|
141
|
+
* @param {number} newWeight
|
|
142
|
+
* @param {number} delta
|
|
143
|
+
* @returns {boolean} whether `element` survived
|
|
144
|
+
* @private
|
|
145
|
+
*/
|
|
146
|
+
private __refitGrownProtected;
|
|
147
|
+
/**
|
|
148
|
+
* Refit a grown Trial element
|
|
149
|
+
* @param {CacheElementWTinylfu} element
|
|
150
|
+
* @param {number} newWeight
|
|
151
|
+
* @param {number} delta
|
|
152
|
+
* @returns {boolean} whether `element` survived
|
|
153
|
+
* @private
|
|
154
|
+
*/
|
|
155
|
+
private __refitGrownTrial;
|
|
156
|
+
/**
|
|
157
|
+
* Refit a grown Window element
|
|
158
|
+
* @param {CacheElementWTinylfu} element
|
|
159
|
+
* @param {number} newWeight
|
|
160
|
+
* @param {number} delta
|
|
161
|
+
* @returns {boolean} whether `element` survived
|
|
162
|
+
* @private
|
|
163
|
+
*/
|
|
164
|
+
private __refitGrownWindow;
|
|
165
|
+
/**
|
|
166
|
+
* Route an update to an existing key: shrink/same-weight applies in place, a growth dispatches to the
|
|
167
|
+
* region's refit handler. On survival, commits the new value and counts the access.
|
|
168
|
+
* @param {CacheElementWTinylfu} element
|
|
169
|
+
* @param {Value} newValue
|
|
170
|
+
* @private
|
|
171
|
+
*/
|
|
172
|
+
private __routeUpdate;
|
|
173
|
+
/**
|
|
174
|
+
* Relocate a resident into Trial (already removed from its prior region by the caller).
|
|
175
|
+
* @param {CacheElementWTinylfu} movedElement
|
|
176
|
+
* @private
|
|
177
|
+
*/
|
|
178
|
+
private __moveToTrial;
|
|
179
|
+
/**
|
|
180
|
+
* First-time admission: place a new element in `region`, register it in the lookup map,
|
|
181
|
+
* and record its frequency.
|
|
182
|
+
* @param {CacheElementWTinylfu} element
|
|
183
|
+
* @param {CacheRegionType} region
|
|
184
|
+
* @private
|
|
185
|
+
*/
|
|
186
|
+
private __admit;
|
|
187
|
+
/**
|
|
188
|
+
* Remove an element from its region's list and the lookup map. Always fires onRemoved; also fires
|
|
189
|
+
* onEvicted when capacity-driven (`evicted`, the default), but not for manual removal.
|
|
190
|
+
* @param {CacheElementWTinylfu} element
|
|
191
|
+
* @param {number} [weight=element.weight]
|
|
192
|
+
* @param {boolean} [evicted=true] true for capacity eviction, false for explicit removal
|
|
193
|
+
* @private
|
|
194
|
+
*/
|
|
195
|
+
private __evict;
|
|
196
|
+
/**
|
|
197
|
+
* @param {CacheElementWTinylfu} element
|
|
198
|
+
* @returns {CacheRegionWTinylfu}
|
|
199
|
+
* @private
|
|
200
|
+
*/
|
|
201
|
+
private __regionOf;
|
|
202
|
+
/**
|
|
203
|
+
* Earn `element` a place in Trial: if Main is over budget, duel it against the Trial LRU victim and,
|
|
204
|
+
* on a win, evict Trial victims until it fits. Verdict only — the caller owns the element's data entry.
|
|
205
|
+
* @param {CacheElementWTinylfu} element
|
|
206
|
+
* @returns {boolean} true if `element` is admitted and space was made for it;
|
|
207
|
+
* false if it lost the admission duel.
|
|
208
|
+
* @private
|
|
209
|
+
*/
|
|
210
|
+
private __prepareTrialSpaceFor;
|
|
211
|
+
/**
|
|
212
|
+
* @returns {CacheElementWTinylfu} Trial's LRU eviction victim
|
|
213
|
+
* @throws
|
|
214
|
+
* if Trial is empty while Main is over capacity (invariant: callers guarantee Trial holds enough evictable weight)
|
|
215
|
+
* @private
|
|
216
|
+
*/
|
|
217
|
+
private __trialEvictionVictim;
|
|
218
|
+
/**
|
|
219
|
+
* Move a Window resident toward Trial through the admission duel; on a loss it is evicted
|
|
220
|
+
* (onRemoved + onEvicted).
|
|
221
|
+
* @param {CacheElementWTinylfu} candidate
|
|
222
|
+
* @param {number} [weight=candidate.weight] weight to reclaim from Window (override when it has changed)
|
|
223
|
+
* @returns {boolean} whether the candidate survived into Trial
|
|
224
|
+
* @private
|
|
225
|
+
*/
|
|
226
|
+
private __nominateWindowToTrial;
|
|
227
|
+
/**
|
|
228
|
+
* Evict Window's LRU residents (nominating each to Trial) until `incomingWeight` fits.
|
|
229
|
+
* @param {number} incomingWeight
|
|
230
|
+
* @private
|
|
231
|
+
*/
|
|
232
|
+
private __makeRoomInWindow;
|
|
233
|
+
/**
|
|
234
|
+
* Admit a new element that is too big for Window straight into the Trial duel; on a loss it is
|
|
235
|
+
* rejected (onRejected) — it was never stored.
|
|
236
|
+
* @param {CacheElementWTinylfu} newElement
|
|
237
|
+
* @private
|
|
238
|
+
*/
|
|
239
|
+
private __nominateDirectToTrial;
|
|
240
|
+
/**
|
|
241
|
+
* Route a brand-new element per classifyAdmission: reject outright, insert into Window, or send it to
|
|
242
|
+
* the Trial duel.
|
|
243
|
+
* @param {CacheElementWTinylfu} newElement
|
|
244
|
+
* @private
|
|
245
|
+
*/
|
|
246
|
+
private __routeAdmission;
|
|
247
|
+
/**
|
|
248
|
+
* Insert a new entry, or update the value of an existing key. The main write entry point.
|
|
249
|
+
* @param {Key} key
|
|
250
|
+
* @param {Value} value
|
|
251
|
+
*/
|
|
252
|
+
put(key: Key, value: Value): void;
|
|
253
|
+
/**
|
|
254
|
+
* Look up a key. A hit counts as an access (recency + frequency, and may trigger promotion).
|
|
255
|
+
* @param {Key} key
|
|
256
|
+
* @returns {Value|null} the cached value, or null if not found
|
|
257
|
+
*/
|
|
258
|
+
get(key: Key): Value | null;
|
|
259
|
+
/**
|
|
260
|
+
* @internal Diagnostic for tests/monitoring: which region currently holds `key`, or null if absent.
|
|
261
|
+
* Returns the immutable {@link CacheRegionType} — it does NOT expose the element itself.
|
|
262
|
+
* @param {Key} key
|
|
263
|
+
* @returns {CacheRegionType|null}
|
|
264
|
+
*/
|
|
265
|
+
inspectRegion(key: Key): CacheRegionType | null;
|
|
266
|
+
/**
|
|
267
|
+
* @internal Diagnostic for tests/monitoring: the live weight currently held by each region.
|
|
268
|
+
* @returns {{window: number, trial: number, protected: number}}
|
|
269
|
+
*/
|
|
270
|
+
inspectWeights(): {
|
|
271
|
+
window: number;
|
|
272
|
+
trial: number;
|
|
273
|
+
protected: number;
|
|
274
|
+
};
|
|
275
|
+
#private;
|
|
276
|
+
}
|
|
277
|
+
import { Signal } from "../../events/signal/Signal.js";
|
|
278
|
+
import { CacheRegionType } from "./CacheRegionType.js";
|
|
279
|
+
//# sourceMappingURL=CacheWTinylfu.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CacheWTinylfu.d.ts","sourceRoot":"","sources":["../../../../../src/core/cache/wtinylfu/CacheWTinylfu.js"],"names":[],"mappings":"AAiDA;IA0FI;;;;;;;;;;OAUG;IACH,mJATW,MAAM,EA+DhB;IA1FD;;;OAGG;IACH,OAFU,MAAM,CAEK;IAErB;;;OAGG;IACH,WAFU,MAAM,CAES;IAEzB;;;OAGG;IACH,WAFU,MAAM,CAES;IAEzB;;;;OAIG;IACH,YAFU,MAAM,CAEU;IAqE1B;;;;OAIG;IACH,gBAGC;IAED;;;;OAIG;IACH,mBAcC;IACD;;;;OAIG;IACH,wBAsBC;IAED;;;;OAIG;IACH,0BAEC;IAED;;;;;OAKG;IACH,oBAEC;IAED;;;;;;OAMG;IACH,mCAEC;IAED;;;;;;;OAOG;IACH,wBAEC;IAED;;;;OAIG;IACH,kBAFa,OAAO,CAUnB;IAED;;;OAGG;IACH,cASC;IAED;;;;;;OAMG;IACH,+BAUC;IAED;;;;OAIG;IACH,uBAEC;IAED;;;;;;OAMG;IACH,4BAEC;IAED;;;;;;OAMG;IACH,wBAEC;IAED;;;;;;OAMG;IACH,4BAEC;IAED;;;;OAIG;IACH,wBAIC;IAED;;;;;;;OAOG;IACH,8BAmBC;IAED;;;;;;;OAOG;IACH,0BAeC;IAED;;;;;;;OAOG;IACH,2BAwBC;IAED;;;;;;OAMG;IACH,sBAkCC;IAED;;;;OAIG;IACH,sBAGC;IAED;;;;;;OAMG;IACH,gBAQC;IAED;;;;;;;OAOG;IACH,gBASC;IAoBD;;;;OAIG;IACH,mBAOC;IAED;;;;;;;OAOG;IACH,+BAgBC;IAED;;;;;OAKG;IACH,8BAMC;IAED;;;;;;;OAOG;IACH,gCAcC;IAED;;;;OAIG;IACH,2BASC;IAED;;;;;OAKG;IACH,gCAQC;IAED;;;;;OAKG;IACH,yBAmBC;IAED;;;;OAIG;IACH,kCAkBC;IAED;;;;OAIG;IACH,eAFa,QAAM,IAAI,CAWtB;IAID;;;;;OAKG;IACH,yBAFa,eAAe,GAAC,IAAI,CAKhC;IAED;;;OAGG;IACH,kBAFa;QAAC,QAAQ,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,CAAA;KAAC,CAQ9D;;CACJ;uBA9vBoB,+BAA+B;gCARtB,sBAAsB"}
|