Skip to main content Link Search Menu Expand Document (external link)

Reloadable overview

Added in v2.0.0


Table of contents


constructors

auto

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.

Signature

export declare const auto: <I, S, E, In, R>(
  tag: Context.Tag<I, S>,
  options: { readonly layer: Layer.Layer<I, E, In>; readonly schedule: Schedule.Schedule<unknown, unknown, R> }
) => Layer.Layer<Reloadable<I>, E, R | In>

Added in v2.0.0

autoFromConfig

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.

Signature

export declare const autoFromConfig: <I, S, E, In, R>(
  tag: Context.Tag<I, S>,
  options: {
    readonly layer: Layer.Layer<I, E, In>
    readonly scheduleFromConfig: (context: Context.Context<In>) => Schedule.Schedule<unknown, unknown, R>
  }
) => Layer.Layer<Reloadable<I>, E, R | In>

Added in v2.0.0

manual

Makes a new reloadable service from a layer that describes the construction of a static service.

Signature

export declare const manual: <I, S, In, E>(
  tag: Context.Tag<I, S>,
  options: { readonly layer: Layer.Layer<I, E, In> }
) => Layer.Layer<Reloadable<I>, E, In>

Added in v2.0.0

reload

Reloads the specified service.

Signature

export declare const reload: <I, S>(tag: Context.Tag<I, S>) => Effect.Effect<void, unknown, Reloadable<I>>

Added in v2.0.0

reloadFork

Forks the reload of the service in the background, ignoring any errors.

Signature

export declare const reloadFork: <I, S>(tag: Context.Tag<I, S>) => Effect.Effect<void, unknown, Reloadable<I>>

Added in v2.0.0

context

tag

Signature

export declare const tag: <I, S>(tag: Context.Tag<I, S>) => Context.Tag<Reloadable<I>, Reloadable<S>>

Added in v2.0.0

getters

get

Retrieves the current version of the reloadable service.

Signature

export declare const get: <I, S>(tag: Context.Tag<I, S>) => Effect.Effect<S, never, Reloadable<I>>

Added in v2.0.0

models

Reloadable (interface)

A Reloadable is an implementation of some service that can be dynamically reloaded, or swapped out for another implementation on-the-fly.

Signature

export interface Reloadable<in out A> extends Reloadable.Variance<A> {
  /**
   * @internal
   */
  readonly scopedRef: ScopedRef.ScopedRef<A>
  /**
   * @internal
   */
  readonly reload: Effect.Effect<void, unknown>
}

Added in v2.0.0

symbols

ReloadableTypeId

Signature

export declare const ReloadableTypeId: typeof ReloadableTypeId

Added in v2.0.0

ReloadableTypeId (type alias)

Signature

export type ReloadableTypeId = typeof ReloadableTypeId

Added in v2.0.0

utils

Reloadable (namespace)

Added in v2.0.0

Variance (interface)

Signature

export interface Variance<in out A> {
  readonly [ReloadableTypeId]: {
    readonly _A: Types.Invariant<A>
  }
}

Added in v2.0.0