redis_queued_locks 1.21.0 → 1.23.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.
- checksums.yaml +4 -4
- data/.claude/project-overview.md +294 -51
- data/.claude/rules/acquirer.md +16 -11
- data/.claude/rules/arguments.md +2 -2
- data/.claude/rules/changelog.md +27 -0
- data/.claude/rules/git.md +1 -1
- data/.claude/rules/logic.md +14 -15
- data/.claude/rules/swarm.md +3 -4
- data/.claude/rules/tests.md +9 -9
- data/.claude/rules/type-checking.md +14 -16
- data/.claude/rules/visitors.md +11 -9
- data/.claude/skills/rql-code-review/SKILL.md +129 -47
- data/.ruby-version +1 -1
- data/CHANGELOG.md +122 -245
- data/CLAUDE.md +12 -10
- data/README.md +516 -175
- data/Rakefile +11 -0
- data/lib/redis_queued_locks/acquirer/acquire_lock/dequeue_from_lock_queue.rb +4 -4
- data/lib/redis_queued_locks/acquirer/acquire_lock/instr_visitor.rb +28 -12
- data/lib/redis_queued_locks/acquirer/acquire_lock/log_visitor.rb +38 -16
- data/lib/redis_queued_locks/acquirer/acquire_lock/try_to_lock/log_visitor.rb +92 -15
- data/lib/redis_queued_locks/acquirer/acquire_lock/try_to_lock.rb +945 -272
- data/lib/redis_queued_locks/acquirer/acquire_lock.rb +82 -32
- data/lib/redis_queued_locks/acquirer/clear_dead_requests.rb +240 -45
- data/lib/redis_queued_locks/acquirer/extend_lock_ttl.rb +15 -13
- data/lib/redis_queued_locks/acquirer/keys.rb +6 -2
- data/lib/redis_queued_locks/acquirer/lock_series/instr_visitor.rb +243 -0
- data/lib/redis_queued_locks/acquirer/lock_series/log_visitor.rb +472 -0
- data/lib/redis_queued_locks/acquirer/lock_series/release_lock_series.rb +181 -0
- data/lib/redis_queued_locks/acquirer/lock_series/try_to_lock_series.rb +1051 -0
- data/lib/redis_queued_locks/acquirer/lock_series.rb +948 -0
- data/lib/redis_queued_locks/acquirer/locks.rb +6 -2
- data/lib/redis_queued_locks/acquirer/queue_info.rb +30 -7
- data/lib/redis_queued_locks/acquirer/queues.rb +17 -6
- data/lib/redis_queued_locks/acquirer/release_all_locks.rb +6 -2
- data/lib/redis_queued_locks/acquirer/release_locks_of.rb +6 -2
- data/lib/redis_queued_locks/acquirer.rb +1 -1
- data/lib/redis_queued_locks/client.rb +116 -44
- data/lib/redis_queued_locks/config.rb +93 -1
- data/lib/redis_queued_locks/resource.rb +124 -9
- data/lib/redis_queued_locks/swarm/swarm_element/threaded.rb +6 -5
- data/lib/redis_queued_locks/swarm/zombie_info.rb +6 -2
- data/lib/redis_queued_locks/version.rb +2 -2
- data/rbs_collection.lock.yaml +4 -0
- data/rbs_collection.yaml +2 -1
- data/redis_queued_locks.gemspec +21 -14
- data/sig/manifest.yml +1 -0
- data/sig/redis_queued_locks/acquirer/acquire_lock/dequeue_from_lock_queue/log_visitor.rbs +2 -2
- data/sig/redis_queued_locks/acquirer/acquire_lock/dequeue_from_lock_queue.rbs +2 -2
- data/sig/redis_queued_locks/acquirer/acquire_lock/instr_visitor.rbs +12 -6
- data/sig/redis_queued_locks/acquirer/acquire_lock/log_visitor.rbs +21 -14
- data/sig/redis_queued_locks/acquirer/acquire_lock/try_to_lock/log_visitor.rbs +61 -40
- data/sig/redis_queued_locks/acquirer/acquire_lock/try_to_lock.rbs +160 -11
- data/sig/redis_queued_locks/acquirer/acquire_lock/{yield_with_expire → yield_expire}/log_visitor.rbs +4 -4
- data/sig/redis_queued_locks/acquirer/acquire_lock/yield_expire.rbs +2 -2
- data/sig/redis_queued_locks/acquirer/acquire_lock.rbs +5 -3
- data/sig/redis_queued_locks/acquirer/clear_dead_requests.rbs +14 -1
- data/sig/redis_queued_locks/acquirer/extend_lock_ttl.rbs +2 -2
- data/sig/redis_queued_locks/acquirer/lock_series/instr_visitor.rbs +102 -0
- data/sig/redis_queued_locks/acquirer/lock_series/log_visitor.rbs +154 -0
- data/sig/redis_queued_locks/acquirer/lock_series/release_lock_series.rbs +37 -0
- data/sig/redis_queued_locks/acquirer/lock_series/try_to_lock_series.rbs +198 -0
- data/sig/redis_queued_locks/acquirer/lock_series.rbs +106 -0
- data/sig/redis_queued_locks/acquirer/queues.rbs +1 -1
- data/sig/redis_queued_locks/client.rbs +77 -7
- data/sig/redis_queued_locks/config.rbs +54 -1
- data/sig/redis_queued_locks/instrument/sampler.rbs +3 -1
- data/sig/redis_queued_locks/instrument/void_notifier.rbs +3 -1
- data/sig/redis_queued_locks/logging/sampler.rbs +3 -1
- data/sig/redis_queued_locks/resource.rbs +22 -12
- data/sig/redis_queued_locks/swarm/swarm_element/threaded.rbs +1 -1
- data/sig/redis_queued_locks/utilities.rbs +2 -1
- data/sig/redis_queued_locks.rbs +7 -0
- metadata +35 -13
- data/lib/redis_queued_locks/acquirer/lock_series_poc/instr_visitor.rb +0 -56
- data/lib/redis_queued_locks/acquirer/lock_series_poc/log_visitor.rb +0 -95
- data/lib/redis_queued_locks/acquirer/lock_series_poc.rb +0 -484
- /data/sig/redis_queued_locks/{acquier.rbs → acquirer.rbs} +0 -0
|
@@ -13,8 +13,8 @@ module RedisQueuedLocks
|
|
|
13
13
|
Integer queue_ttl,
|
|
14
14
|
String acquirer_id,
|
|
15
15
|
String host_id,
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
RQL::accessStrategy access_strategy,
|
|
17
|
+
RQL::readWriteMode rw_mode
|
|
18
18
|
) -> void
|
|
19
19
|
|
|
20
20
|
def self.rconn_fetched: (
|
|
@@ -25,8 +25,8 @@ module RedisQueuedLocks
|
|
|
25
25
|
Integer queue_ttl,
|
|
26
26
|
String acquirer_id,
|
|
27
27
|
String host_id,
|
|
28
|
-
|
|
29
|
-
|
|
28
|
+
RQL::accessStrategy access_strategy,
|
|
29
|
+
RQL::readWriteMode rw_mode
|
|
30
30
|
) -> void
|
|
31
31
|
|
|
32
32
|
def self.same_process_conflict_detected: (
|
|
@@ -37,8 +37,8 @@ module RedisQueuedLocks
|
|
|
37
37
|
Integer queue_ttl,
|
|
38
38
|
String acquirer_id,
|
|
39
39
|
String host_id,
|
|
40
|
-
|
|
41
|
-
|
|
40
|
+
RQL::accessStrategy access_strategy,
|
|
41
|
+
RQL::readWriteMode rw_mode
|
|
42
42
|
) -> void
|
|
43
43
|
|
|
44
44
|
def self.same_process_conflict_analyzed: (
|
|
@@ -49,8 +49,8 @@ module RedisQueuedLocks
|
|
|
49
49
|
Integer queue_ttl,
|
|
50
50
|
String acquirer_id,
|
|
51
51
|
String host_id,
|
|
52
|
-
|
|
53
|
-
|
|
52
|
+
RQL::accessStrategy access_strategy,
|
|
53
|
+
RQL::readWriteMode rw_mode,
|
|
54
54
|
Symbol sp_conflict_status
|
|
55
55
|
) -> void
|
|
56
56
|
|
|
@@ -62,8 +62,8 @@ module RedisQueuedLocks
|
|
|
62
62
|
Integer queue_ttl,
|
|
63
63
|
String acquirer_id,
|
|
64
64
|
String host_id,
|
|
65
|
-
|
|
66
|
-
|
|
65
|
+
RQL::accessStrategy access_strategy,
|
|
66
|
+
RQL::readWriteMode rw_mode,
|
|
67
67
|
Symbol sp_conflict_status,
|
|
68
68
|
Integer? ttl,
|
|
69
69
|
::Float spc_processed_timestamp
|
|
@@ -77,8 +77,8 @@ module RedisQueuedLocks
|
|
|
77
77
|
Integer queue_ttl,
|
|
78
78
|
String acquirer_id,
|
|
79
79
|
String host_id,
|
|
80
|
-
|
|
81
|
-
|
|
80
|
+
RQL::accessStrategy access_strategy,
|
|
81
|
+
RQL::readWriteMode rw_mode,
|
|
82
82
|
Symbol sp_conflict_status,
|
|
83
83
|
::Float spc_processed_timestamp
|
|
84
84
|
) -> void
|
|
@@ -91,8 +91,8 @@ module RedisQueuedLocks
|
|
|
91
91
|
Integer queue_ttl,
|
|
92
92
|
String acquirer_id,
|
|
93
93
|
String host_id,
|
|
94
|
-
|
|
95
|
-
|
|
94
|
+
RQL::accessStrategy access_strategy,
|
|
95
|
+
RQL::readWriteMode rw_mode,
|
|
96
96
|
Symbol sp_conflict_status,
|
|
97
97
|
::Float spc_processed_timestamp
|
|
98
98
|
) -> void
|
|
@@ -105,8 +105,8 @@ module RedisQueuedLocks
|
|
|
105
105
|
Integer queue_ttl,
|
|
106
106
|
String acquirer_id,
|
|
107
107
|
String host_id,
|
|
108
|
-
|
|
109
|
-
|
|
108
|
+
RQL::accessStrategy access_strategy,
|
|
109
|
+
RQL::readWriteMode rw_mode,
|
|
110
110
|
Symbol sp_conflict_status,
|
|
111
111
|
::Float spc_processed_timestamp
|
|
112
112
|
) -> void
|
|
@@ -119,8 +119,9 @@ module RedisQueuedLocks
|
|
|
119
119
|
Integer queue_ttl,
|
|
120
120
|
String acquirer_id,
|
|
121
121
|
String host_id,
|
|
122
|
-
|
|
123
|
-
|
|
122
|
+
RQL::accessStrategy access_strategy,
|
|
123
|
+
RQL::readWriteMode rw_mode,
|
|
124
|
+
Integer priority
|
|
124
125
|
) -> void
|
|
125
126
|
|
|
126
127
|
def self.remove_expired_acqs: (
|
|
@@ -131,8 +132,22 @@ module RedisQueuedLocks
|
|
|
131
132
|
Integer queue_ttl,
|
|
132
133
|
String acquirer_id,
|
|
133
134
|
String host_id,
|
|
134
|
-
|
|
135
|
-
|
|
135
|
+
RQL::accessStrategy access_strategy,
|
|
136
|
+
RQL::readWriteMode rw_mode
|
|
137
|
+
) -> void
|
|
138
|
+
|
|
139
|
+
def self.dead_request_removed: (
|
|
140
|
+
RQL::loggerObj logger,
|
|
141
|
+
bool log_sampled,
|
|
142
|
+
bool log_lock_try,
|
|
143
|
+
String lock_key,
|
|
144
|
+
Integer queue_ttl,
|
|
145
|
+
String acquirer_id,
|
|
146
|
+
String host_id,
|
|
147
|
+
RQL::accessStrategy access_strategy,
|
|
148
|
+
RQL::readWriteMode rw_mode,
|
|
149
|
+
String dead_acquirer,
|
|
150
|
+
Integer dead_priority
|
|
136
151
|
) -> void
|
|
137
152
|
|
|
138
153
|
def self.get_first_from_queue: (
|
|
@@ -143,9 +158,10 @@ module RedisQueuedLocks
|
|
|
143
158
|
Integer queue_ttl,
|
|
144
159
|
String acquirer_id,
|
|
145
160
|
String host_id,
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
String? waiting_acquirer
|
|
161
|
+
RQL::accessStrategy access_strategy,
|
|
162
|
+
RQL::readWriteMode rw_mode,
|
|
163
|
+
String? waiting_acquirer,
|
|
164
|
+
Integer? waiting_priority
|
|
149
165
|
) -> void
|
|
150
166
|
|
|
151
167
|
def self.exit__queue_ttl_reached: (
|
|
@@ -156,8 +172,8 @@ module RedisQueuedLocks
|
|
|
156
172
|
Integer queue_ttl,
|
|
157
173
|
String acquirer_id,
|
|
158
174
|
String host_id,
|
|
159
|
-
|
|
160
|
-
|
|
175
|
+
RQL::accessStrategy access_strategy,
|
|
176
|
+
RQL::readWriteMode rw_mode
|
|
161
177
|
) -> void
|
|
162
178
|
|
|
163
179
|
def self.exit__no_first: (
|
|
@@ -168,9 +184,10 @@ module RedisQueuedLocks
|
|
|
168
184
|
Integer queue_ttl,
|
|
169
185
|
String acquirer_id,
|
|
170
186
|
String host_id,
|
|
171
|
-
|
|
172
|
-
|
|
187
|
+
RQL::accessStrategy access_strategy,
|
|
188
|
+
RQL::readWriteMode rw_mode,
|
|
173
189
|
String? waiting_acquirer,
|
|
190
|
+
Integer? waiting_priority,
|
|
174
191
|
Hash[String,untyped] current_lock_data
|
|
175
192
|
) -> void
|
|
176
193
|
|
|
@@ -182,9 +199,10 @@ module RedisQueuedLocks
|
|
|
182
199
|
Integer queue_ttl,
|
|
183
200
|
String acquirer_id,
|
|
184
201
|
String host_id,
|
|
185
|
-
|
|
186
|
-
|
|
202
|
+
RQL::accessStrategy access_strategy,
|
|
203
|
+
RQL::readWriteMode rw_mode,
|
|
187
204
|
String? waiting_acquirer,
|
|
205
|
+
Integer? waiting_priority,
|
|
188
206
|
String locked_by_acquirer,
|
|
189
207
|
Hash[String,untyped] current_lock_data
|
|
190
208
|
) -> void
|
|
@@ -197,9 +215,10 @@ module RedisQueuedLocks
|
|
|
197
215
|
Integer queue_ttl,
|
|
198
216
|
String acquirer_id,
|
|
199
217
|
String host_id,
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
String ahead_acquirer
|
|
218
|
+
RQL::accessStrategy access_strategy,
|
|
219
|
+
RQL::readWriteMode rw_mode,
|
|
220
|
+
String ahead_acquirer,
|
|
221
|
+
Integer? ahead_priority
|
|
203
222
|
) -> void
|
|
204
223
|
|
|
205
224
|
def self.exit__read_request_ahead: (
|
|
@@ -210,9 +229,10 @@ module RedisQueuedLocks
|
|
|
210
229
|
Integer queue_ttl,
|
|
211
230
|
String acquirer_id,
|
|
212
231
|
String host_id,
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
String ahead_acquirer
|
|
232
|
+
RQL::accessStrategy access_strategy,
|
|
233
|
+
RQL::readWriteMode rw_mode,
|
|
234
|
+
String ahead_acquirer,
|
|
235
|
+
Integer? ahead_priority
|
|
216
236
|
) -> void
|
|
217
237
|
|
|
218
238
|
def self.exit__read_lock_still_obtained: (
|
|
@@ -223,9 +243,10 @@ module RedisQueuedLocks
|
|
|
223
243
|
Integer queue_ttl,
|
|
224
244
|
String acquirer_id,
|
|
225
245
|
String host_id,
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
String? waiting_acquirer
|
|
246
|
+
RQL::accessStrategy access_strategy,
|
|
247
|
+
RQL::readWriteMode rw_mode,
|
|
248
|
+
String? waiting_acquirer,
|
|
249
|
+
Integer? waiting_priority
|
|
229
250
|
) -> void
|
|
230
251
|
|
|
231
252
|
def self.obtain__free_to_acquire: (
|
|
@@ -236,8 +257,8 @@ module RedisQueuedLocks
|
|
|
236
257
|
Integer queue_ttl,
|
|
237
258
|
String acquirer_id,
|
|
238
259
|
String host_id,
|
|
239
|
-
|
|
240
|
-
|
|
260
|
+
RQL::accessStrategy access_strategy,
|
|
261
|
+
RQL::readWriteMode rw_mode
|
|
241
262
|
) -> void
|
|
242
263
|
end
|
|
243
264
|
end
|
|
@@ -13,6 +13,10 @@ module RedisQueuedLocks
|
|
|
13
13
|
LOCK_STATE_QUEUE_REPLIES_AT: Integer
|
|
14
14
|
QUEUE_HEAD_REPLY: Integer
|
|
15
15
|
OPPOSITE_QUEUE_HEAD_REPLY: Integer
|
|
16
|
+
QUEUE_REPLIES: Integer
|
|
17
|
+
QUEUE_LOCK_INDEX_REPLIES: Integer
|
|
18
|
+
READ_LOCK_EXTENSION_COMMANDS: Integer
|
|
19
|
+
MAX_DEAD_REQUEST_REMOVALS: Integer
|
|
16
20
|
|
|
17
21
|
# { ok: bool, result: Symbol }
|
|
18
22
|
# { ok: bool, result: Symbol }
|
|
@@ -25,7 +29,7 @@ module RedisQueuedLocks
|
|
|
25
29
|
# hst_id: String,
|
|
26
30
|
# ts: Integer?,
|
|
27
31
|
# ttl: Integer?,
|
|
28
|
-
# rw_mode:
|
|
32
|
+
# rw_mode: RQL::readWriteMode
|
|
29
33
|
# }
|
|
30
34
|
# }
|
|
31
35
|
|
|
@@ -34,7 +38,7 @@ module RedisQueuedLocks
|
|
|
34
38
|
RQL::loggerObj logger,
|
|
35
39
|
bool log_lock_try,
|
|
36
40
|
String lock_key,
|
|
37
|
-
|
|
41
|
+
RQL::readWriteMode rw_mode,
|
|
38
42
|
String lock_key_queue,
|
|
39
43
|
String read_lock_key_queue,
|
|
40
44
|
String lock_readers_key,
|
|
@@ -43,13 +47,14 @@ module RedisQueuedLocks
|
|
|
43
47
|
String acquirer_id,
|
|
44
48
|
String host_id,
|
|
45
49
|
Integer|Float acquirer_position,
|
|
50
|
+
Integer priority,
|
|
46
51
|
Integer? ttl,
|
|
47
52
|
Integer queue_ttl,
|
|
48
53
|
bool lock_index_enabled,
|
|
49
54
|
Integer lock_index_grace_period,
|
|
50
55
|
bool fail_fast,
|
|
51
|
-
|
|
52
|
-
|
|
56
|
+
RQL::conflictStrategy conflict_strategy,
|
|
57
|
+
RQL::accessStrategy access_strategy,
|
|
53
58
|
Hash[String|Symbol,untyped]? meta,
|
|
54
59
|
bool retry_attempt,
|
|
55
60
|
bool log_sampled,
|
|
@@ -58,11 +63,89 @@ module RedisQueuedLocks
|
|
|
58
63
|
|
|
59
64
|
private
|
|
60
65
|
|
|
66
|
+
def same_process_conflict_status: (
|
|
67
|
+
RQL::conflictStrategy conflict_strategy,
|
|
68
|
+
bool lock_upgrade
|
|
69
|
+
) -> Symbol
|
|
70
|
+
|
|
71
|
+
def transact_write_lock_extension: (
|
|
72
|
+
RedisClient::Multi transact,
|
|
73
|
+
String lock_key,
|
|
74
|
+
String lock_name,
|
|
75
|
+
Integer? ttl,
|
|
76
|
+
bool lock_index_enabled,
|
|
77
|
+
Float spc_processed_timestamp
|
|
78
|
+
) -> void
|
|
79
|
+
|
|
80
|
+
def transact_read_lock_extension: (
|
|
81
|
+
RedisClient::Multi transact,
|
|
82
|
+
String lock_readers_key,
|
|
83
|
+
String? read_lock_key,
|
|
84
|
+
String lock_name,
|
|
85
|
+
String acquirer_id,
|
|
86
|
+
Integer? ttl,
|
|
87
|
+
bool lock_index_enabled,
|
|
88
|
+
Float? own_read_lock_expiration,
|
|
89
|
+
Integer redis_time,
|
|
90
|
+
Float spc_processed_timestamp
|
|
91
|
+
) -> void
|
|
92
|
+
|
|
93
|
+
def transact_lock_index_extension: (
|
|
94
|
+
RedisClient::Multi transact,
|
|
95
|
+
String lock_name,
|
|
96
|
+
Integer? ttl,
|
|
97
|
+
bool lock_index_enabled
|
|
98
|
+
) -> void
|
|
99
|
+
|
|
100
|
+
def transact_write_lock_work_through: (
|
|
101
|
+
RedisClient::Multi transact,
|
|
102
|
+
String lock_key,
|
|
103
|
+
Float spc_processed_timestamp
|
|
104
|
+
) -> void
|
|
105
|
+
|
|
106
|
+
def transact_read_lock_work_through: (
|
|
107
|
+
RedisClient::Multi transact,
|
|
108
|
+
String? read_lock_key,
|
|
109
|
+
Float? own_read_lock_expiration,
|
|
110
|
+
Integer redis_time,
|
|
111
|
+
Float spc_processed_timestamp
|
|
112
|
+
) -> void
|
|
113
|
+
|
|
114
|
+
def transact_read_lock_obtaining: (
|
|
115
|
+
RedisClient::Multi transact,
|
|
116
|
+
String request_queue,
|
|
117
|
+
String lock_readers_key,
|
|
118
|
+
String? read_lock_key,
|
|
119
|
+
String lock_name,
|
|
120
|
+
String acquirer_id,
|
|
121
|
+
Integer? ttl,
|
|
122
|
+
bool lock_index_enabled,
|
|
123
|
+
Integer lock_index_grace_period,
|
|
124
|
+
Hash[String|Symbol,untyped]? meta,
|
|
125
|
+
Integer redis_time,
|
|
126
|
+
Float timestamp
|
|
127
|
+
) -> void
|
|
128
|
+
|
|
129
|
+
def transact_write_lock_obtaining: (
|
|
130
|
+
RedisClient::Multi transact,
|
|
131
|
+
String lock_key,
|
|
132
|
+
String request_queue,
|
|
133
|
+
String lock_name,
|
|
134
|
+
String acquirer_id,
|
|
135
|
+
String host_id,
|
|
136
|
+
Integer? ttl,
|
|
137
|
+
bool lock_index_enabled,
|
|
138
|
+
Integer lock_index_grace_period,
|
|
139
|
+
Hash[String|Symbol,untyped]? meta,
|
|
140
|
+
Float timestamp
|
|
141
|
+
) -> void
|
|
142
|
+
|
|
61
143
|
def queue_lock_request: (
|
|
62
144
|
RedisClient::Pipeline pipeline,
|
|
63
145
|
String request_queue,
|
|
64
146
|
String opposite_request_queue,
|
|
65
147
|
Integer|Float acquirer_position,
|
|
148
|
+
Integer priority,
|
|
66
149
|
String acquirer_id,
|
|
67
150
|
Float acquirer_dead_score,
|
|
68
151
|
String lock_name,
|
|
@@ -71,6 +154,14 @@ module RedisQueuedLocks
|
|
|
71
154
|
Integer lock_index_grace_period
|
|
72
155
|
) -> void
|
|
73
156
|
|
|
157
|
+
def pipeline_dead_requests_removal: (
|
|
158
|
+
RedisClient::Pipeline pipeline,
|
|
159
|
+
String request_queue,
|
|
160
|
+
String opposite_request_queue,
|
|
161
|
+
Float acquirer_dead_score,
|
|
162
|
+
Integer priority
|
|
163
|
+
) -> void
|
|
164
|
+
|
|
74
165
|
def pipeline_lock_state: (
|
|
75
166
|
RedisClient::Pipeline pipeline,
|
|
76
167
|
String lock_key,
|
|
@@ -81,6 +172,7 @@ module RedisQueuedLocks
|
|
|
81
172
|
String request_queue,
|
|
82
173
|
String opposite_request_queue,
|
|
83
174
|
Integer|Float acquirer_position,
|
|
175
|
+
Integer priority,
|
|
84
176
|
Float acquirer_dead_score,
|
|
85
177
|
String lock_name,
|
|
86
178
|
Integer queue_ttl,
|
|
@@ -89,7 +181,7 @@ module RedisQueuedLocks
|
|
|
89
181
|
) -> void
|
|
90
182
|
|
|
91
183
|
def find_opposite_request_ahead: (
|
|
92
|
-
|
|
184
|
+
RQL::accessStrategy access_strategy,
|
|
93
185
|
[String, Float]? opposite_waiting_request,
|
|
94
186
|
Integer|Float acquirer_position,
|
|
95
187
|
String acquirer_id
|
|
@@ -104,7 +196,7 @@ module RedisQueuedLocks
|
|
|
104
196
|
|
|
105
197
|
def lock_obstacle: (
|
|
106
198
|
bool read_mode,
|
|
107
|
-
|
|
199
|
+
RQL::accessStrategy access_strategy,
|
|
108
200
|
String acquirer_id,
|
|
109
201
|
String? waiting_acquirer,
|
|
110
202
|
String? opposite_request_ahead,
|
|
@@ -122,20 +214,76 @@ module RedisQueuedLocks
|
|
|
122
214
|
Integer queue_ttl,
|
|
123
215
|
String acquirer_id,
|
|
124
216
|
String host_id,
|
|
125
|
-
|
|
126
|
-
|
|
217
|
+
RQL::accessStrategy access_strategy,
|
|
218
|
+
RQL::readWriteMode rw_mode,
|
|
127
219
|
String? waiting_acquirer,
|
|
128
|
-
|
|
220
|
+
Integer? waiting_priority,
|
|
221
|
+
[String, Float]? opposite_waiting_request,
|
|
129
222
|
String? current_lock_obtainer
|
|
130
223
|
) -> void
|
|
131
224
|
|
|
225
|
+
def logged_request_priority: (
|
|
226
|
+
bool log_sampled,
|
|
227
|
+
bool log_lock_try,
|
|
228
|
+
[String, Float]? lock_request
|
|
229
|
+
) -> Integer?
|
|
230
|
+
|
|
231
|
+
def drop_dead_requests_ahead: (
|
|
232
|
+
RC::client rconn,
|
|
233
|
+
RQL::readWriteMode rw_mode,
|
|
234
|
+
String request_queue,
|
|
235
|
+
String opposite_request_queue,
|
|
236
|
+
String acquirer_id,
|
|
237
|
+
Integer|Float acquirer_position,
|
|
238
|
+
Float acquirer_dead_score,
|
|
239
|
+
RQL::accessStrategy access_strategy,
|
|
240
|
+
[String, Float]? waiting_request,
|
|
241
|
+
[String, Float]? opposite_waiting_request
|
|
242
|
+
) -> [[String, Float]?, [String, Float]?, Array[[String, Integer]]]?
|
|
243
|
+
|
|
244
|
+
def find_dead_requests_ahead: (
|
|
245
|
+
bool read_mode,
|
|
246
|
+
RQL::accessStrategy access_strategy,
|
|
247
|
+
String acquirer_id,
|
|
248
|
+
Integer|Float acquirer_position,
|
|
249
|
+
Float acquirer_dead_score,
|
|
250
|
+
[String, Float]? waiting_request,
|
|
251
|
+
[String, Float]? opposite_waiting_request
|
|
252
|
+
) -> [[String, Float]?, Integer?, [String, Float]?, Integer?]?
|
|
253
|
+
|
|
254
|
+
def pipeline_dead_requests_ahead_removal: (
|
|
255
|
+
RedisClient::Pipeline pipeline,
|
|
256
|
+
String request_queue,
|
|
257
|
+
String opposite_request_queue,
|
|
258
|
+
Float acquirer_dead_score,
|
|
259
|
+
[String, Float]? dead_head,
|
|
260
|
+
Integer? dead_head_priority,
|
|
261
|
+
[String, Float]? dead_ahead,
|
|
262
|
+
Integer? dead_ahead_priority
|
|
263
|
+
) -> void
|
|
264
|
+
|
|
265
|
+
def log_dropped_requests: (
|
|
266
|
+
RQL::loggerObj logger,
|
|
267
|
+
bool log_sampled,
|
|
268
|
+
bool log_lock_try,
|
|
269
|
+
String lock_key,
|
|
270
|
+
Integer queue_ttl,
|
|
271
|
+
String acquirer_id,
|
|
272
|
+
String host_id,
|
|
273
|
+
RQL::accessStrategy access_strategy,
|
|
274
|
+
RQL::readWriteMode rw_mode,
|
|
275
|
+
Array[[String, Integer]] dropped_requests
|
|
276
|
+
) -> void
|
|
277
|
+
|
|
278
|
+
def dead_request_priority: ([String, Float] lock_request, Float acquirer_dead_score) -> Integer?
|
|
279
|
+
|
|
132
280
|
def precheck_lock: (
|
|
133
281
|
RC::client rconn,
|
|
134
282
|
RQL::loggerObj logger,
|
|
135
283
|
bool log_sampled,
|
|
136
284
|
bool log_lock_try,
|
|
137
285
|
String lock_key,
|
|
138
|
-
|
|
286
|
+
RQL::readWriteMode rw_mode,
|
|
139
287
|
String lock_readers_key,
|
|
140
288
|
String request_queue,
|
|
141
289
|
String opposite_request_queue,
|
|
@@ -143,12 +291,13 @@ module RedisQueuedLocks
|
|
|
143
291
|
String acquirer_id,
|
|
144
292
|
String host_id,
|
|
145
293
|
Integer|Float acquirer_position,
|
|
294
|
+
Integer priority,
|
|
146
295
|
Float acquirer_dead_score,
|
|
147
296
|
Integer queue_ttl,
|
|
148
297
|
bool lock_index_enabled,
|
|
149
298
|
Integer lock_index_grace_period,
|
|
150
299
|
bool fail_fast,
|
|
151
|
-
|
|
300
|
+
RQL::accessStrategy access_strategy
|
|
152
301
|
) -> (lockObstacle | :fail_fast_no_try)?
|
|
153
302
|
end
|
|
154
303
|
end
|
data/sig/redis_queued_locks/acquirer/acquire_lock/{yield_with_expire → yield_expire}/log_visitor.rbs
RENAMED
|
@@ -12,8 +12,8 @@ module RedisQueuedLocks
|
|
|
12
12
|
Integer queue_ttl,
|
|
13
13
|
String acquirer_id,
|
|
14
14
|
String host_id,
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
RQL::accessStrategy access_strategy,
|
|
16
|
+
RQL::readWriteMode rw_mode
|
|
17
17
|
) -> void
|
|
18
18
|
|
|
19
19
|
def self.decrease_lock: (
|
|
@@ -24,8 +24,8 @@ module RedisQueuedLocks
|
|
|
24
24
|
Integer queue_ttl,
|
|
25
25
|
String acquirer_id,
|
|
26
26
|
String host_id,
|
|
27
|
-
|
|
28
|
-
|
|
27
|
+
RQL::accessStrategy access_strategy,
|
|
28
|
+
RQL::readWriteMode rw_mode
|
|
29
29
|
) -> void
|
|
30
30
|
end
|
|
31
31
|
end
|
|
@@ -13,10 +13,10 @@ module RedisQueuedLocks
|
|
|
13
13
|
String lock_key,
|
|
14
14
|
String lock_readers_key,
|
|
15
15
|
String? read_lock_key,
|
|
16
|
-
|
|
16
|
+
RQL::readWriteMode rw_mode,
|
|
17
17
|
String acquirer_id,
|
|
18
18
|
String host_id,
|
|
19
|
-
|
|
19
|
+
RQL::accessStrategy access_strategy,
|
|
20
20
|
bool timed,
|
|
21
21
|
Integer|Float ttl_shift,
|
|
22
22
|
Integer ttl,
|
|
@@ -37,9 +37,11 @@ module RedisQueuedLocks
|
|
|
37
37
|
logger: RQL::loggerObj,
|
|
38
38
|
log_lock_try: bool,
|
|
39
39
|
instrument: untyped?,
|
|
40
|
-
conflict_strategy:
|
|
41
|
-
|
|
42
|
-
access_strategy:
|
|
40
|
+
conflict_strategy: RQL::conflictStrategy,
|
|
41
|
+
rw_mode: Symbol, # NOTE: (rbs test) validated at runtime (Step 0.1 (RW)): any Symbol is accepted here
|
|
42
|
+
access_strategy: RQL::accessStrategy,
|
|
43
|
+
priority: RQL::lockPriority,
|
|
44
|
+
lock_priorities: Hash[Symbol, Integer],
|
|
43
45
|
log_sampling_enabled: bool,
|
|
44
46
|
log_sampling_percent: Integer,
|
|
45
47
|
log_sampler: RQL::Logging::samplerObj,
|
|
@@ -11,6 +11,7 @@ module RedisQueuedLocks
|
|
|
11
11
|
RC::client redis_client,
|
|
12
12
|
Integer scan_size,
|
|
13
13
|
Integer dead_ttl,
|
|
14
|
+
bool by_priority,
|
|
14
15
|
bool lock_index_enabled,
|
|
15
16
|
RQL::loggerObj logger,
|
|
16
17
|
RQL::instrObj instrumenter,
|
|
@@ -29,15 +30,27 @@ module RedisQueuedLocks
|
|
|
29
30
|
RC::client redis_client,
|
|
30
31
|
Integer scan_size,
|
|
31
32
|
Integer dead_ttl,
|
|
33
|
+
bool by_priority,
|
|
32
34
|
bool lock_index_enabled
|
|
33
35
|
) -> Set[String]
|
|
34
36
|
|
|
35
37
|
private def self.each_lock_queue: (RC::client redis_client, Integer scan_size) { (String lock_queue) -> void } -> void
|
|
36
|
-
private def self.drop_dead_requests: (
|
|
38
|
+
private def self.drop_dead_requests: (
|
|
39
|
+
RC::client redis_client,
|
|
40
|
+
Array[String] lock_queues,
|
|
41
|
+
Float dead_score,
|
|
42
|
+
bool by_priority
|
|
43
|
+
) -> Array[Array[[String, Float]]]
|
|
44
|
+
private def self.drop_dead_requests_by_priority: (
|
|
45
|
+
RC::client redis_client,
|
|
46
|
+
Array[String] lock_queues,
|
|
47
|
+
Float dead_score
|
|
48
|
+
) -> Array[Array[[String, Float]]]
|
|
37
49
|
private def self.drop_dead_requests_of_locks: (
|
|
38
50
|
RC::client redis_client,
|
|
39
51
|
Array[String] lock_names,
|
|
40
52
|
Float dead_score,
|
|
53
|
+
bool by_priority,
|
|
41
54
|
Set[String] processed_queues
|
|
42
55
|
) -> void
|
|
43
56
|
private def self.each_lock_name_batch: (RC::client redis_client, Integer scan_size) { (Array[String] lock_names) -> void } -> void
|
|
@@ -13,7 +13,7 @@ module RedisQueuedLocks
|
|
|
13
13
|
RC::client redis_client,
|
|
14
14
|
String lock_name,
|
|
15
15
|
Integer milliseconds,
|
|
16
|
-
Symbol
|
|
16
|
+
Symbol rw_mode, # NOTE: (rbs test) validated at runtime: any Symbol is accepted here
|
|
17
17
|
bool all_read_locks,
|
|
18
18
|
String acquirer_id,
|
|
19
19
|
bool lock_index_enabled,
|
|
@@ -35,7 +35,7 @@ module RedisQueuedLocks
|
|
|
35
35
|
String lock_name,
|
|
36
36
|
String lock_key,
|
|
37
37
|
Integer milliseconds,
|
|
38
|
-
|
|
38
|
+
RQL::readWriteMode rw_mode,
|
|
39
39
|
bool all_read_locks,
|
|
40
40
|
String acquirer_id,
|
|
41
41
|
bool lock_index_enabled
|