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

EntityResource.ts overview

Since v1.0.0


Exports Grouped by Category


Constructors

make

A EntityResource is a resource that can be acquired inside a cluster entity, which will keep the entity alive even across restarts.

The resource will only be fully released when the idle time to live is reached, or when the close effect is called.

By default, the idleTimeToLive is infinite, meaning the resource will only be released when close is called.

Signature

declare const make: <A, E, R>(options: {
  readonly acquire: Effect.Effect<A, E, R>
  readonly idleTimeToLive?: Duration.DurationInput | undefined
}) => Effect.Effect<EntityResource<A, E>, E, Scope.Scope | Exclude<R, CloseScope> | Sharding | Entity.CurrentAddress>

Source

Since v1.0.0

Kubernetes

makeK8sPod

Signature

declare const makeK8sPod: (
  spec: v1.Pod,
  options?: { readonly idleTimeToLive?: Duration.DurationInput | undefined } | undefined
) => Effect.Effect<
  EntityResource<K8sHttpClient.PodStatus>,
  never,
  Scope.Scope | Sharding | Entity.CurrentAddress | K8sHttpClient.K8sHttpClient
>

Source

Since v1.0.0

Models

EntityResource (interface)

Signature

export interface EntityResource<out A, out E = never> {
  readonly [TypeId]: TypeId
  readonly get: Effect.Effect<A, E, Scope.Scope>
  readonly close: Effect.Effect<void>
}

Source

Since v1.0.0

Scope

CloseScope (class)

A Scope that is only closed when the resource is explicitly closed.

It is not closed during restarts, due to shard movement or node shutdowns.

Signature

declare class CloseScope

Source

Since v1.0.0

Type ids

TypeId

Signature

declare const TypeId: "~@effect/cluster/EntityResource"

Source

Since v1.0.0

TypeId (type alias)

Signature

type TypeId = "~@effect/cluster/EntityResource"

Source

Since v1.0.0