Skip to content

MachineId

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.

3 exports Added in v4.0.0 Source

Constructors

MachineId

Added in v4.0.0 Source

Schema for branded integer machine identifiers used by the cluster.

Signature

declare const MachineId: brand<Int, "~effect/cluster/MachineId">;

make

Added in v4.0.0 Source

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

  • MachineId for the schema that validates branded integer machine identifiers

Signature

declare function make(id: number): number & Brand<"~effect/cluster/MachineId">;

Models

MachineId type

Added in v4.0.0 Source

Branded integer type representing a cluster machine ID.

Signature

type MachineId = typeof MachineId.Type;