MachineId.ts
MachineId.ts overview
Section titled “MachineId.ts overview”Branded integer identifiers for cluster runners. A MachineId marks the
machine component used by cluster services, especially snowflake id
generation, while keeping the value distinct from an ordinary number in
TypeScript APIs.
Since v4.0.0
Exports Grouped by Category
Section titled “Exports Grouped by Category”constructors
Section titled “constructors”MachineId
Section titled “MachineId”Schema for branded integer machine identifiers used by the cluster.
Signature
declare const MachineId: Schema.brand<Schema.Int, "~effect/cluster/MachineId">Since v4.0.0
Brands a number as a MachineId.
When to use
Use to turn a trusted numeric machine id into the branded type when implementing runner storage adapters or configuring snowflake generation.
Details
The branded value is the original number at runtime.
Gotchas
make does not validate integer input or enforce the snowflake machine-id
range. Snowflake ids encode the machine component modulo 1024.
See
MachineIdfor the schema that validates branded integer machine identifiers
Signature
declare const make: (id: number) => MachineIdSince v4.0.0
models
Section titled “models”MachineId (type alias)
Section titled “MachineId (type alias)”Branded integer type representing a cluster machine ID.
Signature
type MachineId = typeof MachineId.TypeSince v4.0.0