@systemfsoftware/effect-daemon-spec 0.7.2 → 2.0.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/CHANGELOG.md +189 -0
- package/LICENSE +203 -21
- package/dist/effect-daemon-spec.d.ts +105 -154
- package/dist/index.d.ts +131 -175
- package/dist/index.mjs +469 -339
- package/package.json +25 -24
package/dist/index.d.ts
CHANGED
|
@@ -1,23 +1,32 @@
|
|
|
1
|
-
import { Cause, Context, Duration, Effect, Layer, Metric, Option, Schedule, Schema, Scope, Stream } from "effect";
|
|
2
|
-
//#region src/
|
|
3
|
-
declare const
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
import { Cause, Context, Duration, Effect, Latch, Layer, Metric, Option, Schedule, Schema, Scope, Stream } from "effect";
|
|
2
|
+
//#region src/Backoff.d.ts
|
|
3
|
+
declare const cappedBackoff: (base: Duration.Input, cap: Duration.Input) => Schedule.Schedule<Duration.Duration>;
|
|
4
|
+
//#endregion
|
|
5
|
+
//#region src/Brands.d.ts
|
|
6
|
+
declare const WorkerTypeId: unique symbol;
|
|
7
|
+
type WorkerTypeId = typeof WorkerTypeId;
|
|
8
|
+
declare const SupervisorTypeId: unique symbol;
|
|
9
|
+
type SupervisorTypeId = typeof SupervisorTypeId;
|
|
10
|
+
declare const DynamicSpecTypeId: unique symbol;
|
|
11
|
+
type DynamicSpecTypeId = typeof DynamicSpecTypeId;
|
|
12
|
+
//#endregion
|
|
13
|
+
//#region src/DaemonHealth.schema.d.ts
|
|
14
|
+
declare const DynamicLimitExceeded_base: Schema.Class<DynamicLimitExceeded, Schema.TaggedStruct<"DynamicLimitExceeded", {
|
|
15
|
+
readonly limit: Schema.Int;
|
|
16
|
+
}>, import("effect/Cause").YieldableError>;
|
|
8
17
|
declare class DynamicLimitExceeded extends DynamicLimitExceeded_base {}
|
|
9
18
|
interface DaemonHealth {
|
|
10
19
|
readonly name: string;
|
|
11
|
-
readonly ready:
|
|
12
|
-
readonly healthy:
|
|
13
|
-
readonly paused:
|
|
20
|
+
readonly ready: Latch.Latch;
|
|
21
|
+
readonly healthy: Latch.Latch;
|
|
22
|
+
readonly paused: Latch.Latch;
|
|
14
23
|
}
|
|
15
24
|
interface SupervisorHealth {
|
|
16
25
|
readonly name: string;
|
|
17
|
-
readonly ready:
|
|
18
|
-
readonly healthy:
|
|
19
|
-
readonly paused:
|
|
20
|
-
readonly children:
|
|
26
|
+
readonly ready: Latch.Latch;
|
|
27
|
+
readonly healthy: Latch.Latch;
|
|
28
|
+
readonly paused: Latch.Latch;
|
|
29
|
+
readonly children: readonly (DaemonHealth | SupervisorHealth)[];
|
|
21
30
|
}
|
|
22
31
|
interface DynamicHandle<Args, R = never> {
|
|
23
32
|
readonly health: SupervisorHealth;
|
|
@@ -30,108 +39,65 @@ type ChildRef = {
|
|
|
30
39
|
readonly removed: Effect.Effect<void>;
|
|
31
40
|
};
|
|
32
41
|
//#endregion
|
|
33
|
-
//#region src/
|
|
34
|
-
declare const
|
|
42
|
+
//#region src/DaemonMetrics.d.ts
|
|
43
|
+
declare const supervisorRestartsCounter: Metric.Counter<number>;
|
|
44
|
+
declare const supervisorExhaustionsCounter: Metric.Counter<number>;
|
|
45
|
+
declare const supervisorChildrenGauge: Metric.Gauge<number>;
|
|
46
|
+
declare const healthStateGauge: Metric.Gauge<number>;
|
|
35
47
|
//#endregion
|
|
36
|
-
//#region src/
|
|
37
|
-
declare const WorkerTypeId: unique symbol;
|
|
38
|
-
type WorkerTypeId = typeof WorkerTypeId;
|
|
39
|
-
declare const SupervisorTypeId: unique symbol;
|
|
40
|
-
type SupervisorTypeId = typeof SupervisorTypeId;
|
|
41
|
-
declare const DynamicSpecTypeId: unique symbol;
|
|
42
|
-
type DynamicSpecTypeId = typeof DynamicSpecTypeId;
|
|
43
|
-
//#endregion
|
|
44
|
-
//#region src/daemon-metrics.kernel.d.ts
|
|
45
|
-
declare const supervisorRestartsCounter: Metric.Metric.Counter<number>;
|
|
46
|
-
declare const supervisorExhaustionsCounter: Metric.Metric.Counter<number>;
|
|
47
|
-
declare const supervisorChildrenGauge: Metric.Metric.Gauge<number>;
|
|
48
|
-
declare const healthStateGauge: Metric.Metric.Gauge<number>;
|
|
49
|
-
//#endregion
|
|
50
|
-
//#region src/daemon-policy.schema.d.ts
|
|
48
|
+
//#region src/DaemonPolicy.schema.d.ts
|
|
51
49
|
declare const IntensityConfig: Schema.Struct<{
|
|
52
|
-
restarts: Schema.
|
|
53
|
-
window:
|
|
50
|
+
readonly restarts: Schema.Int;
|
|
51
|
+
readonly window: Schema.Duration;
|
|
54
52
|
}>;
|
|
55
53
|
type IntensityConfig = typeof IntensityConfig.Type;
|
|
56
54
|
declare const IntensityTypeId: unique symbol;
|
|
57
55
|
type IntensityTypeId = typeof IntensityTypeId;
|
|
58
|
-
declare const BoundedIntensity_base: Schema.
|
|
59
|
-
readonly
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
window: typeof Schema.DurationFromSelf;
|
|
63
|
-
}>>;
|
|
56
|
+
declare const BoundedIntensity_base: Schema.Class<BoundedIntensity, Schema.TaggedStruct<"Bounded", {
|
|
57
|
+
readonly restarts: Schema.Int;
|
|
58
|
+
readonly window: Schema.Duration;
|
|
59
|
+
}>, {}>;
|
|
64
60
|
declare class BoundedIntensity extends BoundedIntensity_base {
|
|
65
61
|
readonly [IntensityTypeId]: symbol;
|
|
66
62
|
}
|
|
67
|
-
declare const UnboundedIntensity_base: Schema.
|
|
68
|
-
readonly _tag: Schema.tag<"Unbounded">;
|
|
69
|
-
}>;
|
|
63
|
+
declare const UnboundedIntensity_base: Schema.Class<UnboundedIntensity, Schema.TaggedStruct<"Unbounded", {}>, {}>;
|
|
70
64
|
declare class UnboundedIntensity extends UnboundedIntensity_base {
|
|
71
65
|
readonly [IntensityTypeId]: symbol;
|
|
72
66
|
}
|
|
73
|
-
declare const Intensity: Schema.Union<[typeof BoundedIntensity, typeof UnboundedIntensity]>;
|
|
67
|
+
declare const Intensity: Schema.Union<readonly [typeof BoundedIntensity, typeof UnboundedIntensity]>;
|
|
74
68
|
type Intensity = typeof Intensity.Type;
|
|
75
|
-
declare const ChildPolicyConfig_base: Schema.Class<ChildPolicyConfig, {
|
|
76
|
-
restart: Schema.optional<Schema.
|
|
77
|
-
intensity: Schema.optional<Schema.Struct<{
|
|
78
|
-
restarts: Schema.
|
|
79
|
-
window:
|
|
69
|
+
declare const ChildPolicyConfig_base: Schema.Class<ChildPolicyConfig, Schema.Struct<{
|
|
70
|
+
readonly restart: Schema.optional<Schema.Literals<readonly ["permanent", "transient", "temporary"]>>;
|
|
71
|
+
readonly intensity: Schema.optional<Schema.Struct<{
|
|
72
|
+
readonly restarts: Schema.Int;
|
|
73
|
+
readonly window: Schema.Duration;
|
|
80
74
|
}>>;
|
|
81
|
-
}
|
|
82
|
-
restart: Schema.optional<Schema.Literal<["permanent", "transient", "temporary"]>>;
|
|
83
|
-
intensity: Schema.optional<Schema.Struct<{
|
|
84
|
-
restarts: Schema.filter<typeof Schema.Int>;
|
|
85
|
-
window: typeof Schema.DurationFromSelf;
|
|
86
|
-
}>>;
|
|
87
|
-
}>, never, {
|
|
88
|
-
readonly restart?: "permanent" | "transient" | "temporary" | undefined;
|
|
89
|
-
} & {
|
|
90
|
-
readonly intensity?: {
|
|
91
|
-
readonly restarts: number;
|
|
92
|
-
readonly window: import("effect/Duration").Duration;
|
|
93
|
-
} | undefined;
|
|
94
|
-
}, {}, {}>;
|
|
75
|
+
}>, {}>;
|
|
95
76
|
declare class ChildPolicyConfig extends ChildPolicyConfig_base {}
|
|
96
|
-
declare const LockPolicyConfig_base: Schema.Class<LockPolicyConfig, {
|
|
97
|
-
mode: Schema.optional<Schema.
|
|
98
|
-
key: Schema.optional<
|
|
99
|
-
}
|
|
100
|
-
mode: Schema.optional<Schema.Literal<["none", "required", "optional"]>>;
|
|
101
|
-
key: Schema.optional<typeof Schema.String>;
|
|
102
|
-
}>, never, {
|
|
103
|
-
readonly mode?: "none" | "required" | "optional" | undefined;
|
|
104
|
-
} & {
|
|
105
|
-
readonly key?: string | undefined;
|
|
106
|
-
}, {}, {}>;
|
|
77
|
+
declare const LockPolicyConfig_base: Schema.Class<LockPolicyConfig, Schema.Struct<{
|
|
78
|
+
readonly mode: Schema.optional<Schema.Literals<readonly ["none", "required", "optional"]>>;
|
|
79
|
+
readonly key: Schema.optional<Schema.String>;
|
|
80
|
+
}>, {}>;
|
|
107
81
|
declare class LockPolicyConfig extends LockPolicyConfig_base {}
|
|
108
|
-
declare const TickPolicyConfig_base: Schema.Class<TickPolicyConfig, {
|
|
109
|
-
spanName: Schema.optional<
|
|
110
|
-
tickTimeout:
|
|
111
|
-
startLogLevel: Schema.optional<Schema.
|
|
112
|
-
}
|
|
113
|
-
spanName: Schema.optional<typeof Schema.String>;
|
|
114
|
-
tickTimeout: typeof Schema.DurationFromSelf;
|
|
115
|
-
startLogLevel: Schema.optional<Schema.Literal<["debug", "info"]>>;
|
|
116
|
-
}>, never, {
|
|
117
|
-
readonly tickTimeout: import("effect/Duration").Duration;
|
|
118
|
-
} & {
|
|
119
|
-
readonly spanName?: string | undefined;
|
|
120
|
-
} & {
|
|
121
|
-
readonly startLogLevel?: "debug" | "info" | undefined;
|
|
122
|
-
}, {}, {}>;
|
|
82
|
+
declare const TickPolicyConfig_base: Schema.Class<TickPolicyConfig, Schema.Struct<{
|
|
83
|
+
readonly spanName: Schema.optional<Schema.String>;
|
|
84
|
+
readonly tickTimeout: Schema.Duration;
|
|
85
|
+
readonly startLogLevel: Schema.optional<Schema.Literals<readonly ["debug", "info"]>>;
|
|
86
|
+
}>, {}>;
|
|
123
87
|
declare class TickPolicyConfig extends TickPolicyConfig_base {}
|
|
88
|
+
declare const MaxChildren: Schema.brand<Schema.Int, "MaxChildren">;
|
|
89
|
+
type MaxChildren = typeof MaxChildren.Type;
|
|
124
90
|
//#endregion
|
|
125
|
-
//#region src/
|
|
91
|
+
//#region src/DaemonReporterAdapter.d.ts
|
|
126
92
|
interface DaemonReporterService {
|
|
127
93
|
readonly onRestart: (name: string, cause: Cause.Cause<never>) => Effect.Effect<void>;
|
|
128
94
|
readonly onExhausted: (name: string, cause: Cause.Cause<never>) => Effect.Effect<void>;
|
|
129
95
|
}
|
|
130
|
-
declare const DaemonReporter_base: Context.
|
|
96
|
+
declare const DaemonReporter_base: Context.ServiceClass<DaemonReporter, "@systemfsoftware/effect-daemon-spec/DaemonReporterAdapter/DaemonReporter", DaemonReporterService>;
|
|
131
97
|
declare class DaemonReporter extends DaemonReporter_base {}
|
|
132
98
|
declare const Noop: Layer.Layer<DaemonReporter>;
|
|
133
99
|
//#endregion
|
|
134
|
-
//#region src/
|
|
100
|
+
//#region src/DaemonSpec.schema.d.ts
|
|
135
101
|
type LockConfig = {
|
|
136
102
|
mode: 'none';
|
|
137
103
|
} | {
|
|
@@ -150,7 +116,7 @@ interface CommonOpts<L extends LockConfig> {
|
|
|
150
116
|
readonly lock: L;
|
|
151
117
|
}
|
|
152
118
|
type PollOpts<A, E, R, L extends LockConfig> = CommonOpts<L> & {
|
|
153
|
-
readonly interval: Duration.
|
|
119
|
+
readonly interval: Duration.Input;
|
|
154
120
|
} & ({
|
|
155
121
|
readonly prereq?: undefined;
|
|
156
122
|
readonly work: Effect.Effect<A, E, R>;
|
|
@@ -161,7 +127,7 @@ type PollOpts<A, E, R, L extends LockConfig> = CommonOpts<L> & {
|
|
|
161
127
|
interface TickPolicyHooks {
|
|
162
128
|
readonly spanAttributes?: Effect.Effect<Record<string, string | number | boolean>>;
|
|
163
129
|
readonly innerRetry?: Schedule.Schedule<unknown>;
|
|
164
|
-
readonly trackDuration?: Metric.
|
|
130
|
+
readonly trackDuration?: Metric.Histogram<Duration.Duration>;
|
|
165
131
|
}
|
|
166
132
|
interface ReporterPolicyHooks {
|
|
167
133
|
readonly onRestart?: (cause: Cause.Cause<never>) => Effect.Effect<void>;
|
|
@@ -170,7 +136,7 @@ interface ReporterPolicyHooks {
|
|
|
170
136
|
type PollLoop<E, R> = {
|
|
171
137
|
readonly _tag: 'Poll';
|
|
172
138
|
readonly gate: Effect.Effect<Option.Option<Effect.Effect<void, E, R>>, E, R>;
|
|
173
|
-
readonly interval: Duration.
|
|
139
|
+
readonly interval: Duration.Input;
|
|
174
140
|
};
|
|
175
141
|
type StreamLoop<E, R> = {
|
|
176
142
|
readonly _tag: 'Stream';
|
|
@@ -194,7 +160,7 @@ interface Supervisor<E, R, L extends LockConfig = LockConfig> {
|
|
|
194
160
|
readonly [SupervisorTypeId]: SupervisorTypeId;
|
|
195
161
|
readonly name: string;
|
|
196
162
|
readonly strategy: 'one_for_one' | 'one_for_all' | 'rest_for_one';
|
|
197
|
-
readonly children:
|
|
163
|
+
readonly children: readonly (Worker<E, R> | Supervisor<E, R>)[];
|
|
198
164
|
readonly supervision: Effect.Effect<SupervisionPolicy>;
|
|
199
165
|
readonly lock: L;
|
|
200
166
|
readonly reporter: ReporterPolicyHooks;
|
|
@@ -203,106 +169,83 @@ interface DynamicSpec<E, R, Args> {
|
|
|
203
169
|
readonly [DynamicSpecTypeId]: DynamicSpecTypeId;
|
|
204
170
|
readonly name: string;
|
|
205
171
|
readonly child: (args: Args) => Worker<E, R>;
|
|
206
|
-
readonly maxChildren:
|
|
172
|
+
readonly maxChildren: MaxChildren;
|
|
207
173
|
}
|
|
208
174
|
type Child<E, R> = Worker<E, R> | Supervisor<E, R>;
|
|
209
175
|
interface SupervisionPolicy {
|
|
210
176
|
readonly intensity: Intensity;
|
|
211
177
|
readonly backoff: Schedule.Schedule<Duration.Duration>;
|
|
212
|
-
readonly cooldown: Duration.
|
|
178
|
+
readonly cooldown: Duration.Input;
|
|
213
179
|
}
|
|
214
180
|
interface SupervisionConfig {
|
|
215
|
-
readonly backoffBase: Duration.
|
|
181
|
+
readonly backoffBase: Duration.Input;
|
|
216
182
|
readonly intensity: Intensity;
|
|
217
|
-
readonly cooldown: Duration.
|
|
183
|
+
readonly cooldown: Duration.Input;
|
|
218
184
|
}
|
|
219
185
|
interface SupervisorOpts<E, R, L extends LockConfig> {
|
|
220
186
|
readonly name: string;
|
|
221
|
-
readonly children:
|
|
187
|
+
readonly children: readonly Child<E, R>[];
|
|
222
188
|
readonly supervision: Effect.Effect<SupervisionPolicy>;
|
|
223
189
|
readonly lock: L;
|
|
224
190
|
readonly reporter?: ReporterPolicyHooks;
|
|
225
191
|
}
|
|
226
192
|
//#endregion
|
|
227
|
-
//#region src/
|
|
228
|
-
declare const LeaderLockNotAcquired_base: Schema.
|
|
229
|
-
readonly
|
|
230
|
-
}
|
|
231
|
-
key: typeof Schema.String;
|
|
232
|
-
}>;
|
|
193
|
+
//#region src/LeaderLock.schema.d.ts
|
|
194
|
+
declare const LeaderLockNotAcquired_base: Schema.Class<LeaderLockNotAcquired, Schema.TaggedStruct<"LeaderLockNotAcquired", {
|
|
195
|
+
readonly key: Schema.String;
|
|
196
|
+
}>, import("effect/Cause").YieldableError>;
|
|
233
197
|
declare class LeaderLockNotAcquired extends LeaderLockNotAcquired_base {}
|
|
234
|
-
declare const LeaderLockInfraError_base: Schema.
|
|
235
|
-
readonly
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
cause: typeof Schema.Unknown;
|
|
239
|
-
}>;
|
|
198
|
+
declare const LeaderLockInfraError_base: Schema.Class<LeaderLockInfraError, Schema.TaggedStruct<"LeaderLockInfraError", {
|
|
199
|
+
readonly key: Schema.String;
|
|
200
|
+
readonly cause: Schema.Unknown;
|
|
201
|
+
}>, import("effect/Cause").YieldableError>;
|
|
240
202
|
declare class LeaderLockInfraError extends LeaderLockInfraError_base {}
|
|
241
203
|
type LeaderLockAcquireError = LeaderLockNotAcquired | LeaderLockInfraError;
|
|
242
204
|
//#endregion
|
|
243
|
-
//#region src/
|
|
244
|
-
declare const LockPrimitiveError_base: Schema.
|
|
245
|
-
readonly
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
cause: typeof Schema.Unknown;
|
|
249
|
-
}>;
|
|
205
|
+
//#region src/LockPrimitive.schema.d.ts
|
|
206
|
+
declare const LockPrimitiveError_base: Schema.Class<LockPrimitiveError, Schema.TaggedStruct<"LockPrimitiveError", {
|
|
207
|
+
readonly key: Schema.String;
|
|
208
|
+
readonly cause: Schema.Unknown;
|
|
209
|
+
}>, import("effect/Cause").YieldableError>;
|
|
250
210
|
declare class LockPrimitiveError extends LockPrimitiveError_base {}
|
|
251
211
|
//#endregion
|
|
252
|
-
//#region src/
|
|
212
|
+
//#region src/LeaderLockAdapter.d.ts
|
|
253
213
|
interface LeaderLockService {
|
|
254
214
|
readonly withLock: <A, E, R>(key: string, self: Effect.Effect<A, E, R>) => Effect.Effect<Option.Option<A>, E | LeaderLockInfraError, R>;
|
|
255
215
|
}
|
|
256
|
-
declare const LeaderLock_base: Context.
|
|
216
|
+
declare const LeaderLock_base: Context.ServiceClass<LeaderLock, "@systemfsoftware/effect-daemon-spec/LeaderLockAdapter/LeaderLock", LeaderLockService>;
|
|
257
217
|
declare class LeaderLock extends LeaderLock_base {
|
|
258
218
|
static readonly Noop: Layer.Layer<LeaderLock>;
|
|
259
219
|
}
|
|
260
220
|
interface LockPrimitiveService {
|
|
261
221
|
readonly tryAcquire: (key: string) => Effect.Effect<boolean, LockPrimitiveError, Scope.Scope>;
|
|
262
222
|
}
|
|
263
|
-
declare const LockPrimitive_base: Context.
|
|
223
|
+
declare const LockPrimitive_base: Context.ServiceClass<LockPrimitive, "@systemfsoftware/effect-daemon-spec/LeaderLockAdapter/LockPrimitive", LockPrimitiveService>;
|
|
264
224
|
declare class LockPrimitive extends LockPrimitive_base {}
|
|
265
225
|
declare const LeaderLockFromPrimitive: Layer.Layer<LeaderLock, never, LockPrimitive>;
|
|
266
226
|
//#endregion
|
|
267
|
-
//#region src/internal/
|
|
227
|
+
//#region src/internal/BuildDynamicExecutor.d.ts
|
|
228
|
+
declare const dynamic$1: <E, R, Args>(spec: DynamicSpec<E, R, Args>) => Effect.Effect<DynamicHandle<Args, R | LeaderLock | DaemonReporter | Scope.Scope>, never, R | LeaderLock | DaemonReporter | Scope.Scope>;
|
|
229
|
+
//#endregion
|
|
230
|
+
//#region src/internal/WithLeaderLockExecutor.d.ts
|
|
268
231
|
interface LeaderLockOptions {
|
|
269
232
|
readonly key: string;
|
|
270
233
|
readonly mode: 'required' | 'optional';
|
|
271
234
|
readonly acquireRetryBackoff?: Schedule.Schedule<Duration.Duration>;
|
|
272
235
|
}
|
|
273
|
-
declare
|
|
274
|
-
readonly withLock: LeaderLock["Type"]["withLock"];
|
|
275
|
-
}>;
|
|
276
|
-
declare class WithLeaderLockExecutorDeps extends WithLeaderLockExecutorDeps_base {}
|
|
277
|
-
declare function withLeaderLock<A, E, R>(self: Effect.Effect<A, E, R>, options: LeaderLockOptions): Effect.Effect<A | void, E | LeaderLockAcquireError, R | WithLeaderLockExecutorDeps>;
|
|
278
|
-
//#endregion
|
|
279
|
-
//#region src/daemon-worker.executor.d.ts
|
|
280
|
-
declare const worker: {
|
|
281
|
-
<E, R>(w: Worker<E, R, {
|
|
282
|
-
mode: 'none';
|
|
283
|
-
}>): Effect.Effect<DaemonHealth, never, R | Scope.Scope>;
|
|
284
|
-
<E, R>(w: Worker<E, R, LockConfig>): Effect.Effect<DaemonHealth, never, R | WithLeaderLockExecutorDeps | Scope.Scope>;
|
|
285
|
-
};
|
|
236
|
+
declare function withLeaderLock<A, E, R>(self: Effect.Effect<A, E, R>, options: LeaderLockOptions, lock: LeaderLock['Service']): Effect.Effect<A | void, E | LeaderLockAcquireError, R>;
|
|
286
237
|
//#endregion
|
|
287
|
-
//#region src/
|
|
288
|
-
declare const
|
|
289
|
-
readonly onRestart: DaemonReporter["Type"]["onRestart"];
|
|
290
|
-
readonly onExhausted: DaemonReporter["Type"]["onExhausted"];
|
|
291
|
-
}>;
|
|
292
|
-
declare class SupervisorBodyExecutorDeps extends SupervisorBodyExecutorDeps_base {}
|
|
293
|
-
declare const supervisor: <E, R>(s: Supervisor<E, R, LockConfig>) => Effect.Effect<SupervisorHealth, never, R | SupervisorBodyExecutorDeps | WithLeaderLockExecutorDeps | Scope.Scope>;
|
|
238
|
+
//#region src/SupervisionCustom.d.ts
|
|
239
|
+
declare const custom: <P>(policy: P) => Effect.Effect<P>;
|
|
294
240
|
//#endregion
|
|
295
|
-
//#region src/internal/
|
|
296
|
-
declare const
|
|
297
|
-
declare class LeaderConfig extends LeaderConfig_base {}
|
|
241
|
+
//#region src/internal/SupervisionLeader.d.ts
|
|
242
|
+
declare const LeaderConfig: Context.Reference<SupervisionConfig>;
|
|
298
243
|
//#endregion
|
|
299
|
-
//#region src/internal/
|
|
300
|
-
declare const
|
|
301
|
-
declare class TaskConfig extends TaskConfig_base {}
|
|
244
|
+
//#region src/internal/SupervisionTask.d.ts
|
|
245
|
+
declare const TaskConfig: Context.Reference<SupervisionConfig>;
|
|
302
246
|
//#endregion
|
|
303
|
-
//#region src/internal/
|
|
304
|
-
declare const
|
|
305
|
-
declare class WorkerConfig extends WorkerConfig_base {}
|
|
247
|
+
//#region src/internal/SupervisionWorker.d.ts
|
|
248
|
+
declare const WorkerConfig: Context.Reference<SupervisionConfig>;
|
|
306
249
|
//#endregion
|
|
307
250
|
//#region src/mod.d.ts
|
|
308
251
|
declare const poll: <A, E, R, L extends LockConfig>(opts: PollOpts<A, E, R, L>) => Worker<E, R, L>;
|
|
@@ -313,42 +256,55 @@ declare const subscription: <A, E, R, L extends LockConfig>(opts: CommonOpts<L>
|
|
|
313
256
|
readonly acquire: Effect.Effect<A, E, R>;
|
|
314
257
|
}) => Worker<E, R, L>;
|
|
315
258
|
declare const Daemon: {
|
|
316
|
-
readonly poll:
|
|
317
|
-
readonly stream:
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
259
|
+
readonly poll: typeof poll;
|
|
260
|
+
readonly stream: typeof stream;
|
|
261
|
+
readonly subscription: typeof subscription;
|
|
262
|
+
};
|
|
263
|
+
/**
|
|
264
|
+
* Boots a worker. The leader-lock capability is acquired here, at the composition
|
|
265
|
+
* root, and handed down as part of the lock binding: the executor behind this
|
|
266
|
+
* entry point never sees the tag. A worker whose lock is `{ mode: 'none' }`
|
|
267
|
+
* takes no lock at all.
|
|
268
|
+
*/
|
|
269
|
+
declare const worker: {
|
|
270
|
+
<E, R>(w: Worker<E, R, {
|
|
271
|
+
mode: 'none';
|
|
272
|
+
}>): Effect.Effect<DaemonHealth, never, R | Scope.Scope>;
|
|
273
|
+
<E, R>(w: Worker<E, R, LockConfig>): Effect.Effect<DaemonHealth, never, R | LeaderLock | Scope.Scope>;
|
|
323
274
|
};
|
|
275
|
+
/**
|
|
276
|
+
* The supervisor: acquires the `DaemonReporter` and — unless the lock mode is none —
|
|
277
|
+
* the `LeaderLock` capabilities at the composition root, then hands them down to the
|
|
278
|
+
* supervisor body via the lock binding. The body itself only ever sees the service
|
|
279
|
+
* values.
|
|
280
|
+
*/
|
|
281
|
+
declare const supervisor: <E, R>(s: Supervisor<E, R, LockConfig>) => Effect.Effect<SupervisorHealth, never, R | DaemonReporter | LeaderLock | Scope.Scope>;
|
|
324
282
|
declare const run: {
|
|
325
283
|
readonly worker: {
|
|
326
284
|
<E, R>(w: Worker<E, R, {
|
|
327
|
-
mode:
|
|
328
|
-
}>): Effect.Effect<DaemonHealth, never, R |
|
|
329
|
-
<E, R>(w: Worker<E, R, LockConfig>): Effect.Effect<DaemonHealth, never, R |
|
|
285
|
+
mode: 'none';
|
|
286
|
+
}>): Effect.Effect<DaemonHealth, never, R | Scope.Scope>;
|
|
287
|
+
<E, R>(w: Worker<E, R, LockConfig>): Effect.Effect<DaemonHealth, never, R | LeaderLock | Scope.Scope>;
|
|
330
288
|
};
|
|
331
|
-
readonly supervisor:
|
|
332
|
-
readonly dynamic:
|
|
289
|
+
readonly supervisor: typeof supervisor;
|
|
290
|
+
readonly dynamic: typeof dynamic$1;
|
|
333
291
|
};
|
|
334
|
-
declare const leader: (cap: Duration.
|
|
335
|
-
declare const task: (budget: Duration.
|
|
336
|
-
declare const supervision: (cap: Duration.
|
|
292
|
+
declare const leader: (cap: Duration.Input) => Effect.Effect<SupervisionPolicy>;
|
|
293
|
+
declare const task: (budget: Duration.Input) => Effect.Effect<SupervisionPolicy>;
|
|
294
|
+
declare const supervision: (cap: Duration.Input) => Effect.Effect<SupervisionPolicy>;
|
|
337
295
|
declare const Supervision: {
|
|
338
|
-
readonly leader:
|
|
339
|
-
readonly worker:
|
|
340
|
-
readonly task:
|
|
341
|
-
readonly custom:
|
|
296
|
+
readonly leader: typeof leader;
|
|
297
|
+
readonly worker: typeof supervision;
|
|
298
|
+
readonly task: typeof task;
|
|
299
|
+
readonly custom: typeof custom;
|
|
342
300
|
};
|
|
343
301
|
declare const dynamic: <E, R, Args>(opts: {
|
|
344
302
|
readonly name: string;
|
|
345
303
|
readonly child: (args: Args) => Worker<E, R>;
|
|
346
|
-
readonly maxChildren?:
|
|
304
|
+
readonly maxChildren?: MaxChildren;
|
|
347
305
|
}) => DynamicSpec<E, R, Args>;
|
|
348
306
|
declare const oneForAll: <E, R, L extends LockConfig = LockConfig>(opts: SupervisorOpts<E, R, L>) => Supervisor<E, R, L>;
|
|
349
307
|
declare const oneForOne: <E, R, L extends LockConfig = LockConfig>(opts: SupervisorOpts<E, R, L>) => Supervisor<E, R, L>;
|
|
350
308
|
declare const restForOne: <E, R, L extends LockConfig = LockConfig>(opts: SupervisorOpts<E, R, L>) => Supervisor<E, R, L>;
|
|
351
|
-
declare const WithLeaderLockExecutorLive: Layer.Layer<WithLeaderLockExecutorDeps, never, LeaderLock>;
|
|
352
|
-
declare const SupervisorBodyExecutorLive: Layer.Layer<SupervisorBodyExecutorDeps, never, DaemonReporter>;
|
|
353
309
|
//#endregion
|
|
354
|
-
export { BoundedIntensity, Child, ChildPolicyConfig, ChildRef, CommonOpts, Daemon, DaemonHealth, DaemonReporter, DaemonReporterService, DynamicHandle, DynamicLimitExceeded, DynamicSpec, DynamicSpecTypeId, Intensity, IntensityConfig, LeaderConfig, LeaderLock, LeaderLockAcquireError, LeaderLockFromPrimitive, LeaderLockInfraError, LeaderLockNotAcquired, type LeaderLockOptions, LeaderLockService, LockConfig, LockPolicyConfig, LockPrimitive, LockPrimitiveError, LockPrimitiveService, LoopShape, Noop, PollLoop, PollOpts, ReporterPolicyHooks, StreamLoop, SubscriptionLoop, Supervision, SupervisionConfig, SupervisionPolicy, Supervisor,
|
|
310
|
+
export { BoundedIntensity, Child, ChildPolicyConfig, ChildRef, CommonOpts, Daemon, DaemonHealth, DaemonReporter, DaemonReporterService, DynamicHandle, DynamicLimitExceeded, DynamicSpec, DynamicSpecTypeId, Intensity, IntensityConfig, LeaderConfig, LeaderLock, LeaderLockAcquireError, LeaderLockFromPrimitive, LeaderLockInfraError, LeaderLockNotAcquired, type LeaderLockOptions, LeaderLockService, LockConfig, LockPolicyConfig, LockPrimitive, LockPrimitiveError, LockPrimitiveService, LoopShape, MaxChildren, Noop, PollLoop, PollOpts, ReporterPolicyHooks, StreamLoop, SubscriptionLoop, Supervision, SupervisionConfig, SupervisionPolicy, Supervisor, SupervisorHealth, SupervisorOpts, SupervisorTypeId, TaskConfig, TickPolicyConfig, TickPolicyHooks, UnboundedIntensity, Worker, WorkerConfig, WorkerTypeId, cappedBackoff, dynamic, healthStateGauge, leader, oneForAll, oneForOne, poll, restForOne, run, stream, subscription, supervision, supervisor, supervisorChildrenGauge, supervisorExhaustionsCounter, supervisorRestartsCounter, task, withLeaderLock, worker };
|