MCPcopy
hub / github.com/Effect-TS/effect / FibersIn

Class FibersIn

packages/effect/src/internal/supervisor.ts:233–281  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

231}
232
233class FibersIn implements Supervisor.Supervisor<SortedSet.SortedSet<Fiber.RuntimeFiber<any, any>>> {
234 readonly [SupervisorTypeId] = supervisorVariance
235
236 constructor(readonly ref: MutableRef.MutableRef<SortedSet.SortedSet<Fiber.RuntimeFiber<any, any>>>) {
237 }
238
239 get value(): Effect.Effect<SortedSet.SortedSet<Fiber.RuntimeFiber<any, any>>> {
240 return core.sync(() => MutableRef.get(this.ref))
241 }
242
243 onStart<A, E, R>(
244 _context: Context.Context<R>,
245 _effect: Effect.Effect<A, E, R>,
246 _parent: Option.Option<Fiber.RuntimeFiber<any, any>>,
247 fiber: Fiber.RuntimeFiber<A, E>
248 ): void {
249 pipe(this.ref, MutableRef.set(pipe(MutableRef.get(this.ref), SortedSet.add(fiber))))
250 }
251
252 onEnd<A, E>(_value: Exit.Exit<A, E>, fiber: Fiber.RuntimeFiber<A, E>): void {
253 pipe(this.ref, MutableRef.set(pipe(MutableRef.get(this.ref), SortedSet.remove(fiber))))
254 }
255
256 onEffect<A, E>(_fiber: Fiber.RuntimeFiber<A, E>, _effect: Effect.Effect<any, any, any>): void {
257 //
258 }
259
260 onSuspend<A, E>(_fiber: Fiber.RuntimeFiber<A, E>): void {
261 //
262 }
263
264 onResume<A, E>(_fiber: Fiber.RuntimeFiber<A, E>): void {
265 //
266 }
267
268 map<B>(f: (a: SortedSet.SortedSet<Fiber.RuntimeFiber<any, any>>) => B): Supervisor.Supervisor<B> {
269 return new ProxySupervisor(this, pipe(this.value, core.map(f)))
270 }
271
272 zip<A>(
273 right: Supervisor.Supervisor<A>
274 ): Supervisor.Supervisor<[SortedSet.SortedSet<Fiber.RuntimeFiber<any, any>>, A]> {
275 return new Zip(this, right)
276 }
277
278 onRun<E, A, X>(execution: () => X, _fiber: Fiber.RuntimeFiber<A, E>): X {
279 return execution()
280 }
281}
282
283/** @internal */
284export const unsafeTrack = (): Supervisor.Supervisor<Array<Fiber.RuntimeFiber<any, any>>> => {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected