redis_queued_locks 1.16.2 → 1.18.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (80) hide show
  1. checksums.yaml +4 -4
  2. data/.claude/project-overview.md +281 -0
  3. data/.claude/rules/acquirer.md +81 -0
  4. data/.claude/rules/arguments.md +60 -0
  5. data/.claude/rules/git.md +46 -0
  6. data/.claude/rules/logic.md +63 -0
  7. data/.claude/rules/swarm.md +120 -0
  8. data/.claude/rules/tests.md +48 -0
  9. data/.claude/rules/type-checking.md +50 -0
  10. data/.claude/rules/visitors.md +69 -0
  11. data/.rubocop.rbs.yml +31 -0
  12. data/.rubocop.yml +3 -3
  13. data/.ruby-version +1 -1
  14. data/CHANGELOG.md +80 -0
  15. data/CLAUDE.md +36 -0
  16. data/README.md +367 -82
  17. data/Rakefile +31 -2
  18. data/github_ci/.keep +0 -0
  19. data/lib/redis_queued_locks/acquirer/acquire_lock/delay_execution.rb +2 -2
  20. data/lib/redis_queued_locks/acquirer/acquire_lock/dequeue_from_lock_queue/log_visitor.rb +6 -3
  21. data/lib/redis_queued_locks/acquirer/acquire_lock/dequeue_from_lock_queue.rb +9 -7
  22. data/lib/redis_queued_locks/acquirer/acquire_lock/instr_visitor.rb +20 -10
  23. data/lib/redis_queued_locks/acquirer/acquire_lock/log_visitor.rb +34 -16
  24. data/lib/redis_queued_locks/acquirer/acquire_lock/try_to_lock/log_visitor.rb +240 -28
  25. data/lib/redis_queued_locks/acquirer/acquire_lock/try_to_lock.rb +398 -132
  26. data/lib/redis_queued_locks/acquirer/acquire_lock/yield_expire/log_visitor.rb +12 -6
  27. data/lib/redis_queued_locks/acquirer/acquire_lock/yield_expire.rb +33 -9
  28. data/lib/redis_queued_locks/acquirer/acquire_lock.rb +73 -24
  29. data/lib/redis_queued_locks/acquirer/clear_dead_requests.rb +9 -1
  30. data/lib/redis_queued_locks/acquirer/extend_lock_ttl.rb +182 -3
  31. data/lib/redis_queued_locks/acquirer/is_locked.rb +19 -2
  32. data/lib/redis_queued_locks/acquirer/is_queued.rb +6 -2
  33. data/lib/redis_queued_locks/acquirer/lock_info.rb +96 -6
  34. data/lib/redis_queued_locks/acquirer/lock_series_poc/instr_visitor.rb +8 -4
  35. data/lib/redis_queued_locks/acquirer/lock_series_poc/log_visitor.rb +18 -7
  36. data/lib/redis_queued_locks/acquirer/lock_series_poc.rb +126 -29
  37. data/lib/redis_queued_locks/acquirer/locks.rb +103 -6
  38. data/lib/redis_queued_locks/acquirer/queue_info.rb +38 -9
  39. data/lib/redis_queued_locks/acquirer/queues.rb +28 -4
  40. data/lib/redis_queued_locks/acquirer/release_all_locks.rb +35 -1
  41. data/lib/redis_queued_locks/acquirer/release_lock.rb +40 -9
  42. data/lib/redis_queued_locks/acquirer/release_locks_of.rb +43 -3
  43. data/lib/redis_queued_locks/acquirer/release_read_lock.rb +143 -0
  44. data/lib/redis_queued_locks/acquirer.rb +1 -0
  45. data/lib/redis_queued_locks/client.rb +274 -158
  46. data/lib/redis_queued_locks/config/dsl.rb +4 -10
  47. data/lib/redis_queued_locks/resource.rb +117 -9
  48. data/lib/redis_queued_locks/swarm/flush_zombies.rb +46 -6
  49. data/lib/redis_queued_locks/swarm/supervisor.rb +1 -1
  50. data/lib/redis_queued_locks/swarm/swarm_element/isolated.rb +166 -44
  51. data/lib/redis_queued_locks/swarm/swarm_element/threaded.rb +45 -47
  52. data/lib/redis_queued_locks/swarm/zombie_info.rb +42 -0
  53. data/lib/redis_queued_locks/version.rb +2 -2
  54. data/rbs_collection.lock.yaml +10 -2
  55. data/rbs_collection.yaml +0 -2
  56. data/redis_queued_locks.gemspec +1 -1
  57. data/sig/redis_queued_locks/acquirer/acquire_lock/dequeue_from_lock_queue/log_visitor.rbs +2 -1
  58. data/sig/redis_queued_locks/acquirer/acquire_lock/dequeue_from_lock_queue.rbs +0 -1
  59. data/sig/redis_queued_locks/acquirer/acquire_lock/instr_visitor.rbs +5 -0
  60. data/sig/redis_queued_locks/acquirer/acquire_lock/log_visitor.rbs +12 -6
  61. data/sig/redis_queued_locks/acquirer/acquire_lock/try_to_lock/log_visitor.rbs +74 -7
  62. data/sig/redis_queued_locks/acquirer/acquire_lock/try_to_lock.rbs +4 -2
  63. data/sig/redis_queued_locks/acquirer/acquire_lock/yield_expire.rbs +3 -0
  64. data/sig/redis_queued_locks/acquirer/acquire_lock/yield_with_expire/log_visitor.rbs +4 -2
  65. data/sig/redis_queued_locks/acquirer/extend_lock_ttl.rbs +19 -1
  66. data/sig/redis_queued_locks/acquirer/lock_info.rbs +9 -1
  67. data/sig/redis_queued_locks/acquirer/locks.rbs +10 -1
  68. data/sig/redis_queued_locks/acquirer/queue_info.rbs +2 -4
  69. data/sig/redis_queued_locks/acquirer/queues.rbs +1 -1
  70. data/sig/redis_queued_locks/acquirer/release_lock.rbs +8 -1
  71. data/sig/redis_queued_locks/acquirer/release_read_lock.rbs +44 -0
  72. data/sig/redis_queued_locks/client.rbs +22 -2
  73. data/sig/redis_queued_locks/resource.rbs +9 -2
  74. data/sig/redis_queued_locks/swarm/flush_zombies.rbs +1 -1
  75. data/sig/redis_queued_locks/swarm/swarm_element/isolated.rbs +13 -5
  76. data/sig/redis_queued_locks/swarm/swarm_element/threaded.rbs +6 -6
  77. data/sig/redis_queued_locks/swarm/zombie_info.rbs +5 -0
  78. metadata +17 -5
  79. data/github_ci/ruby3.3.gemfile +0 -17
  80. data/github_ci/ruby3.3.gemfile.lock +0 -216
@@ -125,20 +125,16 @@ class RedisQueuedLocks::Swarm::SwarmElement::Threaded
125
125
  #
126
126
  # @api private
127
127
  # @since 1.9.0
128
- # rubocop:disable Style/RedundantBegin
128
+ # @version 1.17.0
129
129
  def status
130
130
  sync.synchronize do
131
131
  thread_running = swarmed__alive?
132
132
  thread_state = swarmed? ? thread_state(swarm_element) : 'non_initialized' # steep:ignore
133
133
 
134
134
  main_loop_running = swarmed__running?
135
- main_loop_state = begin
136
- if main_loop_running
137
- swarm_loop__status[:result][:main_loop][:state] # steep:ignore
138
- else
139
- 'non_initialized'
140
- end
141
- end
135
+ # NOTE: `nil` when the element is not alive (or has been terminated during the request);
136
+ loop_status = swarm_loop__status if main_loop_running
137
+ main_loop_state = loop_status ? loop_status[:state] : 'non_initialized'
142
138
 
143
139
  {
144
140
  enabled: enabled?,
@@ -153,7 +149,6 @@ class RedisQueuedLocks::Swarm::SwarmElement::Threaded
153
149
  }
154
150
  end
155
151
  end
156
- # rubocop:enable Style/RedundantBegin
157
152
 
158
153
  private
159
154
 
@@ -169,7 +164,7 @@ class RedisQueuedLocks::Swarm::SwarmElement::Threaded
169
164
  #
170
165
  # @api private
171
166
  # @since 1.9.0
172
- # rubocop:disable Metrics/MethodLength
167
+ # @version 1.17.0
173
168
  def swarm!
174
169
  # NOTE: kill the main loop at start to prevent any async-thread-race-based memory leaks;
175
170
  main_loop&.kill
@@ -187,42 +182,37 @@ class RedisQueuedLocks::Swarm::SwarmElement::Threaded
187
182
  main_loop_alive = main_loop != nil && main_loop.alive?
188
183
  # steep:ignore:end
189
184
 
190
- # steep:ignore:start
191
185
  main_loop_state = (main_loop == nil) ? 'non_initialized' : thread_state(main_loop)
192
- # steep:ignore:end
193
186
 
194
187
  # steep:ignore:start
195
- swarm_element_results.push({
196
- ok: true,
197
- result: { main_loop: { alive: main_loop_alive, state: main_loop_state } }
198
- })
188
+ swarm_element_results.push({ alive: main_loop_alive, state: main_loop_state })
199
189
  # steep:ignore:end
200
190
  when :is_active
201
- is_active = main_loop != nil && main_loop.alive? # steep:ignore
202
- swarm_element_results.push({ ok: true, result: { is_active: } }) # steep:ignore
191
+ swarm_element_results.push(main_loop != nil && main_loop.alive?) # steep:ignore
203
192
  when :start
204
193
  main_loop&.kill
205
194
  @main_loop = spawn_main_loop!.tap { |thread| thread.abort_on_exception = false }
206
- swarm_element_results.push({ ok: true, result: nil }) # steep:ignore
195
+ swarm_element_results.push(true) # steep:ignore
207
196
  when :stop
208
197
  main_loop&.kill
209
- swarm_element_results.push({ ok: true, result: nil }) # steep:ignore
198
+ swarm_element_results.push(true) # steep:ignore
210
199
  end
211
200
  end
212
201
  end
213
202
  end
214
- # rubocop:enable Metrics/MethodLength
215
203
 
216
204
  # @return [Thread] Thread with #abort_onexception == false that wraps loop'ed logic;
217
205
  #
218
206
  # @api private
219
207
  # @since 1.9.0
220
- def spawn_main_loop! # steep:ignore
208
+ # @version 1.17.0
209
+ def spawn_main_loop!
221
210
  # NOTE:
222
211
  # - provide the swarm element looped logic here wrapped into the thread;
223
212
  # - created thread will be reconfigured inside the swarm_element logic with a
224
213
  # `abort_on_exception = false` (cuz the stauts of the thread is
225
214
  # totally controlled by the @swarm_element's logic);
215
+ raise NotImplementedError, "#{self.class}#spawn_main_loop! is not implemented"
226
216
  end
227
217
 
228
218
  # @return [Boolean]
@@ -261,10 +251,9 @@ class RedisQueuedLocks::Swarm::SwarmElement::Threaded
261
251
  #
262
252
  # @api private
263
253
  # @since 1.9.0
254
+ # @version 1.17.0
264
255
  def swarmed__running?
265
- swarmed__alive? && !terminating? && (swarm_loop__is_active.yield_self do |result|
266
- result != nil && result[:ok] && result[:result][:is_active] # steep:ignore
267
- end)
256
+ swarmed__alive? && !terminating? && swarm_loop__is_active == true
268
257
  end
269
258
 
270
259
  # @return [Boolean,NilClass]
@@ -284,57 +273,66 @@ class RedisQueuedLocks::Swarm::SwarmElement::Threaded
284
273
  #
285
274
  # @api private
286
275
  # @since 1.9.0
276
+ # @version 1.17.0
287
277
  def swarmed__stopped?
288
- swarmed__alive? && (terminating? || !(swarm_loop__is_active.yield_self do |result|
289
- result && result[:ok] && result[:result][:is_active] # steep:ignore
290
- end))
278
+ # NOTE: `nil` (no answer) is treated as "not active";
279
+ swarmed__alive? && (terminating? || swarm_loop__is_active != true)
291
280
  end
292
281
 
293
- # @return [Boolean,NilClass]
282
+ # @return [Boolean,NilClass] Is the main loop alive (`nil` when the element is not available).
294
283
  #
295
284
  # @api private
296
285
  # @since 1.9.0
286
+ # @version 1.17.0
297
287
  def swarm_loop__is_active
298
- return if idle? || swarmed__dead? || terminating?
299
- sync.synchronize do
300
- swarm_element_commands.push(:is_active) # steep:ignore
301
- swarm_element_results.pop # steep:ignore
302
- end
288
+ swarm_loop__send_command(:is_active) #: bool?
303
289
  end
304
290
 
305
- # @return [Hash,NilClass]
291
+ # @return [Hash<Symbol,Boolean|String>,NilClass]
292
+ # Format: `{ alive: <Boolean>, state: <String> }` (`nil` when the element is not available).
306
293
  #
307
294
  # @api private
308
295
  # @since 1.9.0
296
+ # @version 1.17.0
309
297
  def swarm_loop__status
310
- return if idle? || swarmed__dead? || terminating?
311
- sync.synchronize do
312
- swarm_element_commands.push(:status) # steep:ignore
313
- swarm_element_results.pop # steep:ignore
314
- end
298
+ swarm_loop__send_command(:status) #: swarmLoopStatus?
315
299
  end
316
300
 
317
301
  # @return [void]
318
302
  #
319
303
  # @api private
320
304
  # @since 1.9.0
305
+ # @version 1.17.0
321
306
  def swarm_loop__start
322
- return if idle? || swarmed__dead? || terminating?
323
- sync.synchronize do
324
- swarm_element_commands.push(:start) # steep:ignore
325
- swarm_element_results.pop # steep:ignore
326
- end
307
+ swarm_loop__send_command(:start)
327
308
  end
328
309
 
329
310
  # @return [void]
330
311
  #
331
312
  # @api private
332
313
  # @since 1.9.0
314
+ # @version 1.17.0
333
315
  def swarm_loop__stop
316
+ swarm_loop__send_command(:stop)
317
+ end
318
+
319
+ # Sends the command to the control thread and waits for its reply. Replies are received
320
+ # strictly one by one under the lock, so each reply belongs to the sent command.
321
+ #
322
+ # @param command [Symbol]
323
+ # @return [Boolean,Hash<Symbol,Boolean|String>,NilClass]
324
+ # The bare reply value (see #swarm!) or `nil` if the element is not available.
325
+ #
326
+ # @api private
327
+ # @since 1.17.0
328
+ def swarm_loop__send_command(command)
334
329
  return if idle? || swarmed__dead? || terminating?
335
330
  sync.synchronize do
336
- swarm_element_commands.push(:stop) # steep:ignore
337
- swarm_element_results.pop # steep:ignore
331
+ commands = swarm_element_commands
332
+ results = swarm_element_results
333
+ next if commands == nil || results == nil
334
+ commands.push(command)
335
+ results.pop
338
336
  end
339
337
  end
340
338
 
@@ -83,6 +83,7 @@ module RedisQueuedLocks::Swarm::ZombieInfo
83
83
  #
84
84
  # @api private
85
85
  # @since 1.9.0
86
+ # @version 1.18.0
86
87
  def extract_zombie_locks(rconn, zombie_ttl, lock_scan_size)
87
88
  zombie_hosts = extract_zombie_hosts(rconn, zombie_ttl)
88
89
  zombie_locks = Set.new
@@ -92,6 +93,10 @@ module RedisQueuedLocks::Swarm::ZombieInfo
92
93
  _acquirer_id, host_id = rconn.call('HMGET', lock_key, 'acq_id', 'hst_id')
93
94
  zombie_locks << lock_key if zombie_hosts.include?(host_id)
94
95
  end
96
+ # NOTE: (RW) readers registries with zombie read locks
97
+ each_zombie_read_lock(rconn, zombie_hosts, lock_scan_size) do |lock_readers_key, _acquirer_id|
98
+ zombie_locks << lock_readers_key
99
+ end
95
100
  zombie_locks
96
101
  end
97
102
 
@@ -102,6 +107,7 @@ module RedisQueuedLocks::Swarm::ZombieInfo
102
107
  #
103
108
  # @api private
104
109
  # @since 1.9.0
110
+ # @version 1.18.0
105
111
  def extract_zombie_acquirers(rconn, zombie_ttl, lock_scan_size)
106
112
  zombie_hosts = extract_zombie_hosts(rconn, zombie_ttl)
107
113
  zombie_acquirers = Set.new
@@ -111,6 +117,10 @@ module RedisQueuedLocks::Swarm::ZombieInfo
111
117
  acquirer_id, host_id = rconn.call('HMGET', lock_key, 'acq_id', 'hst_id')
112
118
  zombie_acquirers << acquirer_id if zombie_hosts.include?(host_id)
113
119
  end
120
+ # NOTE: (RW) zombie read lock acquirers
121
+ each_zombie_read_lock(rconn, zombie_hosts, lock_scan_size) do |_lock_readers_key, acquirer_id|
122
+ zombie_acquirers << acquirer_id
123
+ end
114
124
  zombie_acquirers
115
125
  end
116
126
 
@@ -126,6 +136,7 @@ module RedisQueuedLocks::Swarm::ZombieInfo
126
136
  #
127
137
  # @api private
128
138
  # @since 1.9.0
139
+ # @version 1.18.0
129
140
  def extract_all(rconn, zombie_ttl, lock_scan_size)
130
141
  zombie_hosts = extract_zombie_hosts(rconn, zombie_ttl)
131
142
  zombie_locks = Set.new
@@ -139,7 +150,38 @@ module RedisQueuedLocks::Swarm::ZombieInfo
139
150
  zombie_locks << lock_key
140
151
  end
141
152
  end
153
+ # NOTE: (RW) zombie read locks
154
+ each_zombie_read_lock(rconn, zombie_hosts, lock_scan_size) do |lock_readers_key, acquirer_id|
155
+ zombie_acquirers << acquirer_id
156
+ zombie_locks << lock_readers_key
157
+ end
142
158
  { zombie_hosts:, zombie_acquirers:, zombie_locks: }
143
159
  end
160
+
161
+ # Iterates over read locks of zombie hosts
162
+ # (read locks store acquirer ids only: the host is a part of the acquirer id).
163
+ #
164
+ # @param rconn [RedisClient] redis connection obtained via `#with` from RedisClient instance;
165
+ # @param zombie_hosts [Set<String>]
166
+ # @param lock_scan_size [Integer]
167
+ # @yield [lock_readers_key, acquirer_id]
168
+ # @yieldparam lock_readers_key [String] Readers registry with a zombie read lock.
169
+ # @yieldparam acquirer_id [String] Zombie read lock acquirer.
170
+ # @return [void]
171
+ #
172
+ # @api private
173
+ # @since 1.18.0
174
+ def each_zombie_read_lock(rconn, zombie_hosts, lock_scan_size)
175
+ rconn.scan(
176
+ 'MATCH', RedisQueuedLocks::Resource::LOCK_READERS_PATTERN, count: lock_scan_size
177
+ ) do |lock_readers_key|
178
+ # @type var read_lock_acquirers: Array[String]
179
+ read_lock_acquirers = rconn.call('ZRANGE', lock_readers_key, '0', '-1')
180
+ read_lock_acquirers.each do |acquirer_id|
181
+ host_id = RedisQueuedLocks::Resource.host_identifier_from_acquirer(acquirer_id)
182
+ yield(lock_readers_key, acquirer_id) if zombie_hosts.include?(host_id)
183
+ end
184
+ end
185
+ end
144
186
  end
145
187
  end
@@ -5,6 +5,6 @@ module RedisQueuedLocks
5
5
  #
6
6
  # @api public
7
7
  # @since 0.0.1
8
- # @version 1.16.2
9
- VERSION = '1.16.2'
8
+ # @version 1.17.0
9
+ VERSION = '1.18.0'
10
10
  end
@@ -6,14 +6,22 @@ gems:
6
6
  source:
7
7
  type: git
8
8
  name: ruby/gem_rbs_collection
9
- revision: 52a7ef8a9328fb2413e3b42dd8ee37deb703a940
9
+ revision: c69c75ba79d7c19870f8d0e6fa7fe2c1d356e5ae
10
10
  remote: https://github.com/ruby/gem_rbs_collection.git
11
11
  repo_dir: gems
12
12
  - name: logger
13
+ version: '1.7'
14
+ source:
15
+ type: git
16
+ name: ruby/gem_rbs_collection
17
+ revision: c69c75ba79d7c19870f8d0e6fa7fe2c1d356e5ae
18
+ remote: https://github.com/ruby/gem_rbs_collection.git
19
+ repo_dir: gems
20
+ - name: monitor
13
21
  version: '0'
14
22
  source:
15
23
  type: stdlib
16
- - name: monitor
24
+ - name: random-formatter
17
25
  version: '0'
18
26
  source:
19
27
  type: stdlib
data/rbs_collection.yaml CHANGED
@@ -11,7 +11,5 @@ gems:
11
11
  - name: redis-client
12
12
  - name: securerandom
13
13
  - name: timeout
14
- - name: redis-client
15
- - name: securerandom
16
14
  - name: logger
17
15
  - name: monitor
@@ -3,7 +3,7 @@
3
3
  require_relative 'lib/redis_queued_locks/version'
4
4
 
5
5
  Gem::Specification.new do |spec|
6
- spec.required_ruby_version = '>= 3.3'
6
+ spec.required_ruby_version = '>= 4.0'
7
7
 
8
8
  spec.name = 'redis_queued_locks'
9
9
  spec.version = RedisQueuedLocks::VERSION
@@ -12,7 +12,8 @@ module RedisQueuedLocks
12
12
  Integer queue_ttl,
13
13
  String acquirer_id,
14
14
  String host_id,
15
- Symbol access_strategy
15
+ Symbol access_strategy,
16
+ Symbol rw_mode
16
17
  ) -> void
17
18
  end
18
19
  end
@@ -12,7 +12,6 @@ module RedisQueuedLocks
12
12
  Symbol read_write_mode,
13
13
  String lock_key_queue,
14
14
  String read_lock_key_queue,
15
- String write_lock_key_queue,
16
15
  Integer queue_ttl,
17
16
  String acquirer_id,
18
17
  String host_id,
@@ -8,6 +8,7 @@ module RedisQueuedLocks
8
8
  RQL::instrObj instrumenter,
9
9
  bool instr_sampled,
10
10
  String lock_key,
11
+ Symbol rw_mode,
11
12
  Integer? ttl,
12
13
  String acq_id,
13
14
  String hst_id,
@@ -20,6 +21,7 @@ module RedisQueuedLocks
20
21
  RQL::instrObj instrumenter,
21
22
  bool instr_sampled,
22
23
  String lock_key,
24
+ Symbol rw_mode,
23
25
  Integer? ttl,
24
26
  String acq_id,
25
27
  String hst_id,
@@ -32,6 +34,7 @@ module RedisQueuedLocks
32
34
  RQL::instrObj instrumenter,
33
35
  bool instr_sampled,
34
36
  String lock_key,
37
+ Symbol rw_mode,
35
38
  Integer? ttl,
36
39
  String acq_id,
37
40
  String hst_id,
@@ -44,6 +47,7 @@ module RedisQueuedLocks
44
47
  RQL::instrObj instrumenter,
45
48
  bool instr_sampled,
46
49
  String lock_key,
50
+ Symbol rw_mode,
47
51
  Integer? ttl,
48
52
  String acq_id,
49
53
  String hst_id,
@@ -57,6 +61,7 @@ module RedisQueuedLocks
57
61
  RQL::instrObj instrumenter,
58
62
  bool instr_sampled,
59
63
  String lock_key,
64
+ Symbol rw_mode,
60
65
  Integer? ttl,
61
66
  String acq_id,
62
67
  String hst_id,
@@ -11,7 +11,8 @@ module RedisQueuedLocks
11
11
  Integer queue_ttl,
12
12
  String acquirer_id,
13
13
  String host_id,
14
- Symbol access_strategy
14
+ Symbol access_strategy,
15
+ Symbol rw_mode
15
16
  ) -> void
16
17
 
17
18
  def self.start_try_to_lock_cycle: (
@@ -21,7 +22,8 @@ module RedisQueuedLocks
21
22
  Integer queue_ttl,
22
23
  String acquirer_id,
23
24
  String host_id,
24
- Symbol access_strategy
25
+ Symbol access_strategy,
26
+ Symbol rw_mode
25
27
  ) -> void
26
28
 
27
29
  def self.dead_score_reached__reset_acquirer_position: (
@@ -31,7 +33,8 @@ module RedisQueuedLocks
31
33
  Integer queue_ttl,
32
34
  String acquirer_id,
33
35
  String host_id,
34
- Symbol access_strategy
36
+ Symbol access_strategy,
37
+ Symbol rw_mode
35
38
  ) -> void
36
39
 
37
40
  def self.extendable_reentrant_lock_obtained: (
@@ -42,7 +45,8 @@ module RedisQueuedLocks
42
45
  String acquirer_id,
43
46
  String host_id,
44
47
  Integer|Float acq_time,
45
- Symbol access_strategy
48
+ Symbol access_strategy,
49
+ Symbol rw_mode
46
50
  ) -> void
47
51
 
48
52
  def self.reentrant_lock_obtained: (
@@ -53,7 +57,8 @@ module RedisQueuedLocks
53
57
  String acquirer_id,
54
58
  String host_id,
55
59
  Integer|Float acq_time,
56
- Symbol access_strategy
60
+ Symbol access_strategy,
61
+ Symbol rw_mode
57
62
  ) -> void
58
63
 
59
64
  def self.lock_obtained: (
@@ -64,7 +69,8 @@ module RedisQueuedLocks
64
69
  String acquirer_id,
65
70
  String host_id,
66
71
  Integer|Float acq_time,
67
- Symbol access_strategy
72
+ Symbol access_strategy,
73
+ Symbol rw_mode
68
74
  ) -> void
69
75
  end
70
76
  end
@@ -13,7 +13,8 @@ module RedisQueuedLocks
13
13
  Integer queue_ttl,
14
14
  String acquirer_id,
15
15
  String host_id,
16
- Symbol access_strategy
16
+ Symbol access_strategy,
17
+ Symbol rw_mode
17
18
  ) -> void
18
19
 
19
20
  def self.rconn_fetched: (
@@ -24,7 +25,8 @@ module RedisQueuedLocks
24
25
  Integer queue_ttl,
25
26
  String acquirer_id,
26
27
  String host_id,
27
- Symbol access_strategy
28
+ Symbol access_strategy,
29
+ Symbol rw_mode
28
30
  ) -> void
29
31
 
30
32
  def self.same_process_conflict_detected: (
@@ -35,7 +37,8 @@ module RedisQueuedLocks
35
37
  Integer queue_ttl,
36
38
  String acquirer_id,
37
39
  String host_id,
38
- Symbol access_strategy
40
+ Symbol access_strategy,
41
+ Symbol rw_mode
39
42
  ) -> void
40
43
 
41
44
  def self.same_process_conflict_analyzed: (
@@ -47,6 +50,7 @@ module RedisQueuedLocks
47
50
  String acquirer_id,
48
51
  String host_id,
49
52
  Symbol access_strategy,
53
+ Symbol rw_mode,
50
54
  Symbol sp_conflict_status
51
55
  ) -> void
52
56
 
@@ -59,6 +63,7 @@ module RedisQueuedLocks
59
63
  String acquirer_id,
60
64
  String host_id,
61
65
  Symbol access_strategy,
66
+ Symbol rw_mode,
62
67
  Symbol sp_conflict_status,
63
68
  Integer? ttl,
64
69
  ::Float spc_processed_timestamp
@@ -73,6 +78,7 @@ module RedisQueuedLocks
73
78
  String acquirer_id,
74
79
  String host_id,
75
80
  Symbol access_strategy,
81
+ Symbol rw_mode,
76
82
  Symbol sp_conflict_status,
77
83
  ::Float spc_processed_timestamp
78
84
  ) -> void
@@ -86,6 +92,21 @@ module RedisQueuedLocks
86
92
  String acquirer_id,
87
93
  String host_id,
88
94
  Symbol access_strategy,
95
+ Symbol rw_mode,
96
+ Symbol sp_conflict_status,
97
+ ::Float spc_processed_timestamp
98
+ ) -> void
99
+
100
+ def self.single_process_lock_conflict__lock_upgrade: (
101
+ RQL::loggerObj logger,
102
+ bool log_sampled,
103
+ bool log_lock_try,
104
+ String lock_key,
105
+ Integer queue_ttl,
106
+ String acquirer_id,
107
+ String host_id,
108
+ Symbol access_strategy,
109
+ Symbol rw_mode,
89
110
  Symbol sp_conflict_status,
90
111
  ::Float spc_processed_timestamp
91
112
  ) -> void
@@ -98,7 +119,8 @@ module RedisQueuedLocks
98
119
  Integer queue_ttl,
99
120
  String acquirer_id,
100
121
  String host_id,
101
- Symbol access_strategy
122
+ Symbol access_strategy,
123
+ Symbol rw_mode
102
124
  ) -> void
103
125
 
104
126
  def self.remove_expired_acqs: (
@@ -109,7 +131,8 @@ module RedisQueuedLocks
109
131
  Integer queue_ttl,
110
132
  String acquirer_id,
111
133
  String host_id,
112
- Symbol access_strategy
134
+ Symbol access_strategy,
135
+ Symbol rw_mode
113
136
  ) -> void
114
137
 
115
138
  def self.get_first_from_queue: (
@@ -121,6 +144,7 @@ module RedisQueuedLocks
121
144
  String acquirer_id,
122
145
  String host_id,
123
146
  Symbol access_strategy,
147
+ Symbol rw_mode,
124
148
  String? waiting_acquirer
125
149
  ) -> void
126
150
 
@@ -132,7 +156,8 @@ module RedisQueuedLocks
132
156
  Integer queue_ttl,
133
157
  String acquirer_id,
134
158
  String host_id,
135
- Symbol access_strategy
159
+ Symbol access_strategy,
160
+ Symbol rw_mode
136
161
  ) -> void
137
162
 
138
163
  def self.exit__no_first: (
@@ -144,6 +169,7 @@ module RedisQueuedLocks
144
169
  String acquirer_id,
145
170
  String host_id,
146
171
  Symbol access_strategy,
172
+ Symbol rw_mode,
147
173
  String? waiting_acquirer,
148
174
  Hash[String,untyped] current_lock_data
149
175
  ) -> void
@@ -157,11 +183,51 @@ module RedisQueuedLocks
157
183
  String acquirer_id,
158
184
  String host_id,
159
185
  Symbol access_strategy,
186
+ Symbol rw_mode,
160
187
  String? waiting_acquirer,
161
188
  String locked_by_acquirer,
162
189
  Hash[String,untyped] current_lock_data
163
190
  ) -> void
164
191
 
192
+ def self.exit__write_request_ahead: (
193
+ RQL::loggerObj logger,
194
+ bool log_sampled,
195
+ bool log_lock_try,
196
+ String lock_key,
197
+ Integer queue_ttl,
198
+ String acquirer_id,
199
+ String host_id,
200
+ Symbol access_strategy,
201
+ Symbol rw_mode,
202
+ String ahead_acquirer
203
+ ) -> void
204
+
205
+ def self.exit__read_request_ahead: (
206
+ RQL::loggerObj logger,
207
+ bool log_sampled,
208
+ bool log_lock_try,
209
+ String lock_key,
210
+ Integer queue_ttl,
211
+ String acquirer_id,
212
+ String host_id,
213
+ Symbol access_strategy,
214
+ Symbol rw_mode,
215
+ String ahead_acquirer
216
+ ) -> void
217
+
218
+ def self.exit__read_lock_still_obtained: (
219
+ RQL::loggerObj logger,
220
+ bool log_sampled,
221
+ bool log_lock_try,
222
+ String lock_key,
223
+ Integer queue_ttl,
224
+ String acquirer_id,
225
+ String host_id,
226
+ Symbol access_strategy,
227
+ Symbol rw_mode,
228
+ String? waiting_acquirer
229
+ ) -> void
230
+
165
231
  def self.obtain__free_to_acquire: (
166
232
  RQL::loggerObj logger,
167
233
  bool log_sampled,
@@ -170,7 +236,8 @@ module RedisQueuedLocks
170
236
  Integer queue_ttl,
171
237
  String acquirer_id,
172
238
  String host_id,
173
- Symbol access_strategy
239
+ Symbol access_strategy,
240
+ Symbol rw_mode
174
241
  ) -> void
175
242
  end
176
243
  end
@@ -17,7 +17,8 @@ module RedisQueuedLocks
17
17
  # acq_id: String,
18
18
  # hst_id: String,
19
19
  # ts: Integer?,
20
- # ttl: Integer?
20
+ # ttl: Integer?,
21
+ # rw_mode: Symbol
21
22
  # }
22
23
  # }
23
24
 
@@ -29,7 +30,8 @@ module RedisQueuedLocks
29
30
  Symbol read_write_mode,
30
31
  String lock_key_queue,
31
32
  String read_lock_key_queue,
32
- String write_lock_key_queue,
33
+ String lock_readers_key,
34
+ String read_lock_key,
33
35
  String acquirer_id,
34
36
  String host_id,
35
37
  Integer|Float acquirer_position,
@@ -11,6 +11,9 @@ module RedisQueuedLocks
11
11
  RC::client redis,
12
12
  RQL::loggerObj logger,
13
13
  String lock_key,
14
+ String lock_readers_key,
15
+ String read_lock_key,
16
+ Symbol rw_mode,
14
17
  String acquirer_id,
15
18
  String host_id,
16
19
  Symbol access_strategy,
@@ -12,7 +12,8 @@ module RedisQueuedLocks
12
12
  Integer queue_ttl,
13
13
  String acquirer_id,
14
14
  String host_id,
15
- Symbol access_strategy
15
+ Symbol access_strategy,
16
+ Symbol rw_mode
16
17
  ) -> void
17
18
 
18
19
  def self.decrease_lock: (
@@ -23,7 +24,8 @@ module RedisQueuedLocks
23
24
  Integer queue_ttl,
24
25
  String acquirer_id,
25
26
  String host_id,
26
- Symbol access_strategy
27
+ Symbol access_strategy,
28
+ Symbol rw_mode
27
29
  ) -> void
28
30
  end
29
31
  end