Skip to content

MachineId.ts

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



Schema for branded integer machine identifiers used by the cluster.

Signature

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

Source

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

  • MachineId for the schema that validates branded integer machine identifiers

Signature

declare const make: (id: number) => MachineId

Source

Since v4.0.0

Branded integer type representing a cluster machine ID.

Signature

type MachineId = typeof MachineId.Type

Source

Since v4.0.0