Context.Reference<Metadata>Context reference containing metadata for the currently running execution-plan attempt.
When to use
Use to read the active plan step and attempt while code is running under an execution plan.
metadata
Source effect/ExecutionPlan.ts:4116 lines
export const const CurrentMetadata: Context.Reference<Metadata>const CurrentMetadata: {
key: string;
Service: {
attempt: number;
stepIndex: number;
};
defaultValue: () => Shape;
of: (this: void, self: Metadata) => Metadata;
context: (self: Metadata) => Context.Context<never>;
use: (f: (service: Metadata) => Effect.Effect<A, E, R>) => Effect.Effect<A, E, R>;
useSync: (f: (service: Metadata) => A) => Effect.Effect<A, never, never>;
Identifier: Identifier;
stack: string | undefined;
pipe: { <A>(this: A): A; <A, B = never>(this: A, ab: (_: A) => B): B; <A, B = never, C = never>(this: A, ab: (_: A) => B, bc: (_: B) => C): C; <A, B = never, C = never, D = never>(this: A, ab: (_: A) => B, bc: (_: B) => C, cd: (_: C) => D): D; <…;
toString: () => string;
toJSON: () => unknown;
}
Context reference containing metadata for the currently running
execution-plan attempt.
When to use
Use to read the active plan step and attempt while code is running under an
execution plan.
CurrentMetadata = import ContextContext.Reference<Metadata>("effect/ExecutionPlan/CurrentMetadata", {
defaultValue: LazyArg<{
attempt: number
stepIndex: number
}>
defaultValue: constant<A>(value: A): LazyArg<A>Creates a zero-argument function that always returns the provided value.
When to use
Use when you need a thunk or callback that returns the same value on every
invocation.
Example (Creating a constant thunk)
import { Function } from "effect"
import * as assert from "node:assert"
const constNull = Function.constant(null)
assert.deepStrictEqual(constNull(), null)
assert.deepStrictEqual(constNull(), null)
constant({
attempt: numberattempt: 0,
stepIndex: numberstepIndex: 0
})
})Referenced by 1 symbols