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