Skip to content
Effect 4.0 is here. One ecosystem. Zero dependencies.

EntityResource

6 exports Since v1.0.0 Source

Constructors

Since v1.0.0

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

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

Since v1.0.0

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

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

Since v1.0.0

Signature

declare const TypeId: TypeId
Since v1.0.0

Signature

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