module Plezi::Base::Identification

Public Instance Methods

pid() click to toggle source

returns a Plezi flavored pid UUID, used to set the pub/sub channel when scaling

# File lib/plezi/controller/identification.rb, line 9
def pid
   process_pid = ::Process.pid
   if @ppid != process_pid
      @pid = nil
      @ppid = process_pid
   end
   @pid ||= SecureRandom.urlsafe_base64.tap { |str| @prefix_len = str.length }
end
target2pid(target) click to toggle source

Extracts the machine part from a target's Global UUID

# File lib/plezi/controller/identification.rb, line 24
def target2pid(target)
   target ? target[0..(@prefix_len - 1)] : Plezi.app_name
end
target2uuid(target) click to toggle source

Converts a target Global UUID to a localized UUID

# File lib/plezi/controller/identification.rb, line 18
def target2uuid(target)
   return nil unless target.start_with? pid
   target[@prefix_len..-1].to_i
end