import { RuntimeFlags } from "@effect/core/io/RuntimeFlags/definition"; import { Fiber } from "@effect/core/io/Fiber/definition"; import { FiberRefs } from "@effect/core/io/FiberRefs/definition"; import { FiberId } from "@effect/core/io/FiberId/definition"; import { HashSet } from "@tsplus/stdlib/collections/HashSet/definition"; import { MutableQueue } from "@tsplus/stdlib/collections/mutable/MutableQueue/definition"; import { List } from "@tsplus/stdlib/collections/List/definition"; import { Exit } from "@effect/core/io/Exit/definition"; import { Stack } from "@tsplus/stdlib/data/Stack"; import { Effect } from "@effect/core/io/Effect/definition"; import { Deferred } from "@effect/core/io/Deferred/definition"; import { Either } from "@tsplus/stdlib/data/Either/definition"; import { Chunk } from "@tsplus/stdlib/collections/Chunk/definition"; import { Cause } from "@effect/core/io/Cause/definition"; import { Maybe } from "@tsplus/stdlib/data/Maybe/definition"; import { FiberScope } from "@effect/core/io/FiberScope/definition"; import { LogLevel } from "@effect/core/io/LogLevel/definition"; import { AtomicReference } from "@tsplus/stdlib/data/AtomicReference"; import { LazyArg } from "@tsplus/stdlib/data/Function"; import { InterruptStatus } from "@effect/core/io/InterruptStatus/definition"; import { Scope } from "@effect/core/io/Scope/definition"; import { Differ } from "@tsplus/stdlib/data/Differ/definition"; import { Service } from "@tsplus/stdlib/service/Service"; import { Supervisor } from "@effect/core/io/Supervisor/definition"; import { Env } from "@tsplus/stdlib/service/Env"; import { ImmutableMap } from "@tsplus/stdlib/collections/ImmutableMap/definition"; import { LogSpan } from "@effect/core/io/LogSpan/definition"; import { Tag } from "@tsplus/stdlib/service/Tag"; import { Logger } from "@effect/core/io/Logger/definition"; import { DeferredState } from "@effect/core/io/Deferred/_internal/DeferredState"; import { DeferredSym } from "@effect/core/io/Deferred/definition"; import type { IOnFailure, IOnSuccess, IOnSuccessAndFailure, IWhileLoop } from "@effect/core/io/Effect/definition/primitives"; import type { FiberMessage } from "@effect/core/io/Fiber/_internal/message"; import { _A, _E, FiberSym } from "@effect/core/io/Fiber/definition"; import { _Patch, _Value, FiberRef, FiberRefSym } from "@effect/core/io/FiberRef/definition"; import type { Scheduler } from "@effect/core/support/Scheduler"; export type EvaluationSignal = "Continue" | "Done" | "YieldNow"; export declare const currentFiber: import("@tsplus/stdlib/data/AtomicReference").AtomicReference | null>; export type Continuation = IOnSuccess | IOnSuccessAndFailure | IOnFailure | IWhileLoop | RevertFlags; export declare class RevertFlags { readonly patch: RuntimeFlags.Patch; readonly _tag = "RevertFlags"; constructor(patch: RuntimeFlags.Patch); } export declare class FiberRuntime implements Fiber.Runtime { readonly [FiberSym]: FiberSym; readonly [_E]: () => E; readonly [_A]: () => A; readonly _tag = "RuntimeFiber"; private _fiberRefs; private _fiberId; private _runtimeFlags; constructor(fiberId: FiberId.Runtime, fiberRefs0: FiberRefs, runtimeFlags0: RuntimeFlags); private _queue; private _children; private _observers; private _running; private _stack; private _asyncInterruptor; private _asyncBlockingOn; private _exitValue; /** * Returns an effect that will contain information computed from the fiber * state and status while running on the fiber. * * This allows the outside world to interact safely with mutable fiber state * without locks or immutable data. */ ask(f: (fiber: FiberRuntime, status: Fiber.Status) => Z): Effect; /** * Awaits the fiber, which suspends the awaiting fiber until the result of the * fiber has been determined. */ get await(): import("../../Effect").Effect>; tell(message: FiberMessage): void; /** * Retrieves the immediate children of the fiber. */ get children(): import("../../Effect").Effect>>; /** * Retrieves the whole set of fiber refs. */ get fiberRefs(): import("../../Effect").Effect; /** * The identity of the fiber. */ get id(): import("../../FiberId").RuntimeFiberId; /** * Inherits values from all [[FiberRef]] instances into current fiber. This * will resume immediately. */ get inheritAll(): import("../../Effect").Effect; /** * In the background, interrupts the fiber as if interrupted from the * specified fiber. If the fiber has already exited, the returned effect will * resume immediately. Otherwise, the effect will resume when the fiber exits. */ interruptAsFork(fiberId: FiberId): import("../../Effect").Effect; /** * Tentatively observes the fiber, but returns immediately if it is not * already done. */ get poll(): import("../../Effect").Effect>>; /** * Tentatively observes the fiber, but returns immediately if it is not * already done. */ get unsafePoll(): import("../../Exit").Exit | null; private run; /** * Gets the fiber runtime flags. */ get runtimeFlags(): import("../../Effect").Effect; /** * Gets a fiber scope */ get scope(): import("../../FiberScope").FiberScope; /** * The status of the fiber. */ get status(): import("../../Effect").Effect; /** * Adds a reference to the specified fiber inside the children set. * * '''NOTE''': This method must be invoked by the fiber itself. */ addChild(child: FiberRuntime): void; /** * Removes a reference to the specified fiber inside the children set. * * '''NOTE''': This method must be invoked by the fiber itself. */ removeChild(child: FiberRuntime): void; /** * Adds an interruptor to the set of interruptors that are interrupting this * fiber. * * '''NOTE''': This method must be invoked by the fiber itself. */ addInterruptedCause(cause: Cause): void; /** * Adds an observer to the list of observers. * * '''NOTE''': This method must be invoked by the fiber itself. */ addObserver(observer: (exit: Exit) => void): void; /** * Deletes the specified fiber ref. * * '''NOTE''': This method must be invoked by the fiber itself. */ deleteFiberRef(fiberRef: FiberRef): void; /** * On the current thread, executes all messages in the fiber's inbox. This * method may return before all work is done, in the event the fiber executes * an asynchronous operation. * * '''NOTE''': This method must be invoked by the fiber itself. */ drainQueueOnCurrentThread(): void; /** * Schedules the execution of all messages in the fiber's inbox. * * This method will return immediately after the scheduling * operation is completed, but potentially before such messages have been * executed. * * '''NOTE''': This method must be invoked by the fiber itself. */ drainQueueLaterOnExecutor(): void; /** * Drains the fiber's message queue while the fiber is actively running, * returning the next effect to execute, which may be the input effect if no * additional effect needs to be executed. * * '''NOTE''': This method must be invoked by the fiber itself. */ drainQueueWhileRunning(runtimeFlags: RuntimeFlags, cur0: Effect): import("../../Effect").Effect; /** * Processes a new incoming interrupt signal. * * '''NOTE''': This method must be invoked by the fiber itself. */ processNewInterruptSignal(cause: Cause): void; /** * Interrupts all children of the current fiber, returning an effect that will * await the exit of the children. This method will return null if the fiber * has no children. * * '''NOTE''': This method must be invoked by the fiber itself. */ sendInterruptSignalToAllChildren(): boolean; /** * Retrieves the state of the fiber ref, or else its initial value. * * '''NOTE''': This method is safe to invoke on any fiber, but if not invoked * on this fiber, then values derived from the fiber's state (including the * log annotations and log level) may not be up-to-date. */ getFiberRef(fiberRef: FiberRef): A; /** * Gets the fiber's children set */ get getChildren(): Set>; /** * Wholesale gets all fiber refs of this fiber. */ get getFiberRefs(): import("../../FiberRefs").FiberRefs; /** * Evaluates a single message on the current thread, while the fiber is * suspended. This method should only be called while evaluation of the * fiber's effect is suspended due to an asynchronous operation. * * '''NOTE''': This method must be invoked by the fiber itself. */ evaluateMessageWhileSuspended(message: FiberMessage): EvaluationSignal; /** * Determines if the fiber is interrupted. * * '''NOTE''': This method is safe to invoke on any fiber, but if not invoked * on this fiber, then values derived from the fiber's state (including the * log annotations and log level) may not be up-to-date. */ get isInterrupted(): boolean; /** * Evaluates an effect until completion, potentially asynchronously. * * '''NOTE''': This method must be invoked by the fiber itself. */ evaluateEffect(effect0: Effect): void; reportExitValue(v: Exit): void; setExitValue(exit: Exit): void; /** * Sets the fiber ref to the specified value. * * '''NOTE''': This method must be invoked by the fiber itself. */ setFiberRef(fiberRef: FiberRef, value: A): void; /** * Wholesale replaces all fiber refs of this fiber. * * '''NOTE''': This method must be invoked by the fiber itself. */ setFiberRefs(fiberRefs: FiberRefs): void; /** * Removes the specified observer from the list of observers that will be * notified when the fiber exits. * * '''NOTE''': This method must be invoked by the fiber itself. */ removeObserver(observer: (exit: Exit) => void): void; /** * Retrieves the current supervisor the fiber uses for supervising effects. * * '''NOTE''': This method is safe to invoke on any fiber, but if not invoked * on this fiber, then values derived from the fiber's state (including the * log annotations and log level) may not be up-to-date. */ get getSupervisor(): import("../../Supervisor").Supervisor; getNextSuccessCont(): IOnSuccessAndFailure | IOnSuccess | IWhileLoop | RevertFlags | undefined; getNextFailCont(): IOnSuccessAndFailure | IOnFailure | RevertFlags | undefined; /** * The main run-loop for evaluating effects. * * '''NOTE''': This method must be invoked by the fiber itself. */ runLoop(effect0: Effect): Exit; /** * Takes the current runtime flags, patches them to return the new runtime * flags, and then makes any changes necessary to fiber state based on the * specified patch. * * '''NOTE''': This method must be invoked by the fiber itself. */ patchRuntimeFlags(oldRuntimeFlags: RuntimeFlags, patch: RuntimeFlags.Patch): import("../../RuntimeFlags").RuntimeFlags; /** * Initiates an asynchronous operation, by building a callback that will * resume execution, and then feeding that callback to the registration * function, handling error cases and repeated resumptions appropriately. * * '''NOTE''': This method must be invoked by the fiber itself. */ initiateAsync(runtimeFlags: RuntimeFlags, asyncRegister: (resume: (effect: Effect) => void) => void): void; /** * Interrupts all children of the current fiber, returning an effect that will * await the exit of the children. This method will return null if the fiber * has no children. * * '''NOTE''': This method must be invoked by the fiber itself. */ interruptAllChildren(): import("../../Effect").Effect | null; /** * Retrieves the interrupted cause of the fiber, which will be `Cause.empty` * if the fiber has not been interrupted. * * '''NOTE''': This method is safe to invoke on any fiber, but if not invoked * on this fiber, then values derived from the fiber's state (including the * log annotations and log level) may not be up-to-date. */ get getInterruptedCause(): import("../../Cause").Cause; /** * Begins execution of the effect associated with this fiber on the current * thread. This can be called to "kick off" execution of a fiber after it has * been created, in hopes that the effect can be executed synchronously. * * This is not the normal way of starting a fiber, but it is useful when the * express goal of executing the fiber is to synchronously produce its exit. */ start(effect: Effect): void; /** * Begins execution of the effect associated with this fiber on in the * background, and on the correct thread pool. This can be called to "kick * off" execution of a fiber after it has been created, in hopes that the * effect can be executed synchronously. */ startFork(effect: Effect): void; /** * Updates a fiber ref belonging to this fiber by using the provided update * function. * * '''NOTE''': This method must be invoked by the fiber itself. */ updateFiberRef(fiberRef: FiberRef, f: (a: A) => A): void; get getLoggers(): import("@tsplus/stdlib/collections/HashSet").HashSet>; /** * Logs using the current set of loggers. * * '''NOTE''': This method is safe to invoke on any fiber, but if not invoked * on this fiber, then values derived from the fiber's state (including the * log annotations and log level) may not be up-to-date. */ log(message: string, cause: Cause, overrideLogLevel: Maybe): void; } /** * Unsafely makes a new `Deferred`. * @tsplus static effect/core/io/Deferred.Ops unsafeMake * @tsplus location "@effect/core/io/Fiber/_internal/runtime" */ export declare function unsafeMakeDeferred(fiberId: FiberId): Deferred; export declare class DeferredInternal { readonly state: AtomicReference>; readonly blockingOn: FiberId; readonly [DeferredSym]: DeferredSym; readonly [_E]: () => E; readonly [_A]: () => A; constructor(state: AtomicReference>, blockingOn: FiberId); /** * Retrieves the value of the promise, suspending the fiber running the action * until the result is available. */ get await(): Effect; /** * Completes the deferred with the result of the specified effect. If the * deferred has already been completed, the method will produce false. * * Note that `Deferred.completeWith` will be much faster, so consider using * that if you do not need to memoize the result of the specified effect. */ complete(this: Deferred, effect: Effect): Effect; /** * Completes the deferred with the result of the specified effect. If the * deferred has already been completed, the method will produce false. * * Note that `Deferred.completeWith` will be much faster, so consider using * that if you do not need to memoize the result of the specified effect. */ completeWith(this: Deferred, effect: Effect): Effect; /** * Kills the promise with the specified error, which will be propagated to all * fibers waiting on the value of the promise. */ die(this: Deferred, defect: unknown): Effect; /** * Kills the promise with the specified error, which will be propagated to all * fibers waiting on the value of the promise. */ dieSync(this: Deferred, defect: LazyArg): Effect; /** * Exits the deferred with the specified exit, which will be propagated to all * fibers waiting on the value of the deferred. */ done(this: Deferred, exit: Exit): Effect; /** * Fails the deferred with the specified error, which will be propagated to all * fibers waiting on the value of the deferred. */ fail(this: Deferred, e: E): Effect; /** * Fails the deferred with the specified error, which will be propagated to all * fibers waiting on the value of the deferred. */ failSync(this: Deferred, e: LazyArg): Effect; /** * Fails the deferred with the specified cause, which will be propagated to all * fibers waiting on the value of the deferred. */ failCause(this: Deferred, cause: LazyArg>): Effect; /** * Fails the deferred with the specified cause, which will be propagated to all * fibers waiting on the value of the deferred. */ failCauseSync(this: Deferred, cause: Cause): Effect; /** * Completes the deferred with interruption. This will interrupt all fibers * waiting on the value of the deferred as by the fiber calling this method. */ get interrupt(): Effect; /** * Completes the deferred with interruption. This will interrupt all fibers * waiting on the value of the deferred as by the fiber calling this method. */ interruptAs(this: Deferred, fiberId: FiberId): Effect; /** * Checks for completion of this `Promise`. Produces true if this promise has * already been completed with a value or an error and false otherwise. */ get isDone(): Effect; /** * Checks for completion of this `Deferred`. Returns the result effect if this * deferred has already been completed or a `None` otherwise. */ get poll(): Effect>>; /** * Completes the deferred with the specified value. */ succeed(this: Deferred, value: A): Effect; /** * Completes the deferred with the specified value. */ sync(this: Deferred, value: LazyArg): Effect; /** * Unsafe version of `done`. */ unsafeDone(this: Deferred, effect: Effect): void; } /** * Forks the effect into a new fiber attached to the global scope. Because the * new fiber is attached to the global scope, when the fiber executing the * returned effect terminates, the forked fiber will continue running. * @tsplus getter effect/core/io/Effect forkDaemon * @tsplus location "@effect/core/io/Fiber/_internal/runtime" */ export declare function forkDaemon(self: Effect): Effect>; /** * Returns a new workflow that will not supervise any fibers forked by this * workflow. * @tsplus getter effect/core/io/Effect daemonChildren * @tsplus location "@effect/core/io/Fiber/_internal/runtime" */ export declare function daemonChildren(self: Effect): Effect; /** * Returns an effect that forks this effect into its own separate fiber, * returning the fiber immediately, without waiting for it to begin executing * the effect. * * You can use the `fork` method whenever you want to execute an effect in a * new fiber, concurrently and without "blocking" the fiber executing other * effects. Using fibers can be tricky, so instead of using this method * directly, consider other higher-level methods, such as `raceWith`, * `zipPar`, and so forth. * * The fiber returned by this method has methods to interrupt the fiber and to * wait for it to finish executing the effect. See `Fiber` for more * information. * * Whenever you use this method to launch a new fiber, the new fiber is * attached to the parent fiber's scope. This means when the parent fiber * terminates, the child fiber will be terminated as well, ensuring that no * fibers leak. This behavior is called "auto supervision", and if this * behavior is not desired, you may use the `forkDaemon` or `forkIn` methods. * @tsplus getter effect/core/io/Effect fork * @tsplus location "@effect/core/io/Fiber/_internal/runtime" */ export declare function fork(self: Effect): Effect>; export declare function unsafeFork(effect: Effect, parentFiber: FiberRuntime, parentRuntimeFlags: RuntimeFlags): FiberRuntime; export declare function unsafeForkUnstarted(effect: Effect, parentFiber: FiberRuntime, parentRuntimeFlags: RuntimeFlags): FiberRuntime; /** * Used to restore the inherited interruptibility */ export interface InterruptStatusRestore { readonly restore: (effect: Effect) => Effect; } export declare class InterruptStatusRestoreImpl implements InterruptStatusRestore { readonly flag: InterruptStatus; constructor(flag: InterruptStatus); restore: (effect: import("../../Effect").Effect) => import("../../Effect").Effect; } /** * Returns an effect that is interrupted by the current fiber * @tsplus static effect/core/io/Effect.Ops interrupt * @tsplus location "@effect/core/io/Fiber/_internal/runtime" */ export declare const interrupt: import("../../Effect").Effect; /** * Switches the interrupt status for this effect. If `true` is used, then the * effect becomes interruptible (the default), while if `false` is used, then * the effect becomes uninterruptible. These changes are compositional, so * they only affect regions of the effect. * @tsplus static effect/core/io/Effect.Aspects interruptStatus * @tsplus pipeable effect/core/io/Effect interruptStatus * @tsplus location "@effect/core/io/Fiber/_internal/runtime" */ export declare function interruptStatus(flag: LazyArg): (self: import("../../Effect").Effect) => import("../../Effect").Effect; /** * Returns a new effect that performs the same operations as this effect, but * interruptibly, even if composed inside of an uninterruptible region. * * Note that effects are interruptible by default, so this function only has * meaning if used within an uninterruptible region. * * **WARNING**: This operator "punches holes" into effects, allowing them to be * interrupted in unexpected places. Do not use this operator unless you know * exactly what you are doing. Instead, you should use `uninterruptibleMask`. * @tsplus getter effect/core/io/Effect interruptible * @tsplus location "@effect/core/io/Fiber/_internal/runtime" */ export declare function interruptible(self: Effect): Effect; /** * Performs this effect uninterruptibly. This will prevent the effect from * being terminated externally, but the effect may fail for internal reasons * (e.g. an uncaught error) or terminate due to defect. * * Uninterruptible effects may recover from all failure causes (including * interruption of an inner effect that has been made interruptible). * @tsplus getter effect/core/io/Effect uninterruptible * @tsplus location "@effect/core/io/Fiber/_internal/runtime" */ export declare function uninterruptible(self: Effect): Effect; /** * Checks the interrupt status, and produces the effect returned by the * specified callback. * @tsplus static effect/core/io/Effect.Ops checkInterruptible * @tsplus location "@effect/core/io/Fiber/_internal/runtime" */ export declare function checkInterruptible(f: (interruptStatus: InterruptStatus) => Effect): Effect; /** * Makes the effect interruptible, but passes it a restore function that can * be used to restore the inherited interruptibility from whatever region the * effect is composed into. * @tsplus static effect/core/io/Effect.Ops interruptibleMask * @tsplus location "@effect/core/io/Fiber/_internal/runtime" */ export declare function interruptibleMask(f: (statusRestore: InterruptStatusRestore) => Effect): Effect; /** * Makes the effect uninterruptible, but passes it a restore function that can * be used to restore the inherited interruptibility from whatever region the * effect is composed into. * @tsplus static effect/core/io/Effect.Ops uninterruptibleMask * @tsplus location "@effect/core/io/Fiber/_internal/runtime" */ export declare function uninterruptibleMask(f: (statusRestore: InterruptStatusRestore) => Effect): Effect; /** * Returns an effect whose interruption will be disconnected from the * fiber's own interruption, being performed in the background without * slowing down the fiber's interruption. * * This method is useful to create "fast interrupting" effects. For * example, if you call this on a bracketed effect, then even if the * effect is "stuck" in acquire or release, its interruption will return * immediately, while the acquire / release are performed in the * background. * * See timeout and race for other applications. * @tsplus getter effect/core/io/Effect disconnect * @tsplus location "@effect/core/io/Fiber/_internal/runtime" */ export declare function disconnect(self: Effect): Effect; /** * Calls the specified function, and runs the effect it returns, if this * effect is interrupted. * @tsplus static effect/core/io/Effect.Aspects onInterrupt * @tsplus pipeable effect/core/io/Effect onInterrupt * @tsplus location "@effect/core/io/Fiber/_internal/runtime" */ export declare function onInterrupt(cleanup: (interruptors: HashSet) => Effect): (self: import("../../Effect").Effect) => import("../../Effect").Effect; /** * Calls the specified function, and runs the effect it returns, if this * effect is interrupted (allows for expanding error). * @tsplus static effect/core/io/Effect.Aspects onInterruptPolymorphic * @tsplus pipeable effect/core/io/Effect onInterruptPolymorphic * @tsplus location "@effect/core/io/Fiber/_internal/runtime" */ export declare function onInterruptPolymorphic(cleanup: (interruptors: HashSet) => Effect): (self: import("../../Effect").Effect) => import("../../Effect").Effect; /** * Returns an effect that is interrupted as if by the specified fiber. * @tsplus static effect/core/io/Effect.Ops interruptAs * @tsplus location "@effect/core/io/Fiber/_internal/runtime" */ export declare function interruptAs(fiberId: FiberId): import("../../Effect").Effect; /** * Returns an effect that succeeds or fails a deferred based on the result of * this effect. Synchronizes interruption, so if this effect is interrupted, * the specified deferred will be interrupted, too. * @tsplus static effect/core/io/Effect.Aspects intoDeferred * @tsplus pipeable effect/core/io/Effect intoDeferred * @tsplus location "@effect/core/io/Fiber/_internal/runtime" */ export declare function intoDeferred(deferred: Deferred): (self: import("../../Effect").Effect) => import("../../Effect").Effect; export declare class FiberRefInternal implements FiberRef.WithPatch { readonly initial: Value; readonly diff: (oldValue: Value, newValue: Value) => Patch; readonly combine: (first: Patch, second: Patch) => Patch; readonly patch: (patch: Patch) => (oldValue: Value) => Value; readonly fork: Patch; readonly join: (oldV: Value, newV: Value) => Value; readonly [FiberRefSym]: FiberRefSym; readonly [_Value]: Value; readonly [_Patch]: Patch; constructor(initial: Value, diff: (oldValue: Value, newValue: Value) => Patch, combine: (first: Patch, second: Patch) => Patch, patch: (patch: Patch) => (oldValue: Value) => Value, fork: Patch, join: (oldV: Value, newV: Value) => Value); /** * Atomically modifies the `FiberRef` with the specified function, which * computes a return value for the modification. This is a more powerful * version of `update`. */ modify(f: (a: Value) => readonly [B, Value]): Effect; get get(): Effect; get delete(): Effect; get reset(): Effect; getAndSet(this: FiberRef.WithPatch, value: Value): Effect; getAndUpdate(this: FiberRef.WithPatch, f: (a: Value) => Value): Effect; getAndUpdateSome(this: FiberRef.WithPatch, pf: (a: Value) => Maybe): Effect; getWith(this: FiberRef.WithPatch, f: (a: Value) => Effect): Effect; locally(this: FiberRef.WithPatch, value: Value): (use: Effect) => Effect; locallyScoped(this: FiberRef.WithPatch, value: Value): Effect; locallyScopedWith(this: FiberRef.WithPatch, f: (a: Value) => Value): Effect; locallyWith(this: FiberRef.WithPatch, f: (a: Value) => Value): (effect: Effect) => Effect; update(this: FiberRef.WithPatch, f: (a: Value) => Value): Effect; set(this: FiberRef.WithPatch, value: Value): Effect; modifySome(this: FiberRef.WithPatch, def: B, f: (a: Value) => Maybe): Effect; updateAndGet(this: FiberRef.WithPatch, f: (a: Value) => Value): Effect; updateSome(this: FiberRef.WithPatch, pf: (a: Value) => Maybe): Effect; /** * Atomically modifies the `FiberRef` with the specified partial function. * If the function is undefined on the current value it returns the old * value without changing it. */ updateSomeAndGet(this: FiberRef.WithPatch, pf: (a: Value) => Maybe): Effect; } /** * @tsplus static effect/core/io/FiberRef.Ops unsafeMakePatch * @tsplus location "@effect/core/io/Fiber/_internal/runtime" */ export declare function unsafeMakePatch(initial: Value0, differ: Differ, fork0: Patch0, join0?: (oldV: Value0, newV: Value0) => Value0): FiberRef.WithPatch; /** * @tsplus macro remove */ export declare function concreteFiberRef(_: FiberRef.WithPatch): asserts _ is FiberRefInternal; /** * Creates a new `FiberRef` with given initial value. * @tsplus static effect/core/io/FiberRef.Ops make * @tsplus location "@effect/core/io/Fiber/_internal/runtime" */ export declare function make(initial: A, fork?: (a: A) => A, join?: (left: A, right: A) => A): Effect>; /** * Creates a new `FiberRef` with specified initial value of the environment, * using `Service.Env.Patch` to combine updates to the environment in a * compositional manner. * @tsplus static effect/core/io/FiberRef.Ops makeEnvironment * @tsplus location "@effect/core/io/Fiber/_internal/runtime" */ export declare function makeEnvironment(initial: Service.Env): Effect, Service.Patch>>; /** * Creates a new `FiberRef` to hold Set values * @tsplus static effect/core/io/FiberRef.Ops unsafeMakeHashSet * @tsplus location "@effect/core/io/Fiber/_internal/runtime" */ export declare function unsafeMakeHashSet(initial: HashSet): FiberRef.WithPatch, import("@tsplus/stdlib/data/Differ").Differ.HashSet.Patch>; /** * Creates a new `FiberRef` with the specified initial value, using the * specified patch type to combine updates to the value in a compositional * way. * @tsplus static effect/core/io/FiberRef.Ops makePatch * @tsplus location "@effect/core/io/Fiber/_internal/runtime" */ export declare function makePatch(initial: Value0, differ: Differ, fork0: Patch0, join0?: (oldV: Value0, newV: Value0) => Value0): Effect>; /** * @tsplus static effect/core/io/FiberRef.Ops makeWith * @tsplus location "@effect/core/io/Fiber/_internal/runtime" */ export declare function makeWith(ref: FiberRef.WithPatch): Effect>; /** * @tsplus static effect/core/io/FiberRef.Ops unsafeMake * @tsplus location "@effect/core/io/Fiber/_internal/runtime" */ export declare function unsafeMake(initial: A, fork?: (a: A) => A, join?: (left: A, right: A) => A): FiberRef; /** * @tsplus static effect/core/io/FiberRef.Ops unsafeMakeEnvironment * @tsplus location "@effect/core/io/Fiber/_internal/runtime" */ export declare function unsafeMakeEnvironment(initial: Service.Env): FiberRef.WithPatch, Service.Patch>; /** * @tsplus static effect/core/io/FiberRef.Ops unsafeMakeSupervisor * @tsplus location "@effect/core/io/Fiber/_internal/runtime" */ export declare function unsafeMakeSupervisor(initial: Supervisor): FiberRef.WithPatch, Supervisor.Patch>; /** * A more powerful variant of `addFinalizer` that allows the finalizer to * depend on the `Exit` value that the scope is closed with. * @tsplus static effect/core/io/Effect.Ops addFinalizerExit * @tsplus location "@effect/core/io/Fiber/_internal/runtime" */ export declare function addFinalizerExit(finalizer: (exit: Exit) => Effect): Effect; /** * A more powerful variant of `acquireRelease` that allows the `release` * workflow to depend on the `Exit` value specified when the scope is closed. * @tsplus static effect/core/io/Effect.Ops acquireReleaseExit * @tsplus fluent effect/core/io/Effect acquireReleaseExit * @tsplus location "@effect/core/io/Fiber/_internal/runtime" */ export declare function acquireReleaseExit(acquire: Effect, release: (a: A, exit: Exit) => Effect): Effect; /** * Constructs a scoped resource from an `acquire` and `release` workflow. If * `acquire` successfully completes execution then `release` will be added to * the finalizers associated with the scope of this workflow and is guaranteed * to be run when the scope is closed. * * The `acquire` and `release` workflows will be run uninterruptibly. * @tsplus static effect/core/io/Effect.Ops acquireRelease * @tsplus fluent effect/core/io/Effect acquireRelease * @tsplus location "@effect/core/io/Fiber/_internal/runtime" */ export declare function acquireRelease(acquire: Effect, release: (a: A) => Effect): Effect; /** * Accesses the whole environment of the effect. * @tsplus static effect/core/io/Effect.Ops environment * @tsplus location "@effect/core/io/Fiber/_internal/runtime" */ export declare function environment(): Effect>; /** * @tsplus static effect/core/io/FiberRef.Ops currentEnvironment * @tsplus location "@effect/core/io/Fiber/_internal/runtime" */ export declare const currentEnvironment: FiberRef>; /** * @tsplus static effect/core/io/FiberRef.Ops currentSupervisor * @tsplus location "@effect/core/io/Fiber/_internal/runtime" */ export declare const currentSupervisor: FiberRef>; /** * @tsplus static effect/core/io/FiberRef.Ops currentScheduler * @tsplus location "@effect/core/io/Fiber/_internal/runtime" */ export declare const currentScheduler: FiberRef; /** * @tsplus static effect/core/io/FiberRef.Ops currentLogAnnotations * @tsplus location "@effect/core/io/Fiber/_internal/runtime" */ export declare const currentLogAnnotations: FiberRef>; /** * @tsplus static effect/core/io/FiberRef.Ops currentLogLevel * @tsplus location "@effect/core/io/Fiber/_internal/runtime" */ export declare const currentLogLevel: FiberRef; /** * @tsplus static effect/core/io/FiberRef.Ops currentLogSpan * @tsplus location "@effect/core/io/Fiber/_internal/runtime" */ export declare const currentLogSpan: FiberRef>; /** * @tsplus static effect/core/io/FiberRef.Ops currentParallelism * @tsplus location "@effect/core/io/Fiber/_internal/runtime" */ export declare const currentParallelism: FiberRef>; /** * @tsplus static effect/core/io/FiberRef.Ops forkScopeOverride * @tsplus location "@effect/core/io/Fiber/_internal/runtime" */ export declare const forkScopeOverride: FiberRef>; /** * @tsplus static effect/core/io/FiberRef.Ops interruptedCause * @tsplus location "@effect/core/io/Fiber/_internal/runtime" */ export declare const interruptedCause: FiberRef>; /** * Provides the effect with its required environment, which eliminates its * dependency on `R`. * @tsplus static effect/core/io/Effect.Aspects provideEnvironment * @tsplus pipeable effect/core/io/Effect provideEnvironment * @tsplus location "@effect/core/io/Fiber/_internal/runtime" */ export declare function provideEnvironment(environment: Env): (self: import("../../Effect").Effect) => import("../../Effect").Effect; /** * Returns the current scope. * @tsplus static effect/core/io/Effect.Ops scope * @tsplus location "@effect/core/io/Fiber/_internal/runtime" */ export declare const scope: Effect; /** * Accesses the specified service in the environment of the effect. * * Especially useful for creating "accessor" methods on services' companion * objects. * @tsplus static effect/core/io/Effect.Ops service * @tsplus location "@effect/core/io/Fiber/_internal/runtime" */ export declare function service(tag: Tag): Effect; /** * Effectfully accesses the specified service in the environment of the * effect. * * Especially useful for creating "accessor" methods on services' companion * objects. * @tsplus static effect/core/io/Effect.Ops serviceWithEffect * @tsplus location "@effect/core/io/Fiber/_internal/runtime" */ export declare function serviceWithEffect(tag: Tag, f: (a: T) => Effect): Effect; /** * @tsplus static effect/core/io/FiberRef.Ops currentLoggers * @tsplus location "@effect/core/io/Fiber/_internal/runtime" */ export declare const currentLoggers: FiberRef.WithPatch>, Differ.HashSet.Patch>>; /** * When this effect represents acquisition of a resource (for example, opening * a file, launching a thread, etc.), `acquireReleaseWith` can be used to * ensure the acquisition is not interrupted and the resource is always * released. * * The function does two things: * * 1. Ensures this effect, which acquires the resource, will not be * interrupted. Of course, acquisition may fail for internal reasons (an * uncaught exception). * 2. Ensures the `release` effect will not be interrupted, and will be * executed so long as this effect successfully * acquires the resource. * * In between acquisition and release of the resource, the `use` effect is * executed. * * If the `release` effect fails, then the entire effect will fail even if the * `use` effect succeeds. If this fail-fast behavior is not desired, errors * produced by the `release` effect can be caught and ignored. * @tsplus static effect/core/io/Effect.Ops acquireUseRelease * @tsplus fluent effect/core/io/Effect acquireUseRelease * @tsplus location "@effect/core/io/Fiber/_internal/runtime" */ export declare function acquireUseRelease(acquire: Effect, use: (a: A) => Effect, release: (a: A) => Effect): Effect; /** * Acquires a resource, uses the resource, and then releases the resource. * Neither the acquisition nor the release will be interrupted, and the * resource is guaranteed to be released, so long as the `acquire` effect * succeeds. If `use` fails, then after release, the returned effect will fail * with the same error. * @tsplus static effect/core/io/Effect.Ops acquireUseReleaseExit * @tsplus fluent effect/core/io/Effect acquireUseReleaseExit * @tsplus location "@effect/core/io/Fiber/_internal/runtime" */ export declare function acquireUseReleaseExit(acquire: Effect, use: (a: A) => Effect, release: (a: A, exit: Exit) => Effect): Effect; /** * Imports an asynchronous side-effect into an effect. The side-effect has * the option of returning the value synchronously, which is useful in cases * where it cannot be determined if the effect is synchronous or asynchronous * until the side-effect is actually executed. The effect also has the option * of returning a canceler, which will be used by the runtime to cancel the * asynchronous effect if the fiber executing the effect is interrupted. * * If the register function returns a value synchronously, then the callback * function `Effect => void` must not be called. Otherwise the callback * function must be called at most once. * @tsplus static effect/core/io/Effect.Ops asyncInterrupt * @tsplus location "@effect/core/io/Fiber/_internal/runtime" */ export declare function asyncInterrupt(register: (callback: (_: Effect) => void) => Either, Effect>): Effect; /** * Imports an asynchronous side-effect into an effect. The side-effect has * the option of returning the value synchronously, which is useful in cases * where it cannot be determined if the effect is synchronous or asynchronous * until the side-effect is actually executed. The effect also has the option * of returning a canceler, which will be used by the runtime to cancel the * asynchronous effect if the fiber executing the effect is interrupted. * * If the register function returns a value synchronously, then the callback * function `Effect => void` must not be called. Otherwise the callback * function must be called at most once. * * The list of fibers, that may complete the async callback, is used to * provide better diagnostics. * @tsplus static effect/core/io/Effect.Ops asyncInterruptBlockingOn * @tsplus location "@effect/core/io/Fiber/_internal/runtime" */ export declare function asyncInterruptBlockingOn(register: (callback: (_: Effect) => void) => Either, Effect>, blockingOn: FiberId): Effect; //# sourceMappingURL=runtime.d.ts.map