Skip to content

EntityResource

6 exports Added in v1.0.0 Source

Constructors

make

Added in v1.0.0 Source

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;
}) => Effect.Effect<
  EntityResource<A, E>,
  E,
  Scope.Scope | Exclude<R, CloseScope> | Sharding | Entity.CurrentAddress
>;

Kubernetes

makeK8sPod

Added in v1.0.0 Source

Signature

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

Models

EntityResource interface

Added in v1.0.0 Source

Signature

interface EntityResource<out A, out E = never> {
  readonly "~@effect/cluster/EntityResource": "~@effect/cluster/EntityResource";
  readonly close: Effect<void>;
  readonly get: Effect<A, E, Scope>;
}

Scope

CloseScope

Added in v1.0.0 Source

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 extends any {
  constructor();
}

Type Ids

TypeId

Added in v1.0.0 Source

Signature

declare const TypeId: TypeId;

TypeId type

Added in v1.0.0 Source

Signature

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