Feng hace 10 años
padre
commit
2f1c03a469
Se han modificado 3 ficheros con 10 adiciones y 3 borrados
  1. 8 2
      src/emqttd_guid.erl
  2. 1 0
      src/emqttd_log.erl
  3. 1 1
      src/emqttd_throttle.erl

+ 8 - 2
src/emqttd_guid.erl

@@ -38,6 +38,8 @@
 
 -module(emqttd_guid).
 
+-author("Feng Lee <feng@emqtt.io>").
+
 -export([gen/0, new/0, timestamp/1]).
 
 -define(MAX_SEQ, 16#FFFF).
@@ -54,17 +56,21 @@ gen() ->
         undefined        -> new();
         {_Ts, NPid, Seq} -> next(NPid, Seq)
     end,
-    put(guid, Guid), enc(Guid).
+    put(guid, Guid), bin(Guid).
 
 new() ->
     {ts(), npid(), 0}.
 
+-spec timestamp(guid()) -> integer().
+timestamp(<<Ts:64, _/binary>>) ->
+    Ts.
+
 next(NPid, Seq) when Seq >= ?MAX_SEQ ->
     {ts(), NPid, 0};
 next(NPid, Seq) ->
     {ts(), NPid, Seq + 1}.
 
-enc({Ts, NPid, Seq}) ->
+bin({Ts, NPid, Seq}) ->
     <<Ts:64, NPid:48, Seq:16>>.
 
 ts() ->

+ 1 - 0
src/emqttd_log.erl

@@ -26,6 +26,7 @@
 %%%-----------------------------------------------------------------------------
 
 %% TODO: issue #103
+%% 0.12.0 ???
 
 -module(emqttd_log).
 

+ 1 - 1
src/emqttd_throttle.erl

@@ -28,5 +28,5 @@
 
 -author("Feng Lee <feng@emqtt.io>").
 
-%% TODO:... 0.10.0...
+%% TODO:... 0.11.0...