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.
- checksums.yaml +4 -4
- data/.claude/project-overview.md +281 -0
- data/.claude/rules/acquirer.md +81 -0
- data/.claude/rules/arguments.md +60 -0
- data/.claude/rules/git.md +46 -0
- data/.claude/rules/logic.md +63 -0
- data/.claude/rules/swarm.md +120 -0
- data/.claude/rules/tests.md +48 -0
- data/.claude/rules/type-checking.md +50 -0
- data/.claude/rules/visitors.md +69 -0
- data/.rubocop.rbs.yml +31 -0
- data/.rubocop.yml +3 -3
- data/.ruby-version +1 -1
- data/CHANGELOG.md +80 -0
- data/CLAUDE.md +36 -0
- data/README.md +367 -82
- data/Rakefile +31 -2
- data/github_ci/.keep +0 -0
- data/lib/redis_queued_locks/acquirer/acquire_lock/delay_execution.rb +2 -2
- data/lib/redis_queued_locks/acquirer/acquire_lock/dequeue_from_lock_queue/log_visitor.rb +6 -3
- data/lib/redis_queued_locks/acquirer/acquire_lock/dequeue_from_lock_queue.rb +9 -7
- data/lib/redis_queued_locks/acquirer/acquire_lock/instr_visitor.rb +20 -10
- data/lib/redis_queued_locks/acquirer/acquire_lock/log_visitor.rb +34 -16
- data/lib/redis_queued_locks/acquirer/acquire_lock/try_to_lock/log_visitor.rb +240 -28
- data/lib/redis_queued_locks/acquirer/acquire_lock/try_to_lock.rb +398 -132
- data/lib/redis_queued_locks/acquirer/acquire_lock/yield_expire/log_visitor.rb +12 -6
- data/lib/redis_queued_locks/acquirer/acquire_lock/yield_expire.rb +33 -9
- data/lib/redis_queued_locks/acquirer/acquire_lock.rb +73 -24
- data/lib/redis_queued_locks/acquirer/clear_dead_requests.rb +9 -1
- data/lib/redis_queued_locks/acquirer/extend_lock_ttl.rb +182 -3
- data/lib/redis_queued_locks/acquirer/is_locked.rb +19 -2
- data/lib/redis_queued_locks/acquirer/is_queued.rb +6 -2
- data/lib/redis_queued_locks/acquirer/lock_info.rb +96 -6
- data/lib/redis_queued_locks/acquirer/lock_series_poc/instr_visitor.rb +8 -4
- data/lib/redis_queued_locks/acquirer/lock_series_poc/log_visitor.rb +18 -7
- data/lib/redis_queued_locks/acquirer/lock_series_poc.rb +126 -29
- data/lib/redis_queued_locks/acquirer/locks.rb +103 -6
- data/lib/redis_queued_locks/acquirer/queue_info.rb +38 -9
- data/lib/redis_queued_locks/acquirer/queues.rb +28 -4
- data/lib/redis_queued_locks/acquirer/release_all_locks.rb +35 -1
- data/lib/redis_queued_locks/acquirer/release_lock.rb +40 -9
- data/lib/redis_queued_locks/acquirer/release_locks_of.rb +43 -3
- data/lib/redis_queued_locks/acquirer/release_read_lock.rb +143 -0
- data/lib/redis_queued_locks/acquirer.rb +1 -0
- data/lib/redis_queued_locks/client.rb +274 -158
- data/lib/redis_queued_locks/config/dsl.rb +4 -10
- data/lib/redis_queued_locks/resource.rb +117 -9
- data/lib/redis_queued_locks/swarm/flush_zombies.rb +46 -6
- data/lib/redis_queued_locks/swarm/supervisor.rb +1 -1
- data/lib/redis_queued_locks/swarm/swarm_element/isolated.rb +166 -44
- data/lib/redis_queued_locks/swarm/swarm_element/threaded.rb +45 -47
- data/lib/redis_queued_locks/swarm/zombie_info.rb +42 -0
- data/lib/redis_queued_locks/version.rb +2 -2
- data/rbs_collection.lock.yaml +10 -2
- data/rbs_collection.yaml +0 -2
- data/redis_queued_locks.gemspec +1 -1
- data/sig/redis_queued_locks/acquirer/acquire_lock/dequeue_from_lock_queue/log_visitor.rbs +2 -1
- data/sig/redis_queued_locks/acquirer/acquire_lock/dequeue_from_lock_queue.rbs +0 -1
- data/sig/redis_queued_locks/acquirer/acquire_lock/instr_visitor.rbs +5 -0
- data/sig/redis_queued_locks/acquirer/acquire_lock/log_visitor.rbs +12 -6
- data/sig/redis_queued_locks/acquirer/acquire_lock/try_to_lock/log_visitor.rbs +74 -7
- data/sig/redis_queued_locks/acquirer/acquire_lock/try_to_lock.rbs +4 -2
- data/sig/redis_queued_locks/acquirer/acquire_lock/yield_expire.rbs +3 -0
- data/sig/redis_queued_locks/acquirer/acquire_lock/yield_with_expire/log_visitor.rbs +4 -2
- data/sig/redis_queued_locks/acquirer/extend_lock_ttl.rbs +19 -1
- data/sig/redis_queued_locks/acquirer/lock_info.rbs +9 -1
- data/sig/redis_queued_locks/acquirer/locks.rbs +10 -1
- data/sig/redis_queued_locks/acquirer/queue_info.rbs +2 -4
- data/sig/redis_queued_locks/acquirer/queues.rbs +1 -1
- data/sig/redis_queued_locks/acquirer/release_lock.rbs +8 -1
- data/sig/redis_queued_locks/acquirer/release_read_lock.rbs +44 -0
- data/sig/redis_queued_locks/client.rbs +22 -2
- data/sig/redis_queued_locks/resource.rbs +9 -2
- data/sig/redis_queued_locks/swarm/flush_zombies.rbs +1 -1
- data/sig/redis_queued_locks/swarm/swarm_element/isolated.rbs +13 -5
- data/sig/redis_queued_locks/swarm/swarm_element/threaded.rbs +6 -6
- data/sig/redis_queued_locks/swarm/zombie_info.rbs +5 -0
- metadata +17 -5
- data/github_ci/ruby3.3.gemfile +0 -17
- data/github_ci/ruby3.3.gemfile.lock +0 -216
|
@@ -6,11 +6,14 @@ module RedisQueuedLocks
|
|
|
6
6
|
module ExtendLockTTL
|
|
7
7
|
EXTEND_LOCK_PTTL: String
|
|
8
8
|
|
|
9
|
-
type extendResult = { ok: bool, result: Symbol }
|
|
9
|
+
type extendResult = { ok: bool, result: { extended_locks_count: Integer } | Symbol }
|
|
10
10
|
def self.extend_lock_ttl: (
|
|
11
11
|
RC::client redis_client,
|
|
12
12
|
String lock_name,
|
|
13
13
|
Integer milliseconds,
|
|
14
|
+
Symbol read_write_mode,
|
|
15
|
+
bool all_read_locks,
|
|
16
|
+
String acquirer_id,
|
|
14
17
|
RQL::loggerObj logger,
|
|
15
18
|
RQL::instrObj instrumenter,
|
|
16
19
|
untyped? instrument,
|
|
@@ -23,6 +26,21 @@ module RedisQueuedLocks
|
|
|
23
26
|
RQL::Instrument::samplerObj instr_sampler,
|
|
24
27
|
bool instr_sample_this
|
|
25
28
|
) -> extendResult
|
|
29
|
+
|
|
30
|
+
private def self.extend_read_lock_ttl: (
|
|
31
|
+
RC::client redis_client,
|
|
32
|
+
String lock_name,
|
|
33
|
+
String lock_key,
|
|
34
|
+
String acquirer_id,
|
|
35
|
+
Integer milliseconds
|
|
36
|
+
) -> extendResult
|
|
37
|
+
|
|
38
|
+
private def self.extend_all_read_locks_ttl: (
|
|
39
|
+
RC::client redis_client,
|
|
40
|
+
String lock_name,
|
|
41
|
+
String lock_key,
|
|
42
|
+
Integer milliseconds
|
|
43
|
+
) -> extendResult
|
|
26
44
|
end
|
|
27
45
|
end
|
|
28
46
|
end
|
|
@@ -3,8 +3,16 @@ use RedisClient as RC
|
|
|
3
3
|
module RedisQueuedLocks
|
|
4
4
|
module Acquirer
|
|
5
5
|
module LockInfo
|
|
6
|
-
type
|
|
6
|
+
type readerInfo = Hash[String,String|Float|Integer|nil]
|
|
7
|
+
type lockInfo = Hash[String,String|Float|Integer|Array[readerInfo]]
|
|
7
8
|
def self.lock_info: (RC::client redis_client, String lock_name) -> lockInfo?
|
|
9
|
+
private def self.read_lock_info: (
|
|
10
|
+
RC::client redis_client,
|
|
11
|
+
String lock_name,
|
|
12
|
+
String lock_key,
|
|
13
|
+
Array[String] redis_time,
|
|
14
|
+
Array[[String, Float]] read_locks
|
|
15
|
+
) -> lockInfo?
|
|
8
16
|
end
|
|
9
17
|
end
|
|
10
18
|
end
|
|
@@ -3,14 +3,23 @@ use RedisClient as RC
|
|
|
3
3
|
module RedisQueuedLocks
|
|
4
4
|
module Acquirer
|
|
5
5
|
module Locks
|
|
6
|
+
type readerInfo = Hash[String,String|Float|Integer|nil]
|
|
7
|
+
type lockInfo = Hash[String,String|Float|Integer|Array[readerInfo]]
|
|
6
8
|
type lockList = Set[String]
|
|
7
|
-
type locksInfo = Set[{ lock: String, status: Symbol, info:
|
|
9
|
+
type locksInfo = Set[{ lock: String, status: Symbol, info: lockInfo }]
|
|
8
10
|
type locks = lockList | locksInfo
|
|
9
11
|
|
|
10
12
|
def self.locks: (RC::client redis_client, scan_size: Integer, with_info: bool) -> locks
|
|
11
13
|
|
|
12
14
|
private def self.scan_locks: (RC::client redis_client, Integer scan_size) -> lockList
|
|
13
15
|
private def self.extract_locks_info: (RC::client redis_client, Set[::String] lock_keys) -> locksInfo
|
|
16
|
+
private def self.read_lock_info: (
|
|
17
|
+
RC::client redis_client,
|
|
18
|
+
String lock_name,
|
|
19
|
+
String lock_key,
|
|
20
|
+
Array[String] redis_time,
|
|
21
|
+
Array[[String, Float]] read_locks
|
|
22
|
+
) -> lockInfo?
|
|
14
23
|
end
|
|
15
24
|
end
|
|
16
25
|
end
|
|
@@ -3,10 +3,8 @@ use RedisClient as RC
|
|
|
3
3
|
module RedisQueuedLocks
|
|
4
4
|
module Acquirer
|
|
5
5
|
module QueueInfo
|
|
6
|
-
type
|
|
7
|
-
|
|
8
|
-
'queue' => Array[{ 'acq_id' => String, 'score' => Integer|Float }]
|
|
9
|
-
}
|
|
6
|
+
type queueRequest = Hash[String,String|Integer|Float]
|
|
7
|
+
type queueInfo = Hash[String,String|Array[queueRequest]]
|
|
10
8
|
def self.queue_info: (RC::client redis_client, String lock_name) -> queueInfo?
|
|
11
9
|
end
|
|
12
10
|
end
|
|
@@ -4,7 +4,7 @@ module RedisQueuedLocks
|
|
|
4
4
|
module Acquirer
|
|
5
5
|
module Queues
|
|
6
6
|
type queueList = Set[String]
|
|
7
|
-
type queuesInfo = Set[{ queue: String, requests: Array[Hash[String,Float]] }]
|
|
7
|
+
type queuesInfo = Set[{ queue: String, requests: Array[Hash[String,String|Float]] }]
|
|
8
8
|
type queues = queueList | queuesInfo
|
|
9
9
|
|
|
10
10
|
def self.queues: (RC::client redis_client, scan_size: Integer, with_info: bool) -> queues
|
|
@@ -32,7 +32,14 @@ module RedisQueuedLocks
|
|
|
32
32
|
) -> releaseResult
|
|
33
33
|
|
|
34
34
|
type fullReleaseResult = { ok: bool, result: { queue: Symbol, lock: Symbol } }
|
|
35
|
-
private def self.fully_release_lock: (
|
|
35
|
+
private def self.fully_release_lock: (
|
|
36
|
+
RC::client redis,
|
|
37
|
+
String lock_name,
|
|
38
|
+
String lock_key,
|
|
39
|
+
String lock_key_queue,
|
|
40
|
+
String read_lock_key_queue,
|
|
41
|
+
String lock_readers_key
|
|
42
|
+
) -> fullReleaseResult
|
|
36
43
|
end
|
|
37
44
|
end
|
|
38
45
|
end
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
use RedisQueuedLocks as RQL
|
|
2
|
+
use RedisClient as RC
|
|
3
|
+
|
|
4
|
+
module RedisQueuedLocks
|
|
5
|
+
module Acquirer
|
|
6
|
+
module ReleaseReadLock
|
|
7
|
+
extend RQL::Utilities
|
|
8
|
+
|
|
9
|
+
type releaseResult = {
|
|
10
|
+
ok: bool,
|
|
11
|
+
result: {
|
|
12
|
+
rel_time: Integer|Float,
|
|
13
|
+
rel_key: String,
|
|
14
|
+
rel_acq_id: String,
|
|
15
|
+
lock_res: Symbol
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
def self.release_read_lock: (
|
|
19
|
+
RC::client redis,
|
|
20
|
+
String lock_name,
|
|
21
|
+
String acquirer_id,
|
|
22
|
+
RQL::instrObj instrumenter,
|
|
23
|
+
RQL::loggerObj logger,
|
|
24
|
+
untyped? instrument,
|
|
25
|
+
bool log_sampling_enabled,
|
|
26
|
+
Integer log_sampling_percent,
|
|
27
|
+
RQL::Logging::samplerObj log_sampler,
|
|
28
|
+
bool log_sample_this,
|
|
29
|
+
bool instr_sampling_enabled,
|
|
30
|
+
Integer instr_sampling_percent,
|
|
31
|
+
RQL::Instrument::samplerObj instr_sampler,
|
|
32
|
+
bool instr_sample_this
|
|
33
|
+
) -> releaseResult
|
|
34
|
+
|
|
35
|
+
type fullReleaseResult = { ok: bool, result: { lock: Symbol } }
|
|
36
|
+
private def self.fully_release_read_lock: (
|
|
37
|
+
RC::client redis,
|
|
38
|
+
String lock_readers_key,
|
|
39
|
+
String read_lock_key,
|
|
40
|
+
String acquirer_id
|
|
41
|
+
) -> fullReleaseResult
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
end
|
|
@@ -44,7 +44,7 @@ module RedisQueuedLocks
|
|
|
44
44
|
?raise_errors: bool,
|
|
45
45
|
?fail_fast: bool,
|
|
46
46
|
?conflict_strategy: Symbol,
|
|
47
|
-
?read_write_mode:
|
|
47
|
+
?read_write_mode: :read | :write,
|
|
48
48
|
?access_strategy: Symbol,
|
|
49
49
|
?identity: String,
|
|
50
50
|
?meta: Hash[String|Symbol,untyped]?,
|
|
@@ -74,7 +74,7 @@ module RedisQueuedLocks
|
|
|
74
74
|
?retry_jitter: Integer,
|
|
75
75
|
?fail_fast: bool,
|
|
76
76
|
?conflict_strategy: Symbol,
|
|
77
|
-
?read_write_mode:
|
|
77
|
+
?read_write_mode: :read | :write,
|
|
78
78
|
?access_strategy: Symbol,
|
|
79
79
|
?identity: String,
|
|
80
80
|
?instrumenter: RQL::instrObj,
|
|
@@ -109,6 +109,23 @@ module RedisQueuedLocks
|
|
|
109
109
|
) -> RQL::Acquirer::ReleaseLock::releaseResult
|
|
110
110
|
alias release_lock unlock
|
|
111
111
|
|
|
112
|
+
def unlock_read: (
|
|
113
|
+
String lock_name,
|
|
114
|
+
?identity: String,
|
|
115
|
+
?logger: RQL::loggerObj,
|
|
116
|
+
?instrumenter: RQL::instrObj,
|
|
117
|
+
?instrument: untyped?,
|
|
118
|
+
?log_sampling_enabled: bool,
|
|
119
|
+
?log_sampling_percent: Integer,
|
|
120
|
+
?log_sampler: RQL::Logging::samplerObj,
|
|
121
|
+
?log_sample_this: bool,
|
|
122
|
+
?instr_sampling_enabled: bool,
|
|
123
|
+
?instr_sampling_percent: Integer,
|
|
124
|
+
?instr_sampler: RQL::Instrument::samplerObj,
|
|
125
|
+
?instr_sample_this: bool
|
|
126
|
+
) -> RQL::Acquirer::ReleaseReadLock::releaseResult
|
|
127
|
+
alias release_read_lock unlock_read
|
|
128
|
+
|
|
112
129
|
def locked?: (String lock_name) -> bool
|
|
113
130
|
def queued?: (String lock_name) -> bool
|
|
114
131
|
def lock_info: (String lock_name) -> RQL::Acquirer::LockInfo::lockInfo?
|
|
@@ -138,6 +155,9 @@ module RedisQueuedLocks
|
|
|
138
155
|
def extend_lock_ttl: (
|
|
139
156
|
String lock_name,
|
|
140
157
|
Integer milliseconds,
|
|
158
|
+
?read_write_mode: :read | :write,
|
|
159
|
+
?all_read_locks: bool,
|
|
160
|
+
?identity: String,
|
|
141
161
|
?logger: RQL::loggerObj,
|
|
142
162
|
?instrumenter: RQL::instrObj,
|
|
143
163
|
?instrument: untyped?,
|
|
@@ -4,7 +4,8 @@ module RedisQueuedLocks
|
|
|
4
4
|
LOCK_PATTERN: String
|
|
5
5
|
LOCK_QUEUE_PATTERN: String
|
|
6
6
|
READ_LOCK_QUEUE_PATTERN: String
|
|
7
|
-
|
|
7
|
+
LOCK_READERS_PATTERN: String
|
|
8
|
+
READ_LOCK_PATTERN: String
|
|
8
9
|
SWARM_KEY: String
|
|
9
10
|
REDIS_TIMESHIFT_ERROR: Integer
|
|
10
11
|
|
|
@@ -27,7 +28,13 @@ module RedisQueuedLocks
|
|
|
27
28
|
def self.prepare_lock_key: (String lock_name) -> String
|
|
28
29
|
def self.prepare_lock_queue: (String lock_name) -> String
|
|
29
30
|
def self.prepare_read_lock_queue: (String lock_name) -> String
|
|
30
|
-
def self.
|
|
31
|
+
def self.prepare_lock_readers: (String lock_name) -> String
|
|
32
|
+
def self.prepare_read_lock_key: (String lock_name, String acquirer_id) -> String
|
|
33
|
+
def self.lock_queue_rw_mode: (String lock_queue) -> String?
|
|
34
|
+
def self.lock_name_from_readers: (String lock_readers_key) -> String
|
|
35
|
+
def self.lock_key_from_readers: (String lock_readers_key) -> String
|
|
36
|
+
def self.host_identifier_from_acquirer: (String acquirer_id) -> String
|
|
37
|
+
def self.redis_time_ms: (Array[String] redis_time) -> Integer
|
|
31
38
|
def self.calc_initial_acquirer_position: () -> Float
|
|
32
39
|
def self.acquirer_dead_score: (Integer|Float queue_ttl) -> Float
|
|
33
40
|
def self.calc_zombie_score: (Float zombie_ttl) -> Float
|
|
@@ -7,7 +7,7 @@ module RedisQueuedLocks
|
|
|
7
7
|
def self.flush_zombies: (RC::client redis_client, Integer zombie_ttl, Integer lock_scan_size, Integer queue_scan_size) -> flushedZombies
|
|
8
8
|
|
|
9
9
|
def enabled?: () -> bool
|
|
10
|
-
def
|
|
10
|
+
def spawn_swarm_element!: (Ractor::Port[SwarmElement::Isolated::resultsPortMessage] swarm_element_results_port) -> Ractor
|
|
11
11
|
end
|
|
12
12
|
end
|
|
13
13
|
end
|
|
@@ -8,10 +8,14 @@ module RedisQueuedLocks
|
|
|
8
8
|
|
|
9
9
|
@rql_client: RQL::Client
|
|
10
10
|
@swarm_element: Ractor?
|
|
11
|
+
@swarm_element_commands_port: Ractor::Port[Symbol]?
|
|
12
|
+
@swarm_element_results_port: Ractor::Port[resultsPortMessage]?
|
|
11
13
|
@sync: RQL::Utilities::Lock
|
|
12
14
|
|
|
13
15
|
attr_reader rql_client: RQL::Client
|
|
14
16
|
attr_reader swarm_element: Ractor?
|
|
17
|
+
attr_reader swarm_element_commands_port: Ractor::Port[Symbol]?
|
|
18
|
+
attr_reader swarm_element_results_port: Ractor::Port[resultsPortMessage]?
|
|
15
19
|
attr_reader sync: RQL::Utilities::Lock
|
|
16
20
|
|
|
17
21
|
def initialize: (RQL::Client rql_client) -> void
|
|
@@ -27,25 +31,29 @@ module RedisQueuedLocks
|
|
|
27
31
|
}
|
|
28
32
|
def status: () -> elementStatus
|
|
29
33
|
|
|
30
|
-
|
|
34
|
+
type swarmLoopStatus = { alive: bool, state: String }
|
|
35
|
+
type swarmLoopReply = swarmLoopStatus | bool
|
|
36
|
+
type resultsPortMessage = swarmLoopReply | Ractor::Port[Symbol] | Symbol
|
|
37
|
+
def self.swarm_loop: (Ractor::Port[resultsPortMessage] swarm_element_results_port) { () -> Thread } -> void
|
|
38
|
+
def self.terminate_thread: (Thread? thread) -> void
|
|
31
39
|
|
|
32
40
|
private
|
|
33
41
|
|
|
34
42
|
def swarm!: () -> void
|
|
43
|
+
def spawn_swarm_element!: (Ractor::Port[resultsPortMessage] swarm_element_results_port) -> Ractor
|
|
35
44
|
def idle?: () -> bool
|
|
36
45
|
def swarmed?: () -> bool
|
|
37
46
|
def swarmed__alive?: () -> bool
|
|
38
47
|
def swarmed__dead?: () -> bool
|
|
39
48
|
def swarmed__running?: () -> bool
|
|
40
49
|
def swarmed__stopped?: () -> bool
|
|
41
|
-
def swarm_loop__is_active: () -> bool
|
|
42
|
-
|
|
43
|
-
type swarmLoopStatus = { main_loop: { alive: bool, state: String } }
|
|
50
|
+
def swarm_loop__is_active: () -> bool?
|
|
44
51
|
def swarm_loop__status: () -> swarmLoopStatus?
|
|
45
52
|
|
|
46
53
|
def swarm_loop__start: () -> void
|
|
47
|
-
def
|
|
54
|
+
def swarm_loop__stop: () -> void
|
|
48
55
|
def swarm_loop__kill: () -> void
|
|
56
|
+
def swarm_loop__send_command: (Symbol command) -> swarmLoopReply?
|
|
49
57
|
end
|
|
50
58
|
end
|
|
51
59
|
end
|
|
@@ -10,14 +10,14 @@ module RedisQueuedLocks
|
|
|
10
10
|
@swarm_element: Thread?
|
|
11
11
|
@main_loop: Thread?
|
|
12
12
|
@swarm_element_commands: Thread::SizedQueue[Symbol]?
|
|
13
|
-
@swarm_element_results: Thread::SizedQueue[
|
|
13
|
+
@swarm_element_results: Thread::SizedQueue[swarmLoopReply]?
|
|
14
14
|
@sync: RQL::Utilities::Lock
|
|
15
15
|
|
|
16
16
|
attr_reader rql_client: RQL::Client
|
|
17
17
|
attr_reader swarm_element: Thread?
|
|
18
18
|
attr_reader main_loop: Thread?
|
|
19
19
|
attr_reader swarm_element_commands: Thread::SizedQueue[Symbol]?
|
|
20
|
-
attr_reader swarm_element_results: Thread::SizedQueue[
|
|
20
|
+
attr_reader swarm_element_results: Thread::SizedQueue[swarmLoopReply]?
|
|
21
21
|
attr_reader sync: RQL::Utilities::Lock
|
|
22
22
|
|
|
23
23
|
def initialize: (RQL::Client rql_client) -> void
|
|
@@ -46,14 +46,14 @@ module RedisQueuedLocks
|
|
|
46
46
|
def terminating?: () -> bool?
|
|
47
47
|
def swarmed__stopped?: () -> bool
|
|
48
48
|
|
|
49
|
-
type
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
type swarmLoopStatus = { ok: bool, result: { main_loop: { alive: bool, state: String } } }
|
|
49
|
+
type swarmLoopStatus = { alive: bool, state: String }
|
|
50
|
+
type swarmLoopReply = swarmLoopStatus | bool
|
|
51
|
+
def swarm_loop__is_active: () -> bool?
|
|
53
52
|
def swarm_loop__status: () -> swarmLoopStatus?
|
|
54
53
|
|
|
55
54
|
def swarm_loop__start: () -> void
|
|
56
55
|
def swarm_loop__stop: () -> void
|
|
56
|
+
def swarm_loop__send_command: (Symbol command) -> swarmLoopReply?
|
|
57
57
|
def swarm_element__termiante: () -> void
|
|
58
58
|
end
|
|
59
59
|
end
|
|
@@ -19,6 +19,11 @@ module RedisQueuedLocks
|
|
|
19
19
|
private def self.extract_zombie_locks: (RC::client rconn, Integer zombie_ttl, Integer lock_scan_size) -> zombieLocks
|
|
20
20
|
private def self.extract_zombie_acquirers: (RC::client rconn, Integer zombie_ttl, Integer lock_scan_size) -> zombieAcquirers
|
|
21
21
|
private def self.extract_all: (RC::client rconn, Integer zombie_ttl, Integer lock_scan_size) -> zombieInfo
|
|
22
|
+
private def self.each_zombie_read_lock: (
|
|
23
|
+
RC::client rconn,
|
|
24
|
+
Set[String] zombie_hosts,
|
|
25
|
+
Integer lock_scan_size
|
|
26
|
+
) { (String lock_readers_key, String acquirer_id) -> void } -> void
|
|
22
27
|
end
|
|
23
28
|
end
|
|
24
29
|
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: redis_queued_locks
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.
|
|
4
|
+
version: 1.18.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Rustam Ibragimov
|
|
@@ -35,17 +35,27 @@ executables: []
|
|
|
35
35
|
extensions: []
|
|
36
36
|
extra_rdoc_files: []
|
|
37
37
|
files:
|
|
38
|
+
- ".claude/project-overview.md"
|
|
39
|
+
- ".claude/rules/acquirer.md"
|
|
40
|
+
- ".claude/rules/arguments.md"
|
|
41
|
+
- ".claude/rules/git.md"
|
|
42
|
+
- ".claude/rules/logic.md"
|
|
43
|
+
- ".claude/rules/swarm.md"
|
|
44
|
+
- ".claude/rules/tests.md"
|
|
45
|
+
- ".claude/rules/type-checking.md"
|
|
46
|
+
- ".claude/rules/visitors.md"
|
|
38
47
|
- ".rspec"
|
|
48
|
+
- ".rubocop.rbs.yml"
|
|
39
49
|
- ".rubocop.yml"
|
|
40
50
|
- ".ruby-version"
|
|
41
51
|
- CHANGELOG.md
|
|
52
|
+
- CLAUDE.md
|
|
42
53
|
- CODE_OF_CONDUCT.md
|
|
43
54
|
- LICENSE.txt
|
|
44
55
|
- README.md
|
|
45
56
|
- Rakefile
|
|
46
57
|
- Steepfile
|
|
47
|
-
- github_ci
|
|
48
|
-
- github_ci/ruby3.3.gemfile.lock
|
|
58
|
+
- github_ci/.keep
|
|
49
59
|
- lib/redis_queued_locks.rb
|
|
50
60
|
- lib/redis_queued_locks/acquirer.rb
|
|
51
61
|
- lib/redis_queued_locks/acquirer/acquire_lock.rb
|
|
@@ -74,6 +84,7 @@ files:
|
|
|
74
84
|
- lib/redis_queued_locks/acquirer/release_all_locks.rb
|
|
75
85
|
- lib/redis_queued_locks/acquirer/release_lock.rb
|
|
76
86
|
- lib/redis_queued_locks/acquirer/release_locks_of.rb
|
|
87
|
+
- lib/redis_queued_locks/acquirer/release_read_lock.rb
|
|
77
88
|
- lib/redis_queued_locks/client.rb
|
|
78
89
|
- lib/redis_queued_locks/config.rb
|
|
79
90
|
- lib/redis_queued_locks/config/dsl.rb
|
|
@@ -131,6 +142,7 @@ files:
|
|
|
131
142
|
- sig/redis_queued_locks/acquirer/release_all_locks.rbs
|
|
132
143
|
- sig/redis_queued_locks/acquirer/release_lock.rbs
|
|
133
144
|
- sig/redis_queued_locks/acquirer/release_locks_of.rbs
|
|
145
|
+
- sig/redis_queued_locks/acquirer/release_read_lock.rbs
|
|
134
146
|
- sig/redis_queued_locks/client.rbs
|
|
135
147
|
- sig/redis_queued_locks/config.rbs
|
|
136
148
|
- sig/redis_queued_locks/config/dsl.rbs
|
|
@@ -176,14 +188,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
176
188
|
requirements:
|
|
177
189
|
- - ">="
|
|
178
190
|
- !ruby/object:Gem::Version
|
|
179
|
-
version: '
|
|
191
|
+
version: '4.0'
|
|
180
192
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
181
193
|
requirements:
|
|
182
194
|
- - ">="
|
|
183
195
|
- !ruby/object:Gem::Version
|
|
184
196
|
version: '0'
|
|
185
197
|
requirements: []
|
|
186
|
-
rubygems_version:
|
|
198
|
+
rubygems_version: 4.0.22
|
|
187
199
|
specification_version: 4
|
|
188
200
|
summary: Distributed locks with "prioritized lock acquisition queue" capabilities
|
|
189
201
|
based on the Redis Database.
|
data/github_ci/ruby3.3.gemfile
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
source 'https://rubygems.org'
|
|
4
|
-
|
|
5
|
-
gemspec path: '..'
|
|
6
|
-
|
|
7
|
-
gem 'activesupport'
|
|
8
|
-
gem 'armitage-rubocop'
|
|
9
|
-
gem 'bundler'
|
|
10
|
-
gem 'pry'
|
|
11
|
-
gem 'rake'
|
|
12
|
-
gem 'rbs'
|
|
13
|
-
gem 'rspec'
|
|
14
|
-
gem 'rspec-retry' # NOTE: temporary decision for non-refactored tests
|
|
15
|
-
gem 'simplecov'
|
|
16
|
-
gem 'simplecov-lcov'
|
|
17
|
-
gem 'steep'
|
|
@@ -1,216 +0,0 @@
|
|
|
1
|
-
PATH
|
|
2
|
-
remote: ..
|
|
3
|
-
specs:
|
|
4
|
-
redis_queued_locks (1.15.1)
|
|
5
|
-
redis-client (~> 0.20)
|
|
6
|
-
|
|
7
|
-
GEM
|
|
8
|
-
remote: https://rubygems.org/
|
|
9
|
-
specs:
|
|
10
|
-
activesupport (8.1.0)
|
|
11
|
-
base64
|
|
12
|
-
bigdecimal
|
|
13
|
-
concurrent-ruby (~> 1.0, >= 1.3.1)
|
|
14
|
-
connection_pool (>= 2.2.5)
|
|
15
|
-
drb
|
|
16
|
-
i18n (>= 1.6, < 2)
|
|
17
|
-
json
|
|
18
|
-
logger (>= 1.4.2)
|
|
19
|
-
minitest (>= 5.1)
|
|
20
|
-
securerandom (>= 0.3)
|
|
21
|
-
tzinfo (~> 2.0, >= 2.0.5)
|
|
22
|
-
uri (>= 0.13.1)
|
|
23
|
-
armitage-rubocop (1.75.7.7)
|
|
24
|
-
rubocop (= 1.75.7)
|
|
25
|
-
rubocop-capybara (= 2.22.1)
|
|
26
|
-
rubocop-factory_bot (= 2.27.1)
|
|
27
|
-
rubocop-on-rbs (= 1.7.0)
|
|
28
|
-
rubocop-performance (= 1.25.0)
|
|
29
|
-
rubocop-rails (= 2.32.0)
|
|
30
|
-
rubocop-rake (= 0.7.1)
|
|
31
|
-
rubocop-rspec (= 3.6.0)
|
|
32
|
-
rubocop-rspec_rails (= 2.31.0)
|
|
33
|
-
rubocop-thread_safety (= 0.7.2)
|
|
34
|
-
ast (2.4.3)
|
|
35
|
-
base64 (0.3.0)
|
|
36
|
-
bigdecimal (3.3.1)
|
|
37
|
-
coderay (1.1.3)
|
|
38
|
-
concurrent-ruby (1.3.5)
|
|
39
|
-
connection_pool (2.5.4)
|
|
40
|
-
csv (3.3.5)
|
|
41
|
-
diff-lcs (1.6.2)
|
|
42
|
-
docile (1.4.1)
|
|
43
|
-
drb (2.2.3)
|
|
44
|
-
ffi (1.17.2)
|
|
45
|
-
ffi (1.17.2-aarch64-linux-gnu)
|
|
46
|
-
ffi (1.17.2-aarch64-linux-musl)
|
|
47
|
-
ffi (1.17.2-arm-linux-gnu)
|
|
48
|
-
ffi (1.17.2-arm-linux-musl)
|
|
49
|
-
ffi (1.17.2-arm64-darwin)
|
|
50
|
-
ffi (1.17.2-x86-linux-gnu)
|
|
51
|
-
ffi (1.17.2-x86-linux-musl)
|
|
52
|
-
ffi (1.17.2-x86_64-darwin)
|
|
53
|
-
ffi (1.17.2-x86_64-linux-gnu)
|
|
54
|
-
ffi (1.17.2-x86_64-linux-musl)
|
|
55
|
-
fileutils (1.7.3)
|
|
56
|
-
i18n (1.14.7)
|
|
57
|
-
concurrent-ruby (~> 1.0)
|
|
58
|
-
json (2.15.1)
|
|
59
|
-
language_server-protocol (3.17.0.5)
|
|
60
|
-
lint_roller (1.1.0)
|
|
61
|
-
listen (3.9.0)
|
|
62
|
-
rb-fsevent (~> 0.10, >= 0.10.3)
|
|
63
|
-
rb-inotify (~> 0.9, >= 0.9.10)
|
|
64
|
-
logger (1.7.0)
|
|
65
|
-
method_source (1.1.0)
|
|
66
|
-
minitest (5.26.0)
|
|
67
|
-
mutex_m (0.3.0)
|
|
68
|
-
parallel (1.27.0)
|
|
69
|
-
parser (3.3.9.0)
|
|
70
|
-
ast (~> 2.4.1)
|
|
71
|
-
racc
|
|
72
|
-
prism (1.6.0)
|
|
73
|
-
pry (0.15.2)
|
|
74
|
-
coderay (~> 1.1)
|
|
75
|
-
method_source (~> 1.0)
|
|
76
|
-
racc (1.8.1)
|
|
77
|
-
rack (3.2.3)
|
|
78
|
-
rainbow (3.1.1)
|
|
79
|
-
rake (13.3.0)
|
|
80
|
-
rb-fsevent (0.11.2)
|
|
81
|
-
rb-inotify (0.11.1)
|
|
82
|
-
ffi (~> 1.0)
|
|
83
|
-
rbs (3.9.5)
|
|
84
|
-
logger
|
|
85
|
-
redis-client (0.26.1)
|
|
86
|
-
connection_pool
|
|
87
|
-
regexp_parser (2.11.3)
|
|
88
|
-
rspec (3.13.2)
|
|
89
|
-
rspec-core (~> 3.13.0)
|
|
90
|
-
rspec-expectations (~> 3.13.0)
|
|
91
|
-
rspec-mocks (~> 3.13.0)
|
|
92
|
-
rspec-core (3.13.6)
|
|
93
|
-
rspec-support (~> 3.13.0)
|
|
94
|
-
rspec-expectations (3.13.5)
|
|
95
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
|
96
|
-
rspec-support (~> 3.13.0)
|
|
97
|
-
rspec-mocks (3.13.6)
|
|
98
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
|
99
|
-
rspec-support (~> 3.13.0)
|
|
100
|
-
rspec-retry (0.6.2)
|
|
101
|
-
rspec-core (> 3.3)
|
|
102
|
-
rspec-support (3.13.6)
|
|
103
|
-
rubocop (1.75.7)
|
|
104
|
-
json (~> 2.3)
|
|
105
|
-
language_server-protocol (~> 3.17.0.2)
|
|
106
|
-
lint_roller (~> 1.1.0)
|
|
107
|
-
parallel (~> 1.10)
|
|
108
|
-
parser (>= 3.3.0.2)
|
|
109
|
-
rainbow (>= 2.2.2, < 4.0)
|
|
110
|
-
regexp_parser (>= 2.9.3, < 3.0)
|
|
111
|
-
rubocop-ast (>= 1.44.0, < 2.0)
|
|
112
|
-
ruby-progressbar (~> 1.7)
|
|
113
|
-
unicode-display_width (>= 2.4.0, < 4.0)
|
|
114
|
-
rubocop-ast (1.47.1)
|
|
115
|
-
parser (>= 3.3.7.2)
|
|
116
|
-
prism (~> 1.4)
|
|
117
|
-
rubocop-capybara (2.22.1)
|
|
118
|
-
lint_roller (~> 1.1)
|
|
119
|
-
rubocop (~> 1.72, >= 1.72.1)
|
|
120
|
-
rubocop-factory_bot (2.27.1)
|
|
121
|
-
lint_roller (~> 1.1)
|
|
122
|
-
rubocop (~> 1.72, >= 1.72.1)
|
|
123
|
-
rubocop-on-rbs (1.7.0)
|
|
124
|
-
lint_roller (~> 1.1)
|
|
125
|
-
rbs (~> 3.5)
|
|
126
|
-
rubocop (>= 1.72.1, < 2.0)
|
|
127
|
-
zlib
|
|
128
|
-
rubocop-performance (1.25.0)
|
|
129
|
-
lint_roller (~> 1.1)
|
|
130
|
-
rubocop (>= 1.75.0, < 2.0)
|
|
131
|
-
rubocop-ast (>= 1.38.0, < 2.0)
|
|
132
|
-
rubocop-rails (2.32.0)
|
|
133
|
-
activesupport (>= 4.2.0)
|
|
134
|
-
lint_roller (~> 1.1)
|
|
135
|
-
rack (>= 1.1)
|
|
136
|
-
rubocop (>= 1.75.0, < 2.0)
|
|
137
|
-
rubocop-ast (>= 1.44.0, < 2.0)
|
|
138
|
-
rubocop-rake (0.7.1)
|
|
139
|
-
lint_roller (~> 1.1)
|
|
140
|
-
rubocop (>= 1.72.1)
|
|
141
|
-
rubocop-rspec (3.6.0)
|
|
142
|
-
lint_roller (~> 1.1)
|
|
143
|
-
rubocop (~> 1.72, >= 1.72.1)
|
|
144
|
-
rubocop-rspec_rails (2.31.0)
|
|
145
|
-
lint_roller (~> 1.1)
|
|
146
|
-
rubocop (~> 1.72, >= 1.72.1)
|
|
147
|
-
rubocop-rspec (~> 3.5)
|
|
148
|
-
rubocop-thread_safety (0.7.2)
|
|
149
|
-
lint_roller (~> 1.1)
|
|
150
|
-
rubocop (~> 1.72, >= 1.72.1)
|
|
151
|
-
ruby-progressbar (1.13.0)
|
|
152
|
-
securerandom (0.4.1)
|
|
153
|
-
simplecov (0.22.0)
|
|
154
|
-
docile (~> 1.1)
|
|
155
|
-
simplecov-html (~> 0.11)
|
|
156
|
-
simplecov_json_formatter (~> 0.1)
|
|
157
|
-
simplecov-html (0.13.2)
|
|
158
|
-
simplecov-lcov (0.9.0)
|
|
159
|
-
simplecov_json_formatter (0.1.4)
|
|
160
|
-
steep (1.10.0)
|
|
161
|
-
activesupport (>= 5.1)
|
|
162
|
-
concurrent-ruby (>= 1.1.10)
|
|
163
|
-
csv (>= 3.0.9)
|
|
164
|
-
fileutils (>= 1.1.0)
|
|
165
|
-
json (>= 2.1.0)
|
|
166
|
-
language_server-protocol (>= 3.17.0.4, < 4.0)
|
|
167
|
-
listen (~> 3.0)
|
|
168
|
-
logger (>= 1.3.0)
|
|
169
|
-
mutex_m (>= 0.3.0)
|
|
170
|
-
parser (>= 3.1)
|
|
171
|
-
rainbow (>= 2.2.2, < 4.0)
|
|
172
|
-
rbs (~> 3.9)
|
|
173
|
-
securerandom (>= 0.1)
|
|
174
|
-
strscan (>= 1.0.0)
|
|
175
|
-
terminal-table (>= 2, < 5)
|
|
176
|
-
uri (>= 0.12.0)
|
|
177
|
-
strscan (3.1.5)
|
|
178
|
-
terminal-table (4.0.0)
|
|
179
|
-
unicode-display_width (>= 1.1.1, < 4)
|
|
180
|
-
tzinfo (2.0.6)
|
|
181
|
-
concurrent-ruby (~> 1.0)
|
|
182
|
-
unicode-display_width (3.2.0)
|
|
183
|
-
unicode-emoji (~> 4.1)
|
|
184
|
-
unicode-emoji (4.1.0)
|
|
185
|
-
uri (1.0.4)
|
|
186
|
-
zlib (3.2.1)
|
|
187
|
-
|
|
188
|
-
PLATFORMS
|
|
189
|
-
aarch64-linux-gnu
|
|
190
|
-
aarch64-linux-musl
|
|
191
|
-
arm-linux-gnu
|
|
192
|
-
arm-linux-musl
|
|
193
|
-
arm64-darwin
|
|
194
|
-
ruby
|
|
195
|
-
x86-linux-gnu
|
|
196
|
-
x86-linux-musl
|
|
197
|
-
x86_64-darwin
|
|
198
|
-
x86_64-linux-gnu
|
|
199
|
-
x86_64-linux-musl
|
|
200
|
-
|
|
201
|
-
DEPENDENCIES
|
|
202
|
-
activesupport
|
|
203
|
-
armitage-rubocop
|
|
204
|
-
bundler
|
|
205
|
-
pry
|
|
206
|
-
rake
|
|
207
|
-
rbs
|
|
208
|
-
redis_queued_locks!
|
|
209
|
-
rspec
|
|
210
|
-
rspec-retry
|
|
211
|
-
simplecov
|
|
212
|
-
simplecov-lcov
|
|
213
|
-
steep
|
|
214
|
-
|
|
215
|
-
BUNDLED WITH
|
|
216
|
-
2.7.2
|