EntityAddress.ts
EntityAddress.ts overview
Section titled “EntityAddress.ts overview”The EntityAddress module defines the value used to locate an entity within
a cluster. An address combines the entity type, entity id, and shard id so
messages, persisted envelopes, workflow executions, and entity managers can
agree on the same routing target.
Since v4.0.0
Exports Grouped by Category
Section titled “Exports Grouped by Category”constructors
Section titled “constructors”Constructs an EntityAddress from a shard ID, entity type, and entity ID.
When to use
Use to create the routing target for a known entity type and entity id after
resolving that id to the ShardId assigned by the entity’s shard group.
Details
The returned EntityAddress stores the supplied shardId, entityType, and
entityId. Equality and hashing include all three fields.
Gotchas
make does not choose the shard for an entity. Use the same shard group
logic as the entity definition; a different shardId makes a different
address even when the entity type and entity id match.
See
EntityAddressfor the equality, hashing, and string formatting behavior of constructed addressesShardIdfor the shard identifier included in the address
Signature
declare const make: (options: { readonly shardId: ShardId readonly entityType: EntityType readonly entityId: EntityId}) => EntityAddressSince v4.0.0
models
Section titled “models”EntityAddress (class)
Section titled “EntityAddress (class)”Represents the unique address of an entity within the cluster.
Signature
declare class EntityAddressSince v4.0.0
toString (method)
Section titled “toString (method)”Formats the entity type, entity id, and shard id as a readable address.
Signature
declare const toString: () => stringSince v4.0.0
[Equal.symbol] (method)
Section titled “[Equal.symbol] (method)”Compares entity addresses by entity type, entity id, and shard id.
Signature
declare const [Equal.symbol]: (that: EntityAddress) => booleanSince v4.0.0
[Hash.symbol] (method)
Section titled “[Hash.symbol] (method)”Computes a structural hash from the entity type, entity id, and shard id.
Signature
declare const [Hash.symbol]: () => numberSince v4.0.0
[TypeId] (property)
Section titled “[TypeId] (property)”Marks this value as a cluster entity address for runtime guards.
Signature
readonly [TypeId]: "~effect/cluster/EntityAddress"Since v4.0.0