View Source SnowflakeIdx (snowflake_idx v1.0.1)
fast snowflake id generator
Summary
Functions
next_id operation guarantee atomicity
Types
@type machine_id_value() :: non_neg_integer()
@type ref() :: :atomics.atomics_ref()
@type seq_value() :: non_neg_integer()
@type timestamp_value() :: non_neg_integer()
@type uid_value() :: non_neg_integer()
Functions
@spec extract_id(ref(), uid_value()) :: {machine_id_value(), timestamp_value(), seq_value()}
Link to this function
init(machine_id, machine_id_bits \\ 10, timestamp_bits \\ 42, seq_bits \\ 12)
View Source@spec init( machine_id_value(), non_neg_integer(), non_neg_integer(), non_neg_integer() ) :: {:ok, ref()} | :error_invalid_bits | :error_exceed_machine_id_bits
next_id operation guarantee atomicity