Module: ASIR::Identity
Overview
!SLIDE Message Identity
Constant Summary collapse
- @@uuid_pid =
nil
Instance Attribute Summary collapse
-
#client ⇒ Object
Optional: Opaque data about the Client that created the Message.
-
#identifier ⇒ Object
Returns the value of attribute identifier.
-
#server ⇒ Object
Optional: Opaque data about the Service that handled the Result.
-
#timestamp ⇒ Object
Returns the value of attribute timestamp.
Instance Method Summary collapse
-
#create_identifier! ⇒ Object
Creates a thread-safe unique identifier.
-
#create_timestamp! ⇒ Object
Creates a timestamp.
Instance Attribute Details
#client ⇒ Object
Optional: Opaque data about the Client that created the Message.
12 13 14 |
# File 'lib/asir/identity.rb', line 12 def client @client end |
#identifier ⇒ Object
Returns the value of attribute identifier.
9 10 11 |
# File 'lib/asir/identity.rb', line 9 def identifier @identifier end |
#server ⇒ Object
Optional: Opaque data about the Service that handled the Result.
15 16 17 |
# File 'lib/asir/identity.rb', line 15 def server @server end |
#timestamp ⇒ Object
Returns the value of attribute timestamp.
9 10 11 |
# File 'lib/asir/identity.rb', line 9 def @timestamp end |
Instance Method Details
#create_identifier! ⇒ Object
Creates a thread-safe unique identifier.
18 19 20 21 22 23 24 25 26 27 |
# File 'lib/asir/identity.rb', line 18 def create_identifier! @identifier ||= @@identifier_mutex.synchronize do if @@uuid_pid != $$ @@uuid_pid = $$ @@uuid = nil end "#{@@counter += 1}-#{@@uuid ||= ::ASIR::UUID.generate}".freeze end end |
#create_timestamp! ⇒ Object
Creates a timestamp.
31 32 33 34 |
# File 'lib/asir/identity.rb', line 31 def @timestamp ||= ::Time.now.gmtime end |