Universally Unique Identifiers


Functions

gboolean midgard_is_uuid (const gchar *uuid)
gchar * midgard_uuid_new (void)
gchar * midgard_uuid_external (const gchar *external)

Detailed Description

This is a simple implementation of the RFC 4122 type 1 and type 3 UUIDs used as Midgard Globally Unique Identifiers (GUIDs).

Type 1 UUIDs are generated using a random per-process node identifier. This makes the generated UUIDs a bit less unique, but remove the need for persistent state and inter-process synchronization.

Type 3 UUIDs are generated using the special Midgard namespace UUID 00dc46a0-0e0c-1085-82bb-0002a5d5fd2e as the namespace.

The UUID functions should only be called directly if an explicit UUID is needed. The more general GUID functions should be used for object identifiers and other normal GUIDs. Although the GUID functions normally use the UUID functions internally, they make it possible to specify database-specific GUID generators or constraints.


Function Documentation

gboolean midgard_is_uuid const gchar *  uuid  ) 
 

Checks whether the given string matches the UUID format.

Parameters:
[in] uuid the potential UUID string
Returns:
TRUE if the given string is a UUID, FALSE otherwise

Definition at line 23 of file uuid.c.

gchar* midgard_uuid_external const gchar *  external  ) 
 

Generates a name-based (type 3) UUID string from the given external identifier. The special Midgard namespace UUID 00dc46a0-0e0c-1085-82bb-0002a5d5fd2e is used as the namespace of the generated UUID.

Parameters:
[in] external the external identifier
Returns:
UUID string (newly allocated)

Definition at line 107 of file uuid.c.

Referenced by midgard_guid_external().

gchar* midgard_uuid_new void   ) 
 

Generates a new UUID string. The returned UUID is a time-based time 1 UUID. A random per-process node identifier is used to avoid keeping global state and maintaining inter-process synchronization.

Returns:
UUID string (newly allocated)

Definition at line 47 of file uuid.c.

Referenced by midgard_guid_new().


Generated on Thu Feb 22 06:15:21 2007 for midgard-core by  doxygen 1.4.6