Skip to content
Effect 4.0 is here. One ecosystem. Zero dependencies.

RuntimeFlags

37 exports Since v2.0.0 Source

Constructors

The cooperative yielding flag determines whether the Effect runtime will yield to another fiber.

Signature

declare const CooperativeYielding: RuntimeFlag

The interruption flag determines whether or not the Effect runtime system will interrupt a fiber.

Signature

declare const Interruption: RuntimeFlag
Since v2.0.0

Signature

declare const make: (...flags: ReadonlyArray<RuntimeFlag>) => RuntimeFlags
Since v2.0.0

Signature

declare const none: RuntimeFlags
Since v2.0.0

No runtime flags.

Signature

declare const None: RuntimeFlag

The op supervision flag determines whether or not the Effect runtime system will supervise all operations of the Effect runtime. Use of this flag will negatively impact performance, but is required for some operations, such as profiling.

Signature

declare const OpSupervision: RuntimeFlag

The runtime metrics flag determines whether or not the Effect runtime system will collect metrics about the Effect runtime. Use of this flag will have a very small negative impact on performance, but generates very helpful operational insight into running Effect applications that can be exported to Prometheus or other tools via Effect Metrics.

Signature

declare const RuntimeMetrics: RuntimeFlag
Since v2.0.0

The wind down flag determines whether the Effect runtime system will execute effects in wind-down mode. In wind-down mode, even if interruption is enabled and a fiber has been interrupted, the fiber will continue its execution uninterrupted.

Signature

declare const WindDown: RuntimeFlag

Context

Signature

declare const disableCooperativeYielding: Layer.Layer<never>

Signature

declare const disableInterruption: Layer.Layer<never>

Signature

declare const disableOpSupervision: Layer.Layer<never>

Signature

declare const disableRuntimeMetrics: Layer.Layer<never>

Signature

declare const disableWindDown: Layer.Layer<never>

Signature

declare const enableCooperativeYielding: Layer.Layer<never>

Signature

declare const enableInterruption: Layer.Layer<never>

Signature

declare const enableOpSupervision: Layer.Layer<never>

Signature

declare const enableRuntimeMetrics: Layer.Layer<never>

Signature

declare const enableWindDown: Layer.Layer<never>

Conversions

Since v2.0.0

Converts the provided RuntimeFlags into a string.

Signature

declare const render: (self: RuntimeFlags) => string
Since v2.0.0

Converts the provided RuntimeFlags into a ReadonlySet<number>.

Signature

declare const toSet: (self: RuntimeFlags) => ReadonlySet<RuntimeFlag>

Diffing

Since v2.0.0

Creates a RuntimeFlagsPatch which describes the difference between self and that.

Signature

declare const diff: {
(that: RuntimeFlags): (self: RuntimeFlags) => RuntimeFlagsPatch;
(self: RuntimeFlags, that: RuntimeFlags): RuntimeFlagsPatch;
}

Elements

Returns true if the specified RuntimeFlag is disabled, false otherwise.

Signature

declare const isDisabled: {
(flag: RuntimeFlag): (self: RuntimeFlags) => boolean;
(self: RuntimeFlags, flag: RuntimeFlag): boolean;
}

Returns true if the specified RuntimeFlag is enabled, false otherwise.

Signature

declare const isEnabled: {
(flag: RuntimeFlag): (self: RuntimeFlags) => boolean;
(self: RuntimeFlags, flag: RuntimeFlag): boolean;
}

Getters

Returns true if the CooperativeYielding RuntimeFlag is enabled, false otherwise.

Signature

declare const cooperativeYielding: (self: RuntimeFlags) => boolean

Returns true only if the Interruption flag is enabled and the WindDown flag is disabled.

A fiber is said to be interruptible if interruption is enabled and the fiber is not in its wind-down phase, in which it takes care of cleanup activities related to fiber shutdown.

Signature

declare const interruptible: (self: RuntimeFlags) => boolean

Returns true if the Interruption RuntimeFlag is enabled, false otherwise.

Signature

declare const interruption: (self: RuntimeFlags) => boolean

Returns true if the OpSupervision RuntimeFlag is enabled, false otherwise.

Signature

declare const opSupervision: (self: RuntimeFlags) => boolean

Returns true if the RuntimeMetrics RuntimeFlag is enabled, false otherwise.

Signature

declare const runtimeMetrics: (self: RuntimeFlags) => boolean
Since v2.0.0

Returns true if the WindDown RuntimeFlag is enabled, false otherwise.

Signature

declare const windDown: (self: RuntimeFlags) => boolean

Models

Since v2.0.0

Represents a flag that can be set to enable or disable a particular feature of the Effect runtime.

Signature

type RuntimeFlag = number & {
readonly RuntimeFlag: unique symbol;
}
Since v2.0.0

Represents a set of RuntimeFlags. RuntimeFlags affect the operation of the Effect runtime system. They are exposed to application-level code because they affect the behavior and performance of application code.

Signature

type RuntimeFlags = number & {
readonly RuntimeFlags: unique symbol;
}

Utils

Since v2.0.0

Constructs a differ that knows how to diff RuntimeFlags values.

Signature

declare const differ: Differ.Differ<RuntimeFlags, RuntimeFlagsPatch.RuntimeFlagsPatch>
Since v2.0.0

Disables the specified RuntimeFlag.

Signature

declare const disable: {
(flag: RuntimeFlag): (self: RuntimeFlags) => RuntimeFlags;
(self: RuntimeFlags, flag: RuntimeFlag): RuntimeFlags;
}

Disables all of the RuntimeFlags in the specified set of RuntimeFlags.

Signature

declare const disableAll: {
(flags: RuntimeFlags): (self: RuntimeFlags) => RuntimeFlags;
(self: RuntimeFlags, flags: RuntimeFlags): RuntimeFlags;
}
Since v2.0.0

Enables the specified RuntimeFlag.

Signature

declare const enable: {
(flag: RuntimeFlag): (self: RuntimeFlags) => RuntimeFlags;
(self: RuntimeFlags, flag: RuntimeFlag): RuntimeFlags;
}

Enables all of the RuntimeFlags in the specified set of RuntimeFlags.

Signature

declare const enableAll: {
(flags: RuntimeFlags): (self: RuntimeFlags) => RuntimeFlags;
(self: RuntimeFlags, flags: RuntimeFlags): RuntimeFlags;
}
Since v2.0.0

Patches a set of RuntimeFlags with a RuntimeFlagsPatch, returning the patched set of RuntimeFlags.

Signature

declare const patch: {
(patch: RuntimeFlagsPatch): (self: RuntimeFlags) => RuntimeFlags;
(self: RuntimeFlags, patch: RuntimeFlagsPatch): RuntimeFlags;
}