Skip to content

FlakeDecoder

Flake decoder.

Decodes 64-bit unique IDs into their timestamp, worker ID, and sequence number.

Attributes:

Name Type Description
layout int

Layout.

timestamp_bits int

Timestamp bits.

worker_bits int

Worker bits.

sequence_bits int

Sequence bits.

layout property

Layout.

timestamp_bits property

Timestamp bits.

worker_bits property

Worker bits.

sequence_bits property

Sequence bits.

__init__(*, timestamp_bits=DEFAULT_TIMESTAMP_BITS, worker_bits=DEFAULT_WORKER_BITS, sequence_bits=DEFAULT_SEQUENCE_BITS, layout=DEFAULT_LAYOUT)

Initialize the FlakeDecoder instance.

decode(unique_id)

Decode a 64-bit unique ID.

Parameters:

Name Type Description Default
unique_id int

A 64-bit unique ID.

required

Returns:

Name Type Description
FlakeParts FlakeParts

A named tuple containing the timestamp, worker ID, and sequence number.