Class: Coil::QueueLocking::Key
- Inherits:
-
Object
- Object
- Coil::QueueLocking::Key
- Defined in:
- lib/coil/queue_locking.rb
Constant Summary collapse
- PREFIX =
"QueueLocking"
Instance Attribute Summary collapse
-
#int64 ⇒ Object
readonly
Returns the value of attribute int64.
-
#text ⇒ Object
readonly
Returns the value of attribute text.
Instance Method Summary collapse
-
#initialize(queue_type:, message_type:, message_key:) ⇒ Key
constructor
Construct a key suitable for obtaining a PostgreSQL advisory lock.
Constructor Details
#initialize(queue_type:, message_type:, message_key:) ⇒ Key
Construct a key suitable for obtaining a PostgreSQL advisory lock. www.postgresql.org/docs/current/explicit-locking.html#ADVISORY-LOCKS
14 15 16 17 |
# File 'lib/coil/queue_locking.rb', line 14 def initialize(queue_type:, message_type:, message_key:) @text = [PREFIX, queue_type, , stringify()].join("|") @int64 = Digest::SHA256.digest(@text).slice(0, 8).unpack1("q") end |
Instance Attribute Details
#int64 ⇒ Object (readonly)
Returns the value of attribute int64.
20 21 22 |
# File 'lib/coil/queue_locking.rb', line 20 def int64 @int64 end |
#text ⇒ Object (readonly)
Returns the value of attribute text.
19 20 21 |
# File 'lib/coil/queue_locking.rb', line 19 def text @text end |