/** * @since 1.0.0 */ import type * as Context from "@effect/data/Context" import type * as Effect from "@effect/io/Effect" import * as internal from "@effect/io/internal/reloadable" import type * as Layer from "@effect/io/Layer" import type * as Schedule from "@effect/io/Schedule" import type * as ScopedRef from "@effect/io/ScopedRef" /** * @since 1.0.0 * @category symbols */ export const ReloadableTypeId: unique symbol = internal.ReloadableTypeId /** * @since 1.0.0 * @category symbols */ export type ReloadableTypeId = typeof ReloadableTypeId /** * A `Reloadable` is an implementation of some service that can be dynamically * reloaded, or swapped out for another implementation on-the-fly. * * @since 1.0.0 * @category models */ export interface Reloadable extends Reloadable.Variance { /** * @internal */ readonly scopedRef: ScopedRef.ScopedRef /** * @internal */ reload(): Effect.Effect } /** * @since 1.0.0 */ export declare namespace Reloadable { /** * @since 1.0.0 * @category models */ export interface Variance { readonly [ReloadableTypeId]: { readonly _A: (_: never) => A } } } /** * Makes a new reloadable service from a layer that describes the construction * of a static service. The service is automatically reloaded according to the * provided schedule. * * @since 1.0.0 * @category constructors */ export const auto: , In, E, R>( tag: Out, options: { readonly layer: Layer.Layer> readonly schedule: Schedule.Schedule } ) => Layer.Layer>> = internal.auto /** * Makes a new reloadable service from a layer that describes the construction * of a static service. The service is automatically reloaded according to a * schedule, which is extracted from the input to the layer. * * @since 1.0.0 * @category constructors */ export const autoFromConfig: , In, E, R>( tag: Out, options: { readonly layer: Layer.Layer> readonly scheduleFromConfig: (context: Context.Context) => Schedule.Schedule } ) => Layer.Layer>> = internal.autoFromConfig /** * Retrieves the current version of the reloadable service. * * @since 1.0.0 * @category getters */ export const get: >( tag: T ) => Effect.Effect>, never, Context.Tag.Service> = internal.get /** * Makes a new reloadable service from a layer that describes the construction * of a static service. * * @since 1.0.0 * @category constructors */ export const manual: , In, E>( tag: Out, options: { readonly layer: Layer.Layer> } ) => Layer.Layer>> = internal.manual /** * Reloads the specified service. * * @since 1.0.0 * @category constructors */ export const reload: >( tag: T ) => Effect.Effect>, unknown, void> = internal.reload /** * @since 1.0.0 * @category context */ export const tag: >( tag: T ) => Context.Tag>, Reloadable>> = internal.reloadableTag /** * Forks the reload of the service in the background, ignoring any errors. * * @since 1.0.0 * @category constructors */ export const reloadFork: >( tag: T ) => Effect.Effect>, unknown, void> = internal.reloadFork