Module couchdb_uuids


Behaviours: gen_server.

Function Index

new/0Generate a new uuid.
set_algorithm/1Set the algorithm used for uuid genration.

Function Details

new/0

new() -> binary()

Generate a new uuid

At start time, default the algorithm will be set to random should you require a different algorithm use the function set_algorithm/1 first.

set_algorithm/1

set_algorithm(Algorithm::term()) -> {ok, term() | {error, term()}}

Set the algorithm used for uuid genration

Available algorithms:

random: 128 bits of random awesome.

sequential: Monotonically increasing ids with random increments. The first 26 hex characters are random, the last 6 increment in random amounts until an overflow occurs. On overflow, the random prefix is regenerated and the process starts over.

utc_random: The time since Jan 1, 1970 UTC, in microseconds. The first 14 characters are the time in hex. The last 18 are random.

utc_id: The time since Jan 1, 1970 UTC, in microseconds, plus the utc_id_suffix string. The first 14 characters are the time in hex. The uuids/utc_id_suffix string value is appended to these.

Usage:
       set_algorithm(random).
       set_algorithm(utc_random).
       set_algorithm(sequential).
       set_algorithm({utc_id, <<"suffix">>).


erlang logo

Made with EDoc-S