redis_queued_locks 0.0.6 → 0.0.7

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: 9e98a72e1519c54d21a6273176a7d8a3bd9fa3033b7f30ca73fdca5a4335341d
4
- data.tar.gz: b2cf62db6016bd456a379feb3703989cc4a481f2eed4103c5c27a60bec624d46
3
+ metadata.gz: 56120a88eb6ffa4f377c014b8619cdcd227ac0efaab1c6ec6495042c74739a63
4
+ data.tar.gz: d1e7240b5ca0c8a18842cd609b1e9280813a0a51a62d2ed9bcacdb66d707801f
5
5
  SHA512:
6
- metadata.gz: d90c848b5fb00614c3f61719d470d7a2dae008d3b6349c395674fe7bf262feea09795dafc74756a16426f499652e9cb0dcb4eef8b0dc9e2c1cc8abff2a1345d1
7
- data.tar.gz: ccc6e73175a2c41988303e3ea73feeacf95833b8d318dc1318c91f800d656ea157aeca62d7eba491ca489253a01ba4489f6a4c254c32f54ef3a540c9312ca179
6
+ metadata.gz: f3df6ebf409fa4d97ebe51632832d6c9c64eb03a4102d68e6951def7a3d351c62e86e63014b8cc1d5c6ea4c5cd6bf9bdf5595ebdb2a3334550e7a27f2f6b0bcd
7
+ data.tar.gz: 6e512298fb8be556e5370574e87529b936670bec1b13250233c6ce08d9feb4c8032b1b07e90a514ff4d4687e01391424be5b546a124119c7937492baa7ef87ee
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## [0.0.7] - 2024-02-27
4
+ ### Changed
5
+ - Minor documentation updates;
6
+
3
7
  ## [0.0.6] - 2024-02-27
4
8
  ### Changed
5
9
  - Major documentation updates;
data/README.md CHANGED
@@ -1,6 +1,7 @@
1
1
  # RedisQueuedLocks
2
2
 
3
- Distributed lock implementation with "lock acquisition queue" capabilities based on the Redis Database.
3
+ Distributed locks with "lock acquisition queue" capabilities based on the Redis Database.
4
+
4
5
  Each lock request is put into a request queue and processed in order of their priority (FIFO).
5
6
 
6
7
  ---
@@ -18,7 +19,7 @@ Each lock request is put into a request queue and processed in order of their pr
18
19
  - [clear_locks](#clear_locks---release-all-locks-and-lock-queues)
19
20
  - [Instrumentation](#instrumentation)
20
21
  - [Instrumentation Events](#instrumentation-events)
21
- - [TODO](#todo)
22
+ - [Todo](#todo)
22
23
  - [Contributing](#contributing)
23
24
  - [License](#license)
24
25
  - [Authors](#authors)
@@ -65,6 +66,7 @@ rq_lock_client = RedisQueuedLocks::Client.new(redis_client) do |config|
65
66
  end
66
67
 
67
68
  # Step 3: start to work with locks :)
69
+ rq_lock_client.lock("some-lock") { puts "Hello, lock!" }
68
70
  ```
69
71
 
70
72
  ---
@@ -166,9 +168,11 @@ def lock(
166
168
  - `instrumenter` - `[#notify]`
167
169
  - See RedisQueuedLocks::Instrument::ActiveSupport for example.
168
170
  - `raise_errors` - `[Boolean]`
169
- - Raise errors on library-related limits such as timeout or failed lock obtain.
171
+ - Raise errors on library-related limits such as timeout or retry count limit.
170
172
  - `block` - `[Block]`
171
173
  - A block of code that should be executed after the successfully acquired lock.
174
+ - If block is **passed** the obtained lock will be released after the block execution or it's ttl (what will happen first);
175
+ - If block is **not passed** the obtained lock will be released after it's ttl;
172
176
 
173
177
  Return value:
174
178
  - `[Hash<Symbol,Any>]` Format: `{ ok: true/false, result: Symbol/Hash }`;
@@ -191,7 +195,6 @@ Return value:
191
195
  { ok: false, result: :unknown }
192
196
  ```
193
197
 
194
-
195
198
  ---
196
199
 
197
200
  #### #lock! - exceptional lock obtaining
@@ -276,9 +279,9 @@ Return:
276
279
 
277
280
  ## Instrumentation
278
281
 
279
- An instrumentation layer is incapsulated in `instrumenter` object stored in configurations.
282
+ An instrumentation layer is incapsulated in `instrumenter` object stored in [config](#configuration) (`RedisQueuedLocks::Client#config[:instrumenter]`).
280
283
 
281
- Instrumenter object should provide `notify(event, payload)` method with following signarue:
284
+ Instrumenter object should provide `notify(event, payload)` method with the following signarue:
282
285
 
283
286
  - `event` - `string`;
284
287
  - `payload` - `hash<Symbol,Any>`;
@@ -286,7 +289,7 @@ Instrumenter object should provide `notify(event, payload)` method with followin
286
289
  `redis_queued_locks` provides two instrumenters:
287
290
 
288
291
  - `RedisQueuedLocks::Instrument::ActiveSupport` - `ActiveSupport::Notifications` instrumenter
289
- that instrument events via `ActiveSupport::Notifications` api;
292
+ that instrument events via `ActiveSupport::Notifications` API;
290
293
  - `RedisQueuedLocks::Instrument::VoidNotifier` - instrumenter that does nothing;
291
294
 
292
295
  By default `RedisQueuedLocks::Client` is configured with the void notifier (which means "instrumentation is disabled").
@@ -338,11 +341,11 @@ Detalized event semantics and payload structure:
338
341
 
339
342
  ---
340
343
 
341
- ## TODO
344
+ ## Todo
342
345
 
343
346
  - `RedisQueuedLocks::Acquier::Try.try_to_lock` - detailed successful result analization;
344
347
  - `100%` test coverage;
345
- - better code stylization and interesting refactorings :)
348
+ - better code stylization and interesting refactorings;
346
349
 
347
350
  ---
348
351
 
@@ -38,7 +38,7 @@ module RedisQueuedLocks::Acquier::Release
38
38
  count: batch_size
39
39
  ) do |lock_queue|
40
40
  pipeline.call('ZREMRANGEBYSCORE', lock_queue, '-inf', '+inf')
41
- pipeline.call('EXPIRE', RedisQueuedLocks::Resource.lock_key_from_queue(lock_queue), "0")
41
+ pipeline.call('EXPIRE', RedisQueuedLocks::Resource.lock_key_from_queue(lock_queue), '0')
42
42
  end
43
43
 
44
44
  # Step B: release all locks
@@ -5,6 +5,6 @@ module RedisQueuedLocks
5
5
  #
6
6
  # @api public
7
7
  # @since 0.0.1
8
- # @version 0.0.6
9
- VERSION = '0.0.6'
8
+ # @version 0.0.7
9
+ VERSION = '0.0.7'
10
10
  end
@@ -11,7 +11,7 @@ Gem::Specification.new do |spec|
11
11
  spec.email = ['iamdaiver@gmail.com']
12
12
 
13
13
  spec.summary = 'Queued distributed locks based on Redis.'
14
- spec.description = 'Distributed lock implementation with "lock acquisition queue" ' \
14
+ spec.description = 'Distributed locks with "lock acquisition queue" ' \
15
15
  'capabilities based on the Redis Database.'
16
16
  spec.homepage = 'https://github.com/0exp/redis_queued_locks'
17
17
  spec.license = 'MIT'
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.6
4
+ version: 0.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rustam Ibragimov
@@ -38,8 +38,8 @@ dependencies:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0.28'
41
- description: Distributed lock implementation with "lock acquisition queue" capabilities
42
- based on the Redis Database.
41
+ description: Distributed locks with "lock acquisition queue" capabilities based on
42
+ the Redis Database.
43
43
  email:
44
44
  - iamdaiver@gmail.com
45
45
  executables: []