Skip to content

RuntimeFlags

37 exports Added in v2.0.0 Source

Constructors

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

Signature

declare const CooperativeYielding: RuntimeFlag;

Interruption

Added in v2.0.0 Source

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

Signature

declare const Interruption: RuntimeFlag;

make

Added in v2.0.0 Source

Signature

declare const make: (...flags: ReadonlyArray<RuntimeFlag>) => RuntimeFlags;

none

Added in v2.0.0 Source

Signature

declare const none: RuntimeFlags;

None

Added in v2.0.0 Source

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;

WindDown

Added in v2.0.0 Source

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

render

Added in v2.0.0 Source

Converts the provided RuntimeFlags into a string.

Signature

declare const render: (self: RuntimeFlags) => string;

toSet

Added in v2.0.0 Source

Converts the provided RuntimeFlags into a ReadonlySet<number>.

Signature

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

Diffing

diff

Added in v2.0.0 Source

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

isDisabled

Added in v2.0.0 Source

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

Signature

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

isEnabled

Added in v2.0.0 Source

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;

interruption

Added in v2.0.0 Source

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;

windDown

Added in v2.0.0 Source

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

Signature

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

Models

RuntimeFlag type

Added in v2.0.0 Source

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;
};

RuntimeFlags type

Added in v2.0.0 Source

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

differ

Added in v2.0.0 Source

Constructs a differ that knows how to diff RuntimeFlags values.

Signature

declare const differ: Differ.Differ<RuntimeFlags, RuntimeFlagsPatch.RuntimeFlagsPatch>;

disable

Added in v2.0.0 Source

Disables the specified RuntimeFlag.

Signature

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

disableAll

Added in v2.0.0 Source

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;
};

enable

Added in v2.0.0 Source

Enables the specified RuntimeFlag.

Signature

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

enableAll

Added in v2.0.0 Source

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;
};

patch

Added in v2.0.0 Source

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;
};