redis_queued_locks 1.12.1 → 1.13.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 (120) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +4 -1
  3. data/.ruby-version +1 -1
  4. data/CHANGELOG.md +32 -5
  5. data/LICENSE.txt +1 -1
  6. data/README.md +222 -203
  7. data/Rakefile +12 -4
  8. data/Steepfile +16 -0
  9. data/github_ci/ruby3.3.gemfile +17 -0
  10. data/github_ci/ruby3.3.gemfile.lock +217 -0
  11. data/lib/redis_queued_locks/{acquier → acquirer}/acquire_lock/delay_execution.rb +4 -4
  12. data/lib/redis_queued_locks/acquirer/acquire_lock/dequeue_from_lock_queue/log_visitor.rb +40 -0
  13. data/lib/redis_queued_locks/{acquier → acquirer}/acquire_lock/dequeue_from_lock_queue.rb +17 -8
  14. data/lib/redis_queued_locks/acquirer/acquire_lock/instr_visitor.rb +166 -0
  15. data/lib/redis_queued_locks/acquirer/acquire_lock/log_visitor.rb +218 -0
  16. data/lib/redis_queued_locks/acquirer/acquire_lock/try_to_lock/log_visitor.rb +543 -0
  17. data/lib/redis_queued_locks/{acquier → acquirer}/acquire_lock/try_to_lock.rb +126 -92
  18. data/lib/redis_queued_locks/{acquier → acquirer}/acquire_lock/with_acq_timeout.rb +14 -9
  19. data/lib/redis_queued_locks/acquirer/acquire_lock/yield_expire/log_visitor.rb +76 -0
  20. data/lib/redis_queued_locks/{acquier → acquirer}/acquire_lock/yield_expire.rb +42 -19
  21. data/lib/redis_queued_locks/{acquier → acquirer}/acquire_lock.rb +68 -41
  22. data/lib/redis_queued_locks/{acquier → acquirer}/clear_dead_requests.rb +5 -3
  23. data/lib/redis_queued_locks/{acquier → acquirer}/extend_lock_ttl.rb +4 -3
  24. data/lib/redis_queued_locks/{acquier → acquirer}/is_locked.rb +1 -1
  25. data/lib/redis_queued_locks/{acquier → acquirer}/is_queued.rb +1 -1
  26. data/lib/redis_queued_locks/{acquier → acquirer}/keys.rb +5 -5
  27. data/lib/redis_queued_locks/{acquier → acquirer}/lock_info.rb +9 -5
  28. data/lib/redis_queued_locks/{acquier → acquirer}/locks.rb +16 -3
  29. data/lib/redis_queued_locks/{acquier → acquirer}/queue_info.rb +8 -6
  30. data/lib/redis_queued_locks/{acquier → acquirer}/queues.rb +9 -2
  31. data/lib/redis_queued_locks/{acquier → acquirer}/release_all_locks.rb +23 -18
  32. data/lib/redis_queued_locks/{acquier → acquirer}/release_lock.rb +25 -19
  33. data/lib/redis_queued_locks/acquirer.rb +18 -0
  34. data/lib/redis_queued_locks/client.rb +164 -254
  35. data/lib/redis_queued_locks/config/dsl.rb +94 -0
  36. data/lib/redis_queued_locks/config.rb +231 -0
  37. data/lib/redis_queued_locks/data.rb +2 -0
  38. data/lib/redis_queued_locks/errors.rb +27 -11
  39. data/lib/redis_queued_locks/instrument.rb +11 -4
  40. data/lib/redis_queued_locks/logging/void_logger.rb +38 -1
  41. data/lib/redis_queued_locks/logging.rb +20 -5
  42. data/lib/redis_queued_locks/resource.rb +49 -11
  43. data/lib/redis_queued_locks/swarm/acquirers.rb +17 -16
  44. data/lib/redis_queued_locks/swarm/flush_zombies.rb +26 -25
  45. data/lib/redis_queued_locks/swarm/probe_hosts.rb +20 -19
  46. data/lib/redis_queued_locks/swarm/redis_client_builder.rb +3 -3
  47. data/lib/redis_queued_locks/swarm/supervisor.rb +19 -6
  48. data/lib/redis_queued_locks/swarm/swarm_element/isolated.rb +20 -18
  49. data/lib/redis_queued_locks/swarm/swarm_element/threaded.rb +35 -27
  50. data/lib/redis_queued_locks/swarm/zombie_info.rb +9 -9
  51. data/lib/redis_queued_locks/swarm.rb +20 -41
  52. data/lib/redis_queued_locks/utilities.rb +2 -2
  53. data/lib/redis_queued_locks/version.rb +2 -2
  54. data/lib/redis_queued_locks.rb +2 -2
  55. data/rbs_collection.lock.yaml +40 -0
  56. data/rbs_collection.yaml +16 -0
  57. data/redis_queued_locks.gemspec +22 -23
  58. data/sig/manifest.yml +7 -0
  59. data/sig/redis_queued_locks/acquier.rbs +4 -0
  60. data/sig/redis_queued_locks/acquirer/acquire_lock/delay_execution.rbs +9 -0
  61. data/sig/redis_queued_locks/acquirer/acquire_lock/dequeue_from_lock_queue/log_visitor.rbs +21 -0
  62. data/sig/redis_queued_locks/acquirer/acquire_lock/dequeue_from_lock_queue.rbs +26 -0
  63. data/sig/redis_queued_locks/acquirer/acquire_lock/instr_visitor.rbs +71 -0
  64. data/sig/redis_queued_locks/acquirer/acquire_lock/log_visitor.rbs +72 -0
  65. data/sig/redis_queued_locks/acquirer/acquire_lock/try_to_lock/log_visitor.rbs +179 -0
  66. data/sig/redis_queued_locks/acquirer/acquire_lock/try_to_lock.rbs +48 -0
  67. data/sig/redis_queued_locks/acquirer/acquire_lock/with_acq_timeout.rbs +19 -0
  68. data/sig/redis_queued_locks/acquirer/acquire_lock/yield_expire.rbs +41 -0
  69. data/sig/redis_queued_locks/acquirer/acquire_lock/yield_with_expire/log_visitor.rbs +32 -0
  70. data/sig/redis_queued_locks/acquirer/acquire_lock.rbs +51 -0
  71. data/sig/redis_queued_locks/acquirer/clear_dead_requests.rbs +28 -0
  72. data/sig/redis_queued_locks/acquirer/extend_lock_ttl.rbs +28 -0
  73. data/sig/redis_queued_locks/acquirer/is_locked.rbs +9 -0
  74. data/sig/redis_queued_locks/acquirer/is_queued.rbs +9 -0
  75. data/sig/redis_queued_locks/acquirer/keys.rbs +10 -0
  76. data/sig/redis_queued_locks/acquirer/lock_info.rbs +10 -0
  77. data/sig/redis_queued_locks/acquirer/locks.rbs +16 -0
  78. data/sig/redis_queued_locks/acquirer/queue_info.rbs +13 -0
  79. data/sig/redis_queued_locks/acquirer/queues.rbs +16 -0
  80. data/sig/redis_queued_locks/acquirer/release_all_locks.rbs +30 -0
  81. data/sig/redis_queued_locks/acquirer/release_lock.rbs +38 -0
  82. data/sig/redis_queued_locks/client.rbs +195 -0
  83. data/sig/redis_queued_locks/config/dsl.rbs +26 -0
  84. data/sig/redis_queued_locks/config.rbs +23 -0
  85. data/sig/redis_queued_locks/data.rbs +4 -0
  86. data/sig/redis_queued_locks/debugger/interface.rbs +9 -0
  87. data/sig/redis_queued_locks/debugger.rbs +13 -0
  88. data/sig/redis_queued_locks/errors.rbs +43 -0
  89. data/sig/redis_queued_locks/instrument/active_support.rbs +7 -0
  90. data/sig/redis_queued_locks/instrument/sampler.rbs +9 -0
  91. data/sig/redis_queued_locks/instrument/void_notifier.rbs +7 -0
  92. data/sig/redis_queued_locks/instrument.rbs +15 -0
  93. data/sig/redis_queued_locks/logging/sampler.rbs +9 -0
  94. data/sig/redis_queued_locks/logging/void_logger.rbs +15 -0
  95. data/sig/redis_queued_locks/logging.rbs +15 -0
  96. data/sig/redis_queued_locks/resource.rbs +42 -0
  97. data/sig/redis_queued_locks/swarm/acquirers.rbs +10 -0
  98. data/sig/redis_queued_locks/swarm/flush_zombies.rbs +13 -0
  99. data/sig/redis_queued_locks/swarm/probe_hosts.rbs +13 -0
  100. data/sig/redis_queued_locks/swarm/redis_client_builder.rbs +19 -0
  101. data/sig/redis_queued_locks/swarm/supervisor.rbs +26 -0
  102. data/sig/redis_queued_locks/swarm/swarm_element/isolated.rbs +52 -0
  103. data/sig/redis_queued_locks/swarm/swarm_element/threaded.rbs +61 -0
  104. data/sig/redis_queued_locks/swarm/swarm_element.rbs +8 -0
  105. data/sig/redis_queued_locks/swarm/zombie_info.rbs +24 -0
  106. data/sig/redis_queued_locks/swarm.rbs +41 -0
  107. data/sig/redis_queued_locks/utilities/lock.rbs +10 -0
  108. data/sig/redis_queued_locks/utilities.rbs +11 -0
  109. data/sig/redis_queued_locks/version.rbs +3 -0
  110. data/sig/redis_queued_locks.rbs +14 -0
  111. data/sig/vendor/active_support.rbs +9 -0
  112. data/sig/vendor/redis_client.rbs +39 -0
  113. data/sig/vendor/semantic_logger.rbs +4 -0
  114. metadata +96 -54
  115. data/lib/redis_queued_locks/acquier/acquire_lock/dequeue_from_lock_queue/log_visitor.rb +0 -40
  116. data/lib/redis_queued_locks/acquier/acquire_lock/instr_visitor.rb +0 -166
  117. data/lib/redis_queued_locks/acquier/acquire_lock/log_visitor.rb +0 -216
  118. data/lib/redis_queued_locks/acquier/acquire_lock/try_to_lock/log_visitor.rb +0 -541
  119. data/lib/redis_queued_locks/acquier/acquire_lock/yield_expire/log_visitor.rb +0 -76
  120. data/lib/redis_queued_locks/acquier.rb +0 -18
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 419bb42dc0f90c9cfac1107f3eb93ab4e5185d17efa53f78012eed09aee03931
4
- data.tar.gz: c9e1471bc65375cbabe88276c7144460b05bb3e0cb4880a75b061514578a4e3d
3
+ metadata.gz: 306e86a36b29ee294af7e0ee9eda0c3815e1b646733abf3f30e25c4f0d3f0394
4
+ data.tar.gz: 1f4b4d1b762f4c27aab1bfae415c2f183593ab5a2772b07e4789d44aa0b5ea1c
5
5
  SHA512:
6
- metadata.gz: aa5e610820ffb105003d09918ee5df8c51989de24a0473eb0d9056deb5e0c2de0cc8c23c220bd4b8da14a7ff0d2b2c7271cc521862263251c03382d4f246f302
7
- data.tar.gz: dc14d292c361c798c1cd5a375ff48f271d96a35246c2e463d331dfe9dcb116b64f3b17ad95e12a5e5f72f8aad2a243a17cc0ed10a2ab4521773385bc51d2c77d
6
+ metadata.gz: f48e55fece224be62a769d2eaba83fe206b3275fed1849dc000dfd75d51794a1f023af43c4a0647809fc6ee6fb8d80258e2686d9b1f59fa3ff3a0b20651db89b
7
+ data.tar.gz: 338a6748a479158d2429c57b6afab1d10682b94e1751560c595c4d9dadd0a607b1d3ea45aeb5612b003a0a88d208780e7dcdb474f05418ac817a46bb9bd16de1
data/.rubocop.yml CHANGED
@@ -3,14 +3,17 @@ inherit_gem:
3
3
  - lib/rubocop.general.yml
4
4
  - lib/rubocop.rake.yml
5
5
  - lib/rubocop.rspec.yml
6
+ - lib/rubocop.rbs.yml
6
7
 
7
8
  AllCops:
8
- TargetRubyVersion: 3.1
9
+ TargetRubyVersion: 3.3
9
10
  NewCops: enable
10
11
  Include:
11
12
  - lib/**/*.rb
12
13
  - spec/**/*.rb
14
+ - sig/**/*.rbs
13
15
  - Gemfile
16
+ - gemfiles/ruby3.3.gemfile
14
17
  - Rakefile
15
18
  - redis_queued_locks.gemspec
16
19
  - bin/console
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 3.3.4
1
+ 3.4.3
data/CHANGELOG.md CHANGED
@@ -1,4 +1,31 @@
1
1
  ## [Unreleased]
2
+ ### Changed
3
+ - Updated development dependencies (`armitage-rubocop`, `rbs`, `steep`);
4
+ - Bumped development Ruby version (from `3.3.6` to `3.4.3`);
5
+ - CI is splitted to "mainstream ruby version" and "previous actually maintaned ruby versions";
6
+ - `Acquier` -> `Acquirer`, `Acquierment` -> `Acquirement` (typos):
7
+ - [**Breaking**] Constant renaming: all constants and constant parts were renamed from `Acquier` to `Acquirer`;
8
+ - [**Breaking**] Method and variable names renaming: all `acquier` text parts of method/variable names were renamed to `acquirer`;
9
+ - [**Breaking**] Logs: all `acquier` text parts of each log message type were renamed to `acquirer`;
10
+ - [**Breaking**] Instrumentation: all `acquier` text parts of each event name were renamed to `acquirer`;
11
+ - [**Breaking**] Exceptions: all `Acquierment` exception constant name parts were renamed to `Acquirement`;
12
+ - [**Breaking**] `RedisQueuedLocks::Data` is not used (**temporary**) as result type of some APIs.
13
+ The reason is that this type can not be used as a record type in `steep`/`rbs` (working on it);
14
+ - [**Breaking**] Minimal Ruby Version - **3.3** (previously - **3.1**):
15
+ - removed `3.1` and `3.2` from `CI`;
16
+ - [**Breaking**] Config layer was fully reworked in order to improve performance:
17
+ - Config API has changed from "method invocation" to "hash key/value access/assignment" with a validation layer and config-data-access wrapping;
18
+ ### Added
19
+ - **Type Checking**:
20
+ - library codebase is fully typed;
21
+ - integrated `RBS` with `Steep` that is configured on **strict mode** (see `sig` directory, `Steepfile` config, `sig/manifest.yml` and `rbs_collection.yml` for dependencies);
22
+ - CI integration;
23
+ - Integrated RBS linting to `Rubocop`;
24
+ - Test coverage (via `simplecov` with `html` and `lcov` formats). `minimum_coverage` config is temporary disabled (and the CI step is not configured yet) cuz we need to refactor tests in first;
25
+ - CI:
26
+ - `rspec-retry` is temporary added until the tests are fully refactored;
27
+ - typecheck steps: `TypeCheck (Static)` (based on `steep` checks) and `TypeCheckl (Runtime)` (based on `RBS` runtime type checking/testing);
28
+ - Support for `ActiveSupport::BroadcastLogger` logger instances;
2
29
 
3
30
  ## [1.12.1]
4
31
  ### Changed
@@ -16,7 +43,7 @@
16
43
 
17
44
  ## [1.11.0] - 2024-08-11
18
45
  ### Changed
19
- - Lock Acquierment Timeout (`acq_timeout`/`queue_ttl`): more correct timeout error interception
46
+ - Lock Acquirement Timeout (`acq_timeout`/`queue_ttl`): more correct timeout error interception
20
47
  inside the `RedisQueuedLocks::Acquier::AcquireLock::WithAcqTimeout` logic that now raises and
21
48
  intercepts an internal timeout error class in order to prevent interceptions of
22
49
  other timeouts that can be raised from the wrapped block of code;
@@ -46,7 +73,7 @@
46
73
  - each ruby worker of the swarm probes himself that he is alive;
47
74
  - worker that does not probes himselfs treats as a zombie;
48
75
  - worekr becomes dead when your ruby process is dead, or thread is dead or your ractor is dead;
49
- - each zombie's lock, acquier and position in queue are flushed in background via `flush_zombies` swarm element;
76
+ - each zombie's lock, acquirer and position in queue are flushed in background via `flush_zombies` swarm element;
50
77
  - the supervisor module keeps up and running each swarm melement (`probe_hosts` and `flush_zombies`):
51
78
  - cuz each element works in background and can fail by any unexpected exception the supervisor guarantees that your elements will ressurect after that;
52
79
  - each element can be deeply configured (and enabled/disabled);
@@ -57,7 +84,7 @@
57
84
  - supervisor that keeps all elements running and wokring;
58
85
  - an ability to check the swarm status (`#swarm_status`): who is working, who is dead, running status, internal main loop states, etc;
59
86
  - an abiltiy to check the swarm information (`#swarm_info`): showing the current swarm hosts and their last probes and current zombie status;
60
- - an ability to find zombie locks, zombie acquiers and zombie hosts (`#zombie_locks`, `#zombie_acquiers`, `#zombie_hosts`);
87
+ - an ability to find zombie locks, zombie acquirers and zombie hosts (`#zombie_locks`, `#zombie_acquiers`, `#zombie_hosts`);
61
88
  - an ability to extract the full zombie information (`#zombies_info`/`#zombies`);
62
89
  - each zombie lock will be flushed in background by appropriated swarm element (`flush_zombies`);
63
90
  - deeply configurable zombie factors: zombie ttl, host probing period, supervisor check period;
@@ -256,7 +283,7 @@
256
283
 
257
284
  ## [0.0.27] - 2024-03-21
258
285
  ### Changed
259
- - Better acquier position accuracy: acquier position in lock queue
286
+ - Better acquirer position accuracy: acquirer position in lock queue
260
287
  should be represented as EPOCH in seconds+microseconds (previously: simply in seconds);
261
288
 
262
289
  ## [0.0.26] - 2024-03-21
@@ -335,7 +362,7 @@
335
362
 
336
363
  ## [0.0.9] - 2024-02-27
337
364
  ### Changed
338
- - The lock acquier identifier (`acq_id`) now includes the fiber id, the ractor id and an unique per-process
365
+ - The lock acquirer identifier (`acq_id`) now includes the fiber id, the ractor id and an unique per-process
339
366
  10 byte string. It is added in order to prevent collisions between different processes/pods
340
367
  that will have the same process id / thread id identifiers (cuz it is an object_id integers) that can lead
341
368
  to the same position with the same `acq_id` for different processes/pods in the lock request queue.
data/LICENSE.txt CHANGED
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2024 Rustam Ibragimov
3
+ Copyright (c) 2024-2025 Rustam Ibragimov
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal