Skip to content

Reloadable

11 exports Added in v2.0.0 Source

Constructors

auto

Added in v2.0.0 Source

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

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

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

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

manual

Added in v2.0.0 Source

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

Signature

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

reload

Added in v2.0.0 Source

Reloads the specified service.

Signature

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

reloadFork

Added in v2.0.0 Source

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

Signature

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

Context

tag

Added in v2.0.0 Source

Signature

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

Getters

get

Added in v2.0.0 Source

Retrieves the current version of the reloadable service.

Signature

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

Models

Reloadable interface

Added in v2.0.0 Source

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

Signature

interface Reloadable<in out A> extends Variance<A> {}

Other

Reloadable

Added in v2.0.0 Source

Symbols

Signature

declare const ReloadableTypeId: unique symbol;

ReloadableTypeId type

Added in v2.0.0 Source

Signature

type ReloadableTypeId = typeof ReloadableTypeId;