summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMatthew Sackman <matthew@lshift.net>2010-04-24 14:20:49 +0100
committerMatthew Sackman <matthew@lshift.net>2010-04-24 14:20:49 +0100
commita11602c05cc18553325f2a2f87d43c7d1617e2f4 (patch)
treed8b5933ce9f784aa686c6c3bf640ccd2e48ad276 /src
parentb5371af45771885b58ac84bcc27972ebeb8224e0 (diff)
parenta612c922bced1725dbcf7e5365d57fc3ceec17c1 (diff)
downloadrabbitmq-server-git-a11602c05cc18553325f2a2f87d43c7d1617e2f4.tar.gz
merging bug 22647 into default
Diffstat (limited to 'src')
-rw-r--r--src/rabbit_guid.erl12
1 files changed, 5 insertions, 7 deletions
diff --git a/src/rabbit_guid.erl b/src/rabbit_guid.erl
index 45e6c1b7ff..1ae8f7dac4 100644
--- a/src/rabbit_guid.erl
+++ b/src/rabbit_guid.erl
@@ -78,7 +78,7 @@ update_disk_serial() ->
end,
Serial.
-%% generate a guid that is monotonically increasing per process.
+%% generate a GUID.
%%
%% The id is only unique within a single cluster and as long as the
%% serial store hasn't been deleted.
@@ -92,20 +92,18 @@ guid() ->
%% A persisted serial number, in combination with self/0 (which
%% includes the node name) uniquely identifies a process in space
%% and time. We combine that with a process-local counter to give
- %% us a GUID that is monotonically increasing per process.
+ %% us a GUID.
G = case get(guid) of
undefined -> {{gen_server:call(?SERVER, serial, infinity), self()},
0};
{S, I} -> {S, I+1}
end,
put(guid, G),
- G.
+ erlang:md5(term_to_binary(G)).
-%% generate a readable string representation of a guid. Note that any
-%% monotonicity of the guid is not preserved in the encoding.
+%% generate a readable string representation of a GUID.
string_guid(Prefix) ->
- Prefix ++ "-" ++ base64:encode_to_string(
- erlang:md5(term_to_binary(guid()))).
+ Prefix ++ "-" ++ base64:encode_to_string(guid()).
binstring_guid(Prefix) ->
list_to_binary(string_guid(Prefix)).