redis_queued_locks 0.0.9 → 0.0.10

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 463b0613174c7a3806aef19ce962bbe5ed91d342796bec84ea47b2aa79cf61fb
4
- data.tar.gz: 4d483db40896d77049e3e6d324a206606225c9c8e8b592072b1f501563fb7ec8
3
+ metadata.gz: 28714dd149659f7c58634868219b3e020df6304253db120fda241304a82ce781
4
+ data.tar.gz: 52e9193aa4945598f7da31d202cfc445f2b5b63009f5f09e260a732b02e3ac64
5
5
  SHA512:
6
- metadata.gz: f829f8afc264f8a44d0edd1469c5ada76c7257f15ef6945c3f154fe2908b29d5ace4ce0c11365a30af1cdbb6d3b4aeec30227b84500da65b720f22247ed96053
7
- data.tar.gz: 1eee0e4c2a665b57ee6d2c2c2d6488c065bbcdd586cfe06f2890a6b412a3a009675dd26e39383f2fad54434288d4c3c7660fba2faaa3013da98ab27c484b08b0
6
+ metadata.gz: b0f02df991559f21667288ebf690695909d65766cb2c9dd809d18d62a34e722d35d898e227ef38cf12d5acf96d271b7c0a078b1aa8ce47b93645fdd27b36d043
7
+ data.tar.gz: 5f60948e47cebdc9ff2de6a594aa68155c39ee262fd0662afbe293b672ce811c74a5182f8793be7d3860a8361560213108f25fd00d8a1891cd72a353d3103b25
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## [0.0.10] - 2024-02-27
4
+ ### Changed
5
+ - Minor documentation updates;
6
+
3
7
  ## [0.0.9] - 2024-02-27
4
8
  ### Changed
5
9
  - The lock acquier identifier (`acq_id`) now includes the fiber id, the ractor id and an unique per-process
data/README.md CHANGED
@@ -60,7 +60,7 @@ require 'redis_queued_locks'
60
60
  require 'redis_queued_locks'
61
61
 
62
62
  # Step 1: initialize RedisClient instance
63
- redis_clinet = RedisClient.config.new_pool # NOTE: provide your own RedisClient instance
63
+ redis_client = RedisClient.config.new_pool # NOTE: provide your own RedisClient instance
64
64
 
65
65
  # Step 2: initialize RedisQueuedLock::Client instance
66
66
  rq_lock_client = RedisQueuedLocks::Client.new(redis_client) do |config|
@@ -125,6 +125,7 @@ clinet = RedisQueuedLocks::Client.new(redis_client) do |config|
125
125
  # - prevents potential lock-acquirement collisions bettween different process/pods
126
126
  # that have identical process_id/thread_id/fiber_id/ractor_id (identivcal acquier ids);
127
127
  # - it is calculated once per `RedisQueudLocks::Client` instance;
128
+ # - expects the proc object;
128
129
  config.uniq_identifier = -> { RedisQueuedLocks::Resource.calc_uniq_identity }
129
130
  end
130
131
  ```
@@ -198,7 +199,7 @@ Return value:
198
199
  ok: true,
199
200
  result: {
200
201
  lock_key: String, # acquierd lock key ("rql:lock:your_lock_name")
201
- acq_id: String, # acquier identifier ("your_process_id/your_thread_id")
202
+ acq_id: String, # acquier identifier ("process_id/thread_id/fiber_id/ractor_id/identity")
202
203
  ts: Integer, # time (epoch) when lock was obtained (integer)
203
204
  ttl: Integer # lock's time to live in milliseconds (integer)
204
205
  }
@@ -243,7 +244,7 @@ See `#lock` method [documentation](#lock---obtain-a-lock).
243
244
  - returns `nil` if lock does not exist;
244
245
  - lock data (`Hash<Symbol,String|Integer>`):
245
246
  - `lock_key` - `string` - lock key in redis;
246
- - `acq_id` - `string` - acquier identifier (process_id/thread_id/fiber_id/ractor_id/identity by default);
247
+ - `acq_id` - `string` - acquier identifier (process_id/thread_id/fiber_id/ractor_id/identity);
247
248
  - `ts` - `integer`/`epoch` - the time lock was obtained;
248
249
  - `init_ttl` - `integer` - (milliseconds) initial lock key ttl;
249
250
  - `rem_ttl` - `integer` - (milliseconds) remaining lock key ttl;
@@ -254,7 +255,7 @@ rql.lock_info("your_lock_name")
254
255
  # =>
255
256
  {
256
257
  lock_key: "rql:lock:your_lock_name",
257
- acq_id: "rql:acq:123/456",
258
+ acq_id: "rql:acq:123/456/567/678/374dd74324",
258
259
  ts: 123456789,
259
260
  ini_ttl: 123456789,
260
261
  rem_ttl: 123456789
@@ -429,7 +430,7 @@ Detalized event semantics and payload structure:
429
430
  - payload:
430
431
  - `rel_time` - `float`/`milliseconds` - time spent on "realese all locks" operation;
431
432
  - `at` - `integer`/`epoch` - the time when the operation has ended;
432
- - `rel_keys` - `integer` - released redis keys count (`released queu keys` + `released lock keys`);
433
+ - `rel_keys` - `integer` - released redis keys count (`released queue keys` + `released lock keys`);
433
434
 
434
435
  ---
435
436
 
@@ -438,6 +439,7 @@ Detalized event semantics and payload structure:
438
439
  - **Major**
439
440
  - Semantic Error objects for unexpected Redis errors;
440
441
  - `100%` test coverage;
442
+ - sidecar `Ractor` object and `in progress queue` in RedisDB that will extend an acquired lock for long-running blocks of code (that invoked "under" the lock);
441
443
  - **Minor**
442
444
  - `RedisQueuedLocks::Acquier::Try.try_to_lock` - detailed successful result analization;
443
445
  - better code stylization and interesting refactorings;
@@ -403,6 +403,17 @@ module RedisQueuedLocks::Acquier
403
403
  end
404
404
  end
405
405
 
406
+ # @param redis_client [RedisClient]
407
+ # @param lock_name [String]
408
+ # @param milliseconds [Integer]
409
+ # @return [?]
410
+ #
411
+ # @api private
412
+ # @since 0.1.0
413
+ def extend_lock_ttl(redis_client, lock_name, milliseconds)
414
+
415
+ end
416
+
406
417
  private
407
418
 
408
419
  # @param timeout [NilClass,Integer]
@@ -196,6 +196,16 @@ class RedisQueuedLocks::Client
196
196
  RedisQueuedLocks::Acquier.queue_info(redis_client, lock_name)
197
197
  end
198
198
 
199
+ # @param lock_name [String]
200
+ # @param milliseconds [Integer] How many milliseconds should be added.
201
+ # @return [?]
202
+ #
203
+ # @api public
204
+ # @since 0.1.0
205
+ def extend_lock_ttl(lock_name, milliseconds)
206
+ RedisQueuedLocks::Acquier.extend_lock_ttl(redis_client, lock_name)
207
+ end
208
+
199
209
  # @option batch_size [Integer]
200
210
  # @return [Hash<Symbol,Any>] Format: { ok: true/false, result: Symbol/Hash }.
201
211
  #
@@ -5,6 +5,6 @@ module RedisQueuedLocks
5
5
  #
6
6
  # @api public
7
7
  # @since 0.0.1
8
- # @version 0.0.9
9
- VERSION = '0.0.9'
8
+ # @version 0.0.10
9
+ VERSION = '0.0.10'
10
10
  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: 0.0.9
4
+ version: 0.0.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rustam Ibragimov