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: <Out extends Context.Tag<any, any>, E, In, R>(
  tag: Out,
  options: {
    readonly layer: Layer.Layer<Context.Tag.Identifier<Out>, E, In>
    readonly schedule: Schedule.Schedule<unknown, unknown, R>
  }
) => Layer.Layer<Reloadable<Context.Tag.Identifier<Out>>, E, In | R>

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: <Out extends Context.Tag<any, any>, E, In, R>(
  tag: Out,
  options: {
    readonly layer: Layer.Layer<Context.Tag.Identifier<Out>, E, In>
    readonly scheduleFromConfig: (context: Context.Context<In>) => Schedule.Schedule<unknown, unknown, R>
  }
) => Layer.Layer<Reloadable<Context.Tag.Identifier<Out>>, E, In | R>

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: <Out extends Context.Tag<any, any>, In, E>(
  tag: Out,
  options: { readonly layer: Layer.Layer<Context.Tag.Identifier<Out>, E, In> }
) => Layer.Layer<Reloadable<Context.Tag.Identifier<Out>>, E, In>

Added in v2.0.0

reload

Reloads the specified service.

Signature

export declare const reload: <T extends Context.Tag<any, any>>(
  tag: T
) => Effect.Effect<void, unknown, Reloadable<Context.Tag.Identifier<T>>>

Added in v2.0.0

reloadFork

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

Signature

export declare const reloadFork: <T extends Context.Tag<any, any>>(
  tag: T
) => Effect.Effect<void, unknown, Reloadable<Context.Tag.Identifier<T>>>

Added in v2.0.0

context

tag

Signature

export declare const tag: <T extends Context.Tag<any, any>>(
  tag: T
) => Context.Tag<Reloadable<Context.Tag.Identifier<T>>, Reloadable<Context.Tag.Service<T>>>

Added in v2.0.0

getters

get

Retrieves the current version of the reloadable service.

Signature

export declare const get: <T extends Context.Tag<any, any>>(
  tag: T
) => Effect.Effect<Context.Tag.Service<T>, never, Reloadable<Context.Tag.Identifier<T>>>

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