@chronon-sim/engine 0.1.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/LICENSE +202 -0
- package/README.md +19 -0
- package/dist/components/autoscaler.d.ts +47 -0
- package/dist/components/autoscaler.d.ts.map +1 -0
- package/dist/components/autoscaler.js +116 -0
- package/dist/components/autoscaler.js.map +1 -0
- package/dist/components/generator.d.ts +32 -0
- package/dist/components/generator.d.ts.map +1 -0
- package/dist/components/generator.js +124 -0
- package/dist/components/generator.js.map +1 -0
- package/dist/components/index.d.ts +14 -0
- package/dist/components/index.d.ts.map +1 -0
- package/dist/components/index.js +11 -0
- package/dist/components/index.js.map +1 -0
- package/dist/components/message-queue.d.ts +45 -0
- package/dist/components/message-queue.d.ts.map +1 -0
- package/dist/components/message-queue.js +152 -0
- package/dist/components/message-queue.js.map +1 -0
- package/dist/components/pullable.d.ts +24 -0
- package/dist/components/pullable.d.ts.map +1 -0
- package/dist/components/pullable.js +2 -0
- package/dist/components/pullable.js.map +1 -0
- package/dist/components/queue.d.ts +32 -0
- package/dist/components/queue.d.ts.map +1 -0
- package/dist/components/queue.js +88 -0
- package/dist/components/queue.js.map +1 -0
- package/dist/components/rate-limiter.d.ts +24 -0
- package/dist/components/rate-limiter.d.ts.map +1 -0
- package/dist/components/rate-limiter.js +77 -0
- package/dist/components/rate-limiter.js.map +1 -0
- package/dist/components/registry.d.ts +19 -0
- package/dist/components/registry.d.ts.map +1 -0
- package/dist/components/registry.js +43 -0
- package/dist/components/registry.js.map +1 -0
- package/dist/components/retry-policy.d.ts +41 -0
- package/dist/components/retry-policy.d.ts.map +1 -0
- package/dist/components/retry-policy.js +122 -0
- package/dist/components/retry-policy.js.map +1 -0
- package/dist/components/server.d.ts +26 -0
- package/dist/components/server.d.ts.map +1 -0
- package/dist/components/server.js +82 -0
- package/dist/components/server.js.map +1 -0
- package/dist/components/sink.d.ts +12 -0
- package/dist/components/sink.d.ts.map +1 -0
- package/dist/components/sink.js +35 -0
- package/dist/components/sink.js.map +1 -0
- package/dist/components/worker-pool.d.ts +68 -0
- package/dist/components/worker-pool.d.ts.map +1 -0
- package/dist/components/worker-pool.js +224 -0
- package/dist/components/worker-pool.js.map +1 -0
- package/dist/format/definition.d.ts +72 -0
- package/dist/format/definition.d.ts.map +1 -0
- package/dist/format/definition.js +17 -0
- package/dist/format/definition.js.map +1 -0
- package/dist/format/index.d.ts +5 -0
- package/dist/format/index.d.ts.map +1 -0
- package/dist/format/index.js +3 -0
- package/dist/format/index.js.map +1 -0
- package/dist/format/loader.d.ts +19 -0
- package/dist/format/loader.d.ts.map +1 -0
- package/dist/format/loader.js +275 -0
- package/dist/format/loader.js.map +1 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +9 -0
- package/dist/index.js.map +1 -0
- package/dist/kernel/heap.d.ts +14 -0
- package/dist/kernel/heap.d.ts.map +1 -0
- package/dist/kernel/heap.js +55 -0
- package/dist/kernel/heap.js.map +1 -0
- package/dist/kernel/index.d.ts +3 -0
- package/dist/kernel/index.d.ts.map +1 -0
- package/dist/kernel/index.js +2 -0
- package/dist/kernel/index.js.map +1 -0
- package/dist/kernel/kernel.d.ts +104 -0
- package/dist/kernel/kernel.d.ts.map +1 -0
- package/dist/kernel/kernel.js +236 -0
- package/dist/kernel/kernel.js.map +1 -0
- package/dist/model/entity.d.ts +78 -0
- package/dist/model/entity.d.ts.map +1 -0
- package/dist/model/entity.js +108 -0
- package/dist/model/entity.js.map +1 -0
- package/dist/model/fifo.d.ts +9 -0
- package/dist/model/fifo.d.ts.map +1 -0
- package/dist/model/fifo.js +24 -0
- package/dist/model/fifo.js.map +1 -0
- package/dist/model/index.d.ts +4 -0
- package/dist/model/index.d.ts.map +1 -0
- package/dist/model/index.js +3 -0
- package/dist/model/index.js.map +1 -0
- package/dist/rng/distributions.d.ts +98 -0
- package/dist/rng/distributions.d.ts.map +1 -0
- package/dist/rng/distributions.js +224 -0
- package/dist/rng/distributions.js.map +1 -0
- package/dist/rng/index.d.ts +4 -0
- package/dist/rng/index.d.ts.map +1 -0
- package/dist/rng/index.js +3 -0
- package/dist/rng/index.js.map +1 -0
- package/dist/rng/rng.d.ts +26 -0
- package/dist/rng/rng.d.ts.map +1 -0
- package/dist/rng/rng.js +101 -0
- package/dist/rng/rng.js.map +1 -0
- package/dist/run/assertions.d.ts +9 -0
- package/dist/run/assertions.d.ts.map +1 -0
- package/dist/run/assertions.js +57 -0
- package/dist/run/assertions.js.map +1 -0
- package/dist/run/index.d.ts +6 -0
- package/dist/run/index.d.ts.map +1 -0
- package/dist/run/index.js +4 -0
- package/dist/run/index.js.map +1 -0
- package/dist/run/results.d.ts +72 -0
- package/dist/run/results.d.ts.map +1 -0
- package/dist/run/results.js +2 -0
- package/dist/run/results.js.map +1 -0
- package/dist/run/run.d.ts +29 -0
- package/dist/run/run.d.ts.map +1 -0
- package/dist/run/run.js +80 -0
- package/dist/run/run.js.map +1 -0
- package/dist/run/simulation.d.ts +34 -0
- package/dist/run/simulation.d.ts.map +1 -0
- package/dist/run/simulation.js +104 -0
- package/dist/run/simulation.js.map +1 -0
- package/dist/schema/index.d.ts +5 -0
- package/dist/schema/index.d.ts.map +1 -0
- package/dist/schema/index.js +3 -0
- package/dist/schema/index.js.map +1 -0
- package/dist/schema/types.d.ts +83 -0
- package/dist/schema/types.d.ts.map +1 -0
- package/dist/schema/types.js +19 -0
- package/dist/schema/types.js.map +1 -0
- package/dist/schema/validate.d.ts +19 -0
- package/dist/schema/validate.d.ts.map +1 -0
- package/dist/schema/validate.js +120 -0
- package/dist/schema/validate.js.map +1 -0
- package/dist/stats/index.d.ts +6 -0
- package/dist/stats/index.d.ts.map +1 -0
- package/dist/stats/index.js +4 -0
- package/dist/stats/index.js.map +1 -0
- package/dist/stats/percentile.d.ts +38 -0
- package/dist/stats/percentile.d.ts.map +1 -0
- package/dist/stats/percentile.js +62 -0
- package/dist/stats/percentile.js.map +1 -0
- package/dist/stats/summary.d.ts +20 -0
- package/dist/stats/summary.d.ts.map +1 -0
- package/dist/stats/summary.js +38 -0
- package/dist/stats/summary.js.map +1 -0
- package/dist/stats/time-weighted.d.ts +31 -0
- package/dist/stats/time-weighted.d.ts.map +1 -0
- package/dist/stats/time-weighted.js +69 -0
- package/dist/stats/time-weighted.js.map +1 -0
- package/package.json +41 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
package/README.md
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# @chronon-sim/engine
|
|
2
|
+
|
|
3
|
+
The simulation engine behind Chronon Sim. It runs in Node and in a Web Worker: no DOM or Node APIs and no runtime
|
|
4
|
+
dependencies.
|
|
5
|
+
|
|
6
|
+
```ts
|
|
7
|
+
import { loadModel, runModel } from "@chronon-sim/engine";
|
|
8
|
+
|
|
9
|
+
const loaded = loadModel(modelJson); // validates; returns every error at once
|
|
10
|
+
if (loaded.ok) {
|
|
11
|
+
const results = runModel(loaded.model); // replications, confidence intervals, time series, assertions
|
|
12
|
+
console.log(results.outputs);
|
|
13
|
+
}
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
Models are plain, versioned JSON; see the [model format](https://github.com/NiloyBhattacharjee/chronon-sim/blob/main/docs/model-format.md). To run models from the
|
|
17
|
+
command line use [`@chronon-sim/cli`](https://www.npmjs.com/package/@chronon-sim/cli).
|
|
18
|
+
|
|
19
|
+
Part of [Chronon Sim](https://github.com/NiloyBhattacharjee/chronon-sim). Apache-2.0.
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { LinkedComponent, type ComponentInit, type SimContext } from "../model/index.js";
|
|
2
|
+
import type { ComponentSchema } from "../schema/index.js";
|
|
3
|
+
/** Something whose concurrency an {@link Autoscaler} can change (a WorkerPool). */
|
|
4
|
+
export interface Scalable {
|
|
5
|
+
readonly concurrency: number;
|
|
6
|
+
setConcurrency(n: number): void;
|
|
7
|
+
/** Cumulative busy-worker-ticks since time 0, unaffected by the warm-up statistics reset. */
|
|
8
|
+
busyWorkerTicks(): number;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Target-tracking autoscaler for a WorkerPool (like AWS target tracking or a Kubernetes HPA).
|
|
12
|
+
*
|
|
13
|
+
* Every `evaluationInterval` seconds it measures the average number of busy workers over that
|
|
14
|
+
* interval and computes `desired = ceil(averageBusy / targetUtilisation)`, clamped to
|
|
15
|
+
* `[minConcurrency, maxConcurrency]`.
|
|
16
|
+
*
|
|
17
|
+
* - **Scale out** takes effect after `scaleUpDelay` seconds (provisioning time). While a scale-out is
|
|
18
|
+
* pending, only a larger desired value schedules another.
|
|
19
|
+
* - **Scale in** is immediate but only allowed `scaleDownCooldown` seconds after the last scaling
|
|
20
|
+
* change, so a brief lull does not shed capacity that a spike needs a minute later.
|
|
21
|
+
*
|
|
22
|
+
* Because saturation caps measured busy workers at the current limit, a saturated pool grows by
|
|
23
|
+
* a factor of `1 / targetUtilisation` per evaluation until demand is met.
|
|
24
|
+
*/
|
|
25
|
+
export declare class Autoscaler extends LinkedComponent {
|
|
26
|
+
static readonly schema: ComponentSchema<Autoscaler>;
|
|
27
|
+
private readonly targetUtilisation;
|
|
28
|
+
private readonly intervalTicks;
|
|
29
|
+
private readonly min;
|
|
30
|
+
private readonly max;
|
|
31
|
+
private readonly upDelayTicks;
|
|
32
|
+
private readonly cooldownTicks;
|
|
33
|
+
private pool;
|
|
34
|
+
private lastBusyTicks;
|
|
35
|
+
private lastEvalTick;
|
|
36
|
+
private lastChangeTick;
|
|
37
|
+
private pendingTarget;
|
|
38
|
+
private desired;
|
|
39
|
+
private scaleOuts;
|
|
40
|
+
private scaleIns;
|
|
41
|
+
constructor(ctx: SimContext, init: ComponentInit);
|
|
42
|
+
setLink(key: string, target: LinkedComponent): void;
|
|
43
|
+
start(): void;
|
|
44
|
+
private evaluate;
|
|
45
|
+
resetStatistics(): void;
|
|
46
|
+
}
|
|
47
|
+
//# sourceMappingURL=autoscaler.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"autoscaler.d.ts","sourceRoot":"","sources":["../../src/components/autoscaler.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,KAAK,aAAa,EAAE,KAAK,UAAU,EAAE,MAAM,mBAAmB,CAAC;AACzF,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAE1D,mFAAmF;AACnF,MAAM,WAAW,QAAQ;IACvB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,cAAc,CAAC,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC,6FAA6F;IAC7F,eAAe,IAAI,MAAM,CAAC;CAC3B;AAED;;;;;;;;;;;;;;GAcG;AACH,qBAAa,UAAW,SAAQ,eAAe;IAC7C,MAAM,CAAC,QAAQ,CAAC,MAAM,EAAE,eAAe,CAAC,UAAU,CAAC,CAkBjD;IAEF,OAAO,CAAC,QAAQ,CAAC,iBAAiB,CAAS;IAC3C,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAS;IACvC,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAS;IAC7B,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAS;IAC7B,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAS;IACtC,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAS;IACvC,OAAO,CAAC,IAAI,CAAyB;IACrC,OAAO,CAAC,aAAa,CAAK;IAC1B,OAAO,CAAC,YAAY,CAAS;IAC7B,OAAO,CAAC,cAAc,CAA4B;IAClD,OAAO,CAAC,aAAa,CAAK;IAC1B,OAAO,CAAC,OAAO,CAAK;IACpB,OAAO,CAAC,SAAS,CAAK;IACtB,OAAO,CAAC,QAAQ,CAAK;gBAET,GAAG,EAAE,UAAU,EAAE,IAAI,EAAE,aAAa;IAavC,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,eAAe,GAAG,IAAI;IAKnD,KAAK,IAAI,IAAI;IAQtB,OAAO,CAAC,QAAQ;IAiCP,eAAe,IAAI,IAAI;CAKjC"}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import { Priority } from "../kernel/index.js";
|
|
2
|
+
import { LinkedComponent } from "../model/index.js";
|
|
3
|
+
/**
|
|
4
|
+
* Target-tracking autoscaler for a WorkerPool (like AWS target tracking or a Kubernetes HPA).
|
|
5
|
+
*
|
|
6
|
+
* Every `evaluationInterval` seconds it measures the average number of busy workers over that
|
|
7
|
+
* interval and computes `desired = ceil(averageBusy / targetUtilisation)`, clamped to
|
|
8
|
+
* `[minConcurrency, maxConcurrency]`.
|
|
9
|
+
*
|
|
10
|
+
* - **Scale out** takes effect after `scaleUpDelay` seconds (provisioning time). While a scale-out is
|
|
11
|
+
* pending, only a larger desired value schedules another.
|
|
12
|
+
* - **Scale in** is immediate but only allowed `scaleDownCooldown` seconds after the last scaling
|
|
13
|
+
* change, so a brief lull does not shed capacity that a spike needs a minute later.
|
|
14
|
+
*
|
|
15
|
+
* Because saturation caps measured busy workers at the current limit, a saturated pool grows by
|
|
16
|
+
* a factor of `1 / targetUtilisation` per evaluation until demand is met.
|
|
17
|
+
*/
|
|
18
|
+
export class Autoscaler extends LinkedComponent {
|
|
19
|
+
static schema = {
|
|
20
|
+
type: "Autoscaler",
|
|
21
|
+
description: "Target-tracking autoscaler: resizes a WorkerPool's concurrency from its measured utilisation.",
|
|
22
|
+
roles: [],
|
|
23
|
+
inputs: [
|
|
24
|
+
{ key: "targetUtilisation", type: "number", unit: "dimensionless", min: 0.05, max: 1, default: 0.6, required: false, description: "Busy workers / concurrency to aim for." },
|
|
25
|
+
{ key: "evaluationInterval", type: "number", unit: "time", min: 0.000001, default: 60, required: false, description: "Seconds between scaling decisions (and the metric averaging window)." },
|
|
26
|
+
{ key: "minConcurrency", type: "integer", unit: "dimensionless", min: 1, default: 1, required: false, description: "Never scale below this." },
|
|
27
|
+
{ key: "maxConcurrency", type: "integer", unit: "dimensionless", min: 1, required: true, description: "Never scale above this." },
|
|
28
|
+
{ key: "scaleUpDelay", type: "number", unit: "time", min: 0, default: 0, required: false, description: "Seconds before added capacity becomes available." },
|
|
29
|
+
{ key: "scaleDownCooldown", type: "number", unit: "time", min: 0, default: 300, required: false, description: "Minimum seconds since the last scaling change before scaling in." },
|
|
30
|
+
],
|
|
31
|
+
links: [{ key: "target", description: "The WorkerPool to scale.", required: true, accepts: "scalable" }],
|
|
32
|
+
outputs: [
|
|
33
|
+
{ key: "ScaleOuts", unit: "dimensionless", description: "Scale-out decisions applied.", get: (a) => a.scaleOuts },
|
|
34
|
+
{ key: "ScaleIns", unit: "dimensionless", description: "Scale-in decisions applied.", get: (a) => a.scaleIns },
|
|
35
|
+
{ key: "DesiredConcurrency", unit: "dimensionless", series: true, description: "The most recent desired concurrency.", get: (a) => a.desired },
|
|
36
|
+
],
|
|
37
|
+
};
|
|
38
|
+
targetUtilisation;
|
|
39
|
+
intervalTicks;
|
|
40
|
+
min;
|
|
41
|
+
max;
|
|
42
|
+
upDelayTicks;
|
|
43
|
+
cooldownTicks;
|
|
44
|
+
pool = null;
|
|
45
|
+
lastBusyTicks = 0;
|
|
46
|
+
lastEvalTick;
|
|
47
|
+
lastChangeTick = Number.NEGATIVE_INFINITY;
|
|
48
|
+
pendingTarget = 0;
|
|
49
|
+
desired = 0;
|
|
50
|
+
scaleOuts = 0;
|
|
51
|
+
scaleIns = 0;
|
|
52
|
+
constructor(ctx, init) {
|
|
53
|
+
super(ctx, init, "Idle");
|
|
54
|
+
const i = init.inputs;
|
|
55
|
+
const k = ctx.kernel;
|
|
56
|
+
this.targetUtilisation = i["targetUtilisation"];
|
|
57
|
+
this.intervalTicks = Math.max(1, k.secondsToTicks(i["evaluationInterval"]));
|
|
58
|
+
this.min = i["minConcurrency"];
|
|
59
|
+
this.max = Math.max(this.min, i["maxConcurrency"]);
|
|
60
|
+
this.upDelayTicks = k.secondsToTicks(i["scaleUpDelay"]);
|
|
61
|
+
this.cooldownTicks = k.secondsToTicks(i["scaleDownCooldown"]);
|
|
62
|
+
this.lastEvalTick = k.currentTick;
|
|
63
|
+
}
|
|
64
|
+
setLink(key, target) {
|
|
65
|
+
if (key === "target")
|
|
66
|
+
this.pool = target;
|
|
67
|
+
else
|
|
68
|
+
super.setLink(key, target);
|
|
69
|
+
}
|
|
70
|
+
start() {
|
|
71
|
+
if (this.pool === null)
|
|
72
|
+
return;
|
|
73
|
+
this.desired = this.pool.concurrency;
|
|
74
|
+
this.pendingTarget = this.pool.concurrency;
|
|
75
|
+
this.lastBusyTicks = this.pool.busyWorkerTicks();
|
|
76
|
+
this.ctx.kernel.schedule(this.intervalTicks, Priority.LOW, () => this.evaluate());
|
|
77
|
+
}
|
|
78
|
+
evaluate() {
|
|
79
|
+
const pool = this.pool;
|
|
80
|
+
const k = this.ctx.kernel;
|
|
81
|
+
const now = k.currentTick;
|
|
82
|
+
const busyTicks = pool.busyWorkerTicks();
|
|
83
|
+
const averageBusy = (busyTicks - this.lastBusyTicks) / Math.max(1, now - this.lastEvalTick);
|
|
84
|
+
this.lastBusyTicks = busyTicks;
|
|
85
|
+
this.lastEvalTick = now;
|
|
86
|
+
const desired = Math.min(this.max, Math.max(this.min, Math.ceil(averageBusy / this.targetUtilisation - 1e-9)));
|
|
87
|
+
this.desired = desired;
|
|
88
|
+
const current = pool.concurrency;
|
|
89
|
+
if (desired > Math.max(current, this.pendingTarget)) {
|
|
90
|
+
this.pendingTarget = desired;
|
|
91
|
+
this.setState("ScalingOut");
|
|
92
|
+
k.schedule(this.upDelayTicks, Priority.HIGH, () => {
|
|
93
|
+
if (desired > pool.concurrency) {
|
|
94
|
+
pool.setConcurrency(desired);
|
|
95
|
+
this.scaleOuts++;
|
|
96
|
+
this.lastChangeTick = k.currentTick;
|
|
97
|
+
}
|
|
98
|
+
this.pendingTarget = pool.concurrency;
|
|
99
|
+
this.setState("Idle");
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
else if (desired < current && this.pendingTarget <= current && now - this.lastChangeTick >= this.cooldownTicks) {
|
|
103
|
+
pool.setConcurrency(desired);
|
|
104
|
+
this.pendingTarget = desired;
|
|
105
|
+
this.scaleIns++;
|
|
106
|
+
this.lastChangeTick = now;
|
|
107
|
+
}
|
|
108
|
+
k.schedule(this.intervalTicks, Priority.LOW, () => this.evaluate());
|
|
109
|
+
}
|
|
110
|
+
resetStatistics() {
|
|
111
|
+
super.resetStatistics();
|
|
112
|
+
this.scaleOuts = 0;
|
|
113
|
+
this.scaleIns = 0;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
//# sourceMappingURL=autoscaler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"autoscaler.js","sourceRoot":"","sources":["../../src/components/autoscaler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,eAAe,EAAuC,MAAM,mBAAmB,CAAC;AAWzF;;;;;;;;;;;;;;GAcG;AACH,MAAM,OAAO,UAAW,SAAQ,eAAe;IAC7C,MAAM,CAAU,MAAM,GAAgC;QACpD,IAAI,EAAE,YAAY;QAClB,WAAW,EAAE,+FAA+F;QAC5G,KAAK,EAAE,EAAE;QACT,MAAM,EAAE;YACN,EAAE,GAAG,EAAE,mBAAmB,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,eAAe,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,EAAE,OAAO,EAAE,GAAG,EAAE,QAAQ,EAAE,KAAK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Ac,IAAI,IAAI,CAAC,aAAa,EAAE,CAAC;YACjH,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC;YAC7B,IAAI,CAAC,aAAa,GAAG,OAAO,CAAC;YAC7B,IAAI,CAAC,QAAQ,EAAE,CAAC;YAChB,IAAI,CAAC,cAAc,GAAG,GAAG,CAAC;QAC5B,CAAC;QACD,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,aAAa,EAAE,QAAQ,CAAC,GAAG,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC;IACtE,CAAC;IAEQ,eAAe;QACtB,KAAK,CAAC,eAAe,EAAE,CAAC;QACxB,IAAI,CAAC,SAAS,GAAG,CAAC,CAAC;QACnB,IAAI,CAAC,QAAQ,GAAG,CAAC,CAAC;IACpB,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { LinkedComponent, type ComponentInit, type SimContext } from "../model/index.js";
|
|
2
|
+
import { type ComponentSchema } from "../schema/index.js";
|
|
3
|
+
/**
|
|
4
|
+
* Produces arrivals and sends them to `next`.
|
|
5
|
+
*
|
|
6
|
+
* - `interval` mode: the first arrival happens at `firstArrivalTime` (default 0), then one every
|
|
7
|
+
* `interArrivalTime` samples.
|
|
8
|
+
* - `rateProfile` mode: a non-homogeneous Poisson process whose rate is piecewise constant.
|
|
9
|
+
* Generated exactly per segment (memorylessness of the exponential). The process starts at
|
|
10
|
+
* `firstArrivalTime`; before the first segment's start the rate is 0; the last segment
|
|
11
|
+
* continues forever.
|
|
12
|
+
*/
|
|
13
|
+
export declare class EntityGenerator extends LinkedComponent {
|
|
14
|
+
static readonly schema: ComponentSchema<EntityGenerator>;
|
|
15
|
+
private readonly mode;
|
|
16
|
+
private readonly interArrival;
|
|
17
|
+
private readonly firstArrival;
|
|
18
|
+
private readonly profile;
|
|
19
|
+
private readonly unitExp;
|
|
20
|
+
private readonly maxNumber;
|
|
21
|
+
private profileSeconds;
|
|
22
|
+
private generated;
|
|
23
|
+
constructor(ctx: SimContext, init: ComponentInit);
|
|
24
|
+
start(): void;
|
|
25
|
+
private scheduleAtSeconds;
|
|
26
|
+
private finish;
|
|
27
|
+
private arrive;
|
|
28
|
+
private scheduleNextProfileArrival;
|
|
29
|
+
/** Time (seconds) of the next arrival strictly generated after `from`, or null if the rate is 0 forever. */
|
|
30
|
+
private nextProfileArrival;
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=generator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generator.d.ts","sourceRoot":"","sources":["../../src/components/generator.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAE,KAAK,aAAa,EAAE,KAAK,UAAU,EAAE,MAAM,mBAAmB,CAAC;AACzF,OAAO,EAA4B,KAAK,eAAe,EAAoB,MAAM,oBAAoB,CAAC;AAEtG;;;;;;;;;GASG;AACH,qBAAa,eAAgB,SAAQ,eAAe;IAClD,MAAM,CAAC,QAAQ,CAAC,MAAM,EAAE,eAAe,CAAC,eAAe,CAAC,CAetD;IAEF,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAS;IAC9B,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAwB;IACrD,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAiB;IAC9C,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAgB;IACxC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAiB;IACzC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAqB;IAC/C,OAAO,CAAC,cAAc,CAAK;IAC3B,OAAO,CAAC,SAAS,CAAK;gBAEV,GAAG,EAAE,UAAU,EAAE,IAAI,EAAE,aAAa;IAWvC,KAAK,IAAI,IAAI;IAWtB,OAAO,CAAC,iBAAiB;IAMzB,OAAO,CAAC,MAAM;IAId,OAAO,CAAC,MAAM;IAed,OAAO,CAAC,0BAA0B;IAOlC,4GAA4G;IAC5G,OAAO,CAAC,kBAAkB;CAyB3B"}
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import { Priority } from "../kernel/index.js";
|
|
2
|
+
import { ExponentialSampler } from "../rng/index.js";
|
|
3
|
+
import { LinkedComponent } from "../model/index.js";
|
|
4
|
+
import { asRateProfile, asSampler } from "../schema/index.js";
|
|
5
|
+
/**
|
|
6
|
+
* Produces arrivals and sends them to `next`.
|
|
7
|
+
*
|
|
8
|
+
* - `interval` mode: the first arrival happens at `firstArrivalTime` (default 0), then one every
|
|
9
|
+
* `interArrivalTime` samples.
|
|
10
|
+
* - `rateProfile` mode: a non-homogeneous Poisson process whose rate is piecewise constant.
|
|
11
|
+
* Generated exactly per segment (memorylessness of the exponential). The process starts at
|
|
12
|
+
* `firstArrivalTime`; before the first segment's start the rate is 0; the last segment
|
|
13
|
+
* continues forever.
|
|
14
|
+
*/
|
|
15
|
+
export class EntityGenerator extends LinkedComponent {
|
|
16
|
+
static schema = {
|
|
17
|
+
type: "EntityGenerator",
|
|
18
|
+
description: "Generates arriving entities, either at sampled intervals or from a time-varying Poisson rate profile.",
|
|
19
|
+
roles: ["source"],
|
|
20
|
+
inputs: [
|
|
21
|
+
{ key: "mode", type: "enum", unit: "dimensionless", options: ["interval", "rateProfile"], default: "interval", required: false, description: "Arrival mode." },
|
|
22
|
+
{ key: "interArrivalTime", type: "sampler", unit: "time", min: 0, required: false, requiredWhen: { input: "mode", equals: "interval" }, description: "Time between arrivals (seconds). Interval mode." },
|
|
23
|
+
{ key: "rateProfile", type: "rateProfile", unit: "rate", required: false, requiredWhen: { input: "mode", equals: "rateProfile" }, description: "Piecewise-constant Poisson rate: [[startSeconds, ratePerSecond], ...]. RateProfile mode." },
|
|
24
|
+
{ key: "firstArrivalTime", type: "sampler", unit: "time", min: 0, default: 0, required: false, description: "Time of the first arrival (interval mode) or start of the process (rateProfile mode), in seconds." },
|
|
25
|
+
{ key: "maxNumber", type: "integer", unit: "dimensionless", min: 0, required: false, description: "Stop after generating this many entities. Unlimited if omitted." },
|
|
26
|
+
],
|
|
27
|
+
links: [{ key: "next", description: "Where generated entities are sent.", required: false, accepts: "receiver" }],
|
|
28
|
+
outputs: [
|
|
29
|
+
{ key: "NumberGenerated", unit: "dimensionless", description: "Entities generated.", get: (c) => c.numberAdded },
|
|
30
|
+
],
|
|
31
|
+
};
|
|
32
|
+
mode;
|
|
33
|
+
interArrival;
|
|
34
|
+
firstArrival;
|
|
35
|
+
profile;
|
|
36
|
+
unitExp;
|
|
37
|
+
maxNumber;
|
|
38
|
+
profileSeconds = 0;
|
|
39
|
+
generated = 0;
|
|
40
|
+
constructor(ctx, init) {
|
|
41
|
+
super(ctx, init, "Waiting");
|
|
42
|
+
const i = init.inputs;
|
|
43
|
+
this.mode = i["mode"];
|
|
44
|
+
this.interArrival = i["interArrivalTime"] !== undefined ? this.makeSampler(asSampler(i["interArrivalTime"]), "interArrivalTime") : null;
|
|
45
|
+
this.firstArrival = this.makeSampler(asSampler(i["firstArrivalTime"]), "firstArrivalTime");
|
|
46
|
+
this.profile = i["rateProfile"] !== undefined ? asRateProfile(i["rateProfile"]) : [];
|
|
47
|
+
this.unitExp = new ExponentialSampler(ctx.rng(`${this.stream}/arrivals`), 1);
|
|
48
|
+
this.maxNumber = i["maxNumber"];
|
|
49
|
+
}
|
|
50
|
+
start() {
|
|
51
|
+
if (this.maxNumber === 0)
|
|
52
|
+
return this.finish();
|
|
53
|
+
const first = Math.max(0, this.firstArrival.nextSample());
|
|
54
|
+
if (this.mode === "interval") {
|
|
55
|
+
this.scheduleAtSeconds(first);
|
|
56
|
+
}
|
|
57
|
+
else {
|
|
58
|
+
this.profileSeconds = first;
|
|
59
|
+
this.scheduleNextProfileArrival();
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
scheduleAtSeconds(seconds) {
|
|
63
|
+
const k = this.ctx.kernel;
|
|
64
|
+
const delay = Math.max(0, k.secondsToTicks(seconds) - k.currentTick);
|
|
65
|
+
k.schedule(delay, Priority.DEFAULT, () => this.arrive());
|
|
66
|
+
}
|
|
67
|
+
finish() {
|
|
68
|
+
this.setState("Done");
|
|
69
|
+
}
|
|
70
|
+
arrive() {
|
|
71
|
+
this.setState("Generating");
|
|
72
|
+
this.generated++;
|
|
73
|
+
this.noteAdded();
|
|
74
|
+
this.sendToNext(this.ctx.createEntity());
|
|
75
|
+
if (this.maxNumber !== undefined && this.generated >= this.maxNumber)
|
|
76
|
+
return this.finish();
|
|
77
|
+
if (this.mode === "interval") {
|
|
78
|
+
const gap = Math.max(0, this.interArrival.nextSample());
|
|
79
|
+
this.profileSeconds = this.ctx.kernel.currentSeconds + gap;
|
|
80
|
+
this.scheduleAtSeconds(this.profileSeconds);
|
|
81
|
+
}
|
|
82
|
+
else {
|
|
83
|
+
this.scheduleNextProfileArrival();
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
scheduleNextProfileArrival() {
|
|
87
|
+
const t = this.nextProfileArrival(this.profileSeconds);
|
|
88
|
+
if (t === null)
|
|
89
|
+
return this.finish();
|
|
90
|
+
this.profileSeconds = t;
|
|
91
|
+
this.scheduleAtSeconds(t);
|
|
92
|
+
}
|
|
93
|
+
/** Time (seconds) of the next arrival strictly generated after `from`, or null if the rate is 0 forever. */
|
|
94
|
+
nextProfileArrival(from) {
|
|
95
|
+
const segs = this.profile;
|
|
96
|
+
let t = from;
|
|
97
|
+
for (;;) {
|
|
98
|
+
let idx = -1;
|
|
99
|
+
for (let s = 0; s < segs.length; s++) {
|
|
100
|
+
if (segs[s][0] <= t)
|
|
101
|
+
idx = s;
|
|
102
|
+
else
|
|
103
|
+
break;
|
|
104
|
+
}
|
|
105
|
+
if (idx === -1) {
|
|
106
|
+
t = segs[0][0];
|
|
107
|
+
continue;
|
|
108
|
+
}
|
|
109
|
+
const rate = segs[idx][1];
|
|
110
|
+
const end = idx + 1 < segs.length ? segs[idx + 1][0] : Infinity;
|
|
111
|
+
if (rate <= 0) {
|
|
112
|
+
if (end === Infinity)
|
|
113
|
+
return null;
|
|
114
|
+
t = end;
|
|
115
|
+
continue;
|
|
116
|
+
}
|
|
117
|
+
const candidate = t + this.unitExp.nextSample() / rate;
|
|
118
|
+
if (candidate < end)
|
|
119
|
+
return candidate;
|
|
120
|
+
t = end;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
//# sourceMappingURL=generator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generator.js","sourceRoot":"","sources":["../../src/components/generator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,kBAAkB,EAAuB,MAAM,iBAAiB,CAAC;AAC1E,OAAO,EAAE,eAAe,EAAuC,MAAM,mBAAmB,CAAC;AACzF,OAAO,EAAE,aAAa,EAAE,SAAS,EAA0C,MAAM,oBAAoB,CAAC;AAEtG;;;;;;;;;GASG;AACH,MAAM,OAAO,eAAgB,SAAQ,eAAe;IAClD,MAAM,CAAU,MAAM,GAAqC;QACzD,IAAI,EAAE,iBAAiB;QACvB,WAAW,EAAE,uGAAuG;QACpH,KAAK,EAAE,CAAC,QAAQ,CAAC;QACjB,MAAM,EAAE;YACN,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,eAAe,EAAE,OAAO,EAAE,CAAC,UAAU,EAAE,aAAa,CAAC,EAAE,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,KAAK,EAAE,WAAW,EAAE,eAAe,EAAE;YAC9J,EAAE,GAAG,EAAE,kBAAkB,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,EAAE,WAAW,EAAE,iDAAiD,EAAE;YACxM,EAAE,GAAG,EAAE,aAAa,EAAE,IAAI,EAAE,aAAa,EAAE,IAAI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AAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export { EntityGenerator } from "./generator.js";
|
|
2
|
+
export { Queue } from "./queue.js";
|
|
3
|
+
export { MessageQueue } from "./message-queue.js";
|
|
4
|
+
export type { Lease, PullSource, QueueWaiter } from "./pullable.js";
|
|
5
|
+
export { Server } from "./server.js";
|
|
6
|
+
export { WorkerPool } from "./worker-pool.js";
|
|
7
|
+
export { RetryPolicy } from "./retry-policy.js";
|
|
8
|
+
export { RateLimiter } from "./rate-limiter.js";
|
|
9
|
+
export { Autoscaler } from "./autoscaler.js";
|
|
10
|
+
export type { Scalable } from "./autoscaler.js";
|
|
11
|
+
export { EntitySink } from "./sink.js";
|
|
12
|
+
export { ComponentRegistry, createDefaultRegistry } from "./registry.js";
|
|
13
|
+
export type { ComponentClass } from "./registry.js";
|
|
14
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACjD,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,YAAY,EAAE,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AACpE,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,YAAY,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AACvC,OAAO,EAAE,iBAAiB,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC;AACzE,YAAY,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export { EntityGenerator } from "./generator.js";
|
|
2
|
+
export { Queue } from "./queue.js";
|
|
3
|
+
export { MessageQueue } from "./message-queue.js";
|
|
4
|
+
export { Server } from "./server.js";
|
|
5
|
+
export { WorkerPool } from "./worker-pool.js";
|
|
6
|
+
export { RetryPolicy } from "./retry-policy.js";
|
|
7
|
+
export { RateLimiter } from "./rate-limiter.js";
|
|
8
|
+
export { Autoscaler } from "./autoscaler.js";
|
|
9
|
+
export { EntitySink } from "./sink.js";
|
|
10
|
+
export { ComponentRegistry, createDefaultRegistry } from "./registry.js";
|
|
11
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACjD,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAElD,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAE7C,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AACvC,OAAO,EAAE,iBAAiB,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC"}
|