Skip to content

Commit

Permalink
[lib/sig] Acquier -> Acquirer
Browse files Browse the repository at this point in the history
  • Loading branch information
0exp committed Nov 27, 2024
1 parent 5e123a7 commit 4be6f72
Show file tree
Hide file tree
Showing 53 changed files with 88 additions and 88 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

## Changed
- Updated development dependencies (`armitage-rubocop`);
- Constant renaming: all constants and constant parts were renamed from `Acquier` to `Acquirer`;
## Added
- Type signatures (`RBS`, see the `sig` directory) + `Steep` integration (see `Steepfile` for details);

Expand All @@ -21,7 +22,7 @@

## [1.11.0] - 2024-08-11
### Changed
- Lock Acquierment Timeout (`acq_timeout`/`queue_ttl`): more correct timeout error interception
- Lock Acquirement Timeout (`acq_timeout`/`queue_ttl`): more correct timeout error interception
inside the `RedisQueuedLocks::Acquier::AcquireLock::WithAcqTimeout` logic that now raises and
intercepts an internal timeout error class in order to prevent interceptions of
other timeouts that can be raised from the wrapped block of code;
Expand Down
2 changes: 1 addition & 1 deletion lib/redis_queued_locks.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ module RedisQueuedLocks
require_relative 'redis_queued_locks/data'
require_relative 'redis_queued_locks/debugger'
require_relative 'redis_queued_locks/resource'
require_relative 'redis_queued_locks/acquier'
require_relative 'redis_queued_locks/acquirer'
require_relative 'redis_queued_locks/instrument'
require_relative 'redis_queued_locks/swarm'
require_relative 'redis_queued_locks/client'
Expand Down
18 changes: 0 additions & 18 deletions lib/redis_queued_locks/acquier.rb

This file was deleted.

18 changes: 18 additions & 0 deletions lib/redis_queued_locks/acquirer.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# frozen_string_literal: true

# @api private
# @since 1.0.0
module RedisQueuedLocks::Acquirer
require_relative 'acquirer/acquire_lock'
require_relative 'acquirer/release_lock'
require_relative 'acquirer/release_all_locks'
require_relative 'acquirer/is_locked'
require_relative 'acquirer/is_queued'
require_relative 'acquirer/lock_info'
require_relative 'acquirer/queue_info'
require_relative 'acquirer/locks'
require_relative 'acquirer/queues'
require_relative 'acquirer/keys'
require_relative 'acquirer/extend_lock_ttl'
require_relative 'acquirer/clear_dead_requests'
end
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
# rubocop:disable Metrics/ClassLength
# rubocop:disable Metrics/BlockNesting
# rubocop:disable Style/IfInsideElse
module RedisQueuedLocks::Acquier::AcquireLock
module RedisQueuedLocks::Acquirer::AcquireLock
require_relative 'acquire_lock/log_visitor'
require_relative 'acquire_lock/instr_visitor'
require_relative 'acquire_lock/delay_execution'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# @api private
# @since 1.0.0
module RedisQueuedLocks::Acquier::AcquireLock::DelayExecution
module RedisQueuedLocks::Acquirer::AcquireLock::DelayExecution
# Sleep with random time-shifting (it is necessary for empty lock-acquirement time slots).
#
# @param retry_delay [Integer] In milliseconds
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# @api private
# @since 1.7.0
module RedisQueuedLocks::Acquier::AcquireLock::DequeueFromLockQueue
module RedisQueuedLocks::Acquirer::AcquireLock::DequeueFromLockQueue
require_relative 'dequeue_from_lock_queue/log_visitor'

# @param redis [RedisClient]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# @api private
# @since 1.7.0
module RedisQueuedLocks::Acquier::AcquireLock::DequeueFromLockQueue::LogVisitor
module RedisQueuedLocks::Acquirer::AcquireLock::DequeueFromLockQueue::LogVisitor
class << self
# @param logger [::Logger,#debug]
# @param log_sampled [Boolean]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# @api private
# @since 1.7.0
module RedisQueuedLocks::Acquier::AcquireLock::InstrVisitor
module RedisQueuedLocks::Acquirer::AcquireLock::InstrVisitor
class << self
# @param instrumenter [#notify]
# @param instr_sampled [Boolean]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# @api private
# @since 1.7.0
# rubocop:disable Metrics/ModuleLength
module RedisQueuedLocks::Acquier::AcquireLock::LogVisitor
module RedisQueuedLocks::Acquirer::AcquireLock::LogVisitor
# rubocop:disable Metrics/ClassLength
class << self
# @param logger [::Logger,#debug]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# @since 1.0.0
# @version 1.7.0
# rubocop:disable Metrics/ModuleLength
module RedisQueuedLocks::Acquier::AcquireLock::TryToLock
module RedisQueuedLocks::Acquirer::AcquireLock::TryToLock
require_relative 'try_to_lock/log_visitor'

# @return [String]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# @api private
# @since 1.7.0
# rubocop:disable Metrics/ModuleLength
module RedisQueuedLocks::Acquier::AcquireLock::TryToLock::LogVisitor
module RedisQueuedLocks::Acquirer::AcquireLock::TryToLock::LogVisitor
# rubocop:disable Metrics/ClassLength
class << self
# @param logger [::Logger,#debug]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# @api private
# @since 1.0.0
module RedisQueuedLocks::Acquier::AcquireLock::WithAcqTimeout
module RedisQueuedLocks::Acquirer::AcquireLock::WithAcqTimeout
# @param redis [RedisClient]
# Redis connection manager required for additional data extraction for error message.
# @param timeout [NilClass,Integer]
Expand Down Expand Up @@ -47,8 +47,8 @@ def with_acq_timeout(
# TODO: rewrite these invocations to separated inner-AcquireLock-related modules
# in order to remove any dependencies from the other public RQL commands cuz
# all AcquireLock logic elements should be fully independent from others as a core;
lock_info = RedisQueuedLocks::Acquier::LockInfo.lock_info(redis, lock_name)
queue_info = RedisQueuedLocks::Acquier::QueueInfo.queue_info(redis, lock_name)
lock_info = RedisQueuedLocks::Acquirer::LockInfo.lock_info(redis, lock_name)
queue_info = RedisQueuedLocks::Acquirer::QueueInfo.queue_info(redis, lock_name)

# rubocop:disable Metrics/BlockNesting
raise(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# @api private
# @since 1.3.0
# @version 1.7.0
module RedisQueuedLocks::Acquier::AcquireLock::YieldExpire
module RedisQueuedLocks::Acquirer::AcquireLock::YieldExpire
require_relative 'yield_expire/log_visitor'

# @return [String]
Expand All @@ -18,7 +18,7 @@ module RedisQueuedLocks::Acquier::AcquireLock::YieldExpire
# @param redis [RedisClient] Redis connection.
# @param logger [::Logger,#debug] Logger object.
# @param lock_key [String] Obtained lock key that should be expired.
# @param acquier_id [String] Acquier identifier.
# @param acquier_id [String] Acquirer identifier.
# @param host_id [String] Host identifier.
# @param access_strategy [Symbol] Lock obtaining strategy.
# @param timed [Boolean] Should the lock be wrapped by Timeout with with lock's ttl
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# @api private
# @since 1.7.0
module RedisQueuedLocks::Acquier::AcquireLock::YieldExpire::LogVisitor
module RedisQueuedLocks::Acquirer::AcquireLock::YieldExpire::LogVisitor
class << self
# @param logger [::Logger,#debug]
# @param log_sampled [Boolean]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# @api private
# @since 1.0.0
module RedisQueuedLocks::Acquier::ClearDeadRequests
module RedisQueuedLocks::Acquirer::ClearDeadRequests
class << self
# @param redis_client [RedisClient]
# @param scan_size [Integer]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# @api private
# @since 1.0.0
module RedisQueuedLocks::Acquier::ExtendLockTTL
module RedisQueuedLocks::Acquirer::ExtendLockTTL
# @return [String]
#
# @api private
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# @api private
# @since 1.0.0
module RedisQueuedLocks::Acquier::IsLocked
module RedisQueuedLocks::Acquirer::IsLocked
class << self
# @param redis_client [RedisClient]
# @param lock_name [String]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# @api private
# @since 1.0.0
module RedisQueuedLocks::Acquier::IsQueued
module RedisQueuedLocks::Acquirer::IsQueued
class << self
# @param redis_client [RedisClient]
# @param lock_name [String]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# @api private
# @since 1.0.0
module RedisQueuedLocks::Acquier::Keys
module RedisQueuedLocks::Acquirer::Keys
class << self
# @param redis_client [RedisClient]
# @option scan_size [Integer]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# @api private
# @since 1.0.0
module RedisQueuedLocks::Acquier::LockInfo
module RedisQueuedLocks::Acquirer::LockInfo
class << self
# @param redis_client [RedisClient]
# @param lock_name [String]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# @api private
# @since 1.0.0
module RedisQueuedLocks::Acquier::Locks
module RedisQueuedLocks::Acquirer::Locks
class << self
# @param redis_client [RedisClient]
# @option scan_size [Integer]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# @api private
# @since 1.0.0
module RedisQueuedLocks::Acquier::QueueInfo
module RedisQueuedLocks::Acquirer::QueueInfo
class << self
# Returns an information about the required lock queue by the lock name. The result
# represnts the ordered lock request queue that is ordered by score (Redis sets) and shows
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# @api private
# @since 1.0.0
module RedisQueuedLocks::Acquier::Queues
module RedisQueuedLocks::Acquirer::Queues
class << self
# @param redis_client [RedisClient]
# @option scan_size [Integer]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# @api private
# @since 1.0.0
module RedisQueuedLocks::Acquier::ReleaseAllLocks
module RedisQueuedLocks::Acquirer::ReleaseAllLocks
# @since 1.0.0
extend RedisQueuedLocks::Utilities

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# @api private
# @since 1.0.0
module RedisQueuedLocks::Acquier::ReleaseLock
module RedisQueuedLocks::Acquirer::ReleaseLock
# @since 1.0.0
extend RedisQueuedLocks::Utilities

Expand Down
24 changes: 12 additions & 12 deletions lib/redis_queued_locks/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -438,7 +438,7 @@ def lock(
instr_sample_this: false,
&block
)
RedisQueuedLocks::Acquier::AcquireLock.acquire_lock(
RedisQueuedLocks::Acquirer::AcquireLock.acquire_lock(
redis_client,
lock_name,
process_id: RedisQueuedLocks::Resource.get_process_id,
Expand Down Expand Up @@ -585,7 +585,7 @@ def unlock(
instr_sampler: config[:instr_sampler], # steep:ignore
instr_sample_this: false
)
RedisQueuedLocks::Acquier::ReleaseLock.release_lock(
RedisQueuedLocks::Acquirer::ReleaseLock.release_lock(
redis_client,
lock_name,
instrumenter,
Expand All @@ -608,7 +608,7 @@ def unlock(
# @api public
# @since 1.0.0
def locked?(lock_name)
RedisQueuedLocks::Acquier::IsLocked.locked?(redis_client, lock_name)
RedisQueuedLocks::Acquirer::IsLocked.locked?(redis_client, lock_name)
end

# @param lock_name [String]
Expand All @@ -617,7 +617,7 @@ def locked?(lock_name)
# @api public
# @since 1.0.0
def queued?(lock_name)
RedisQueuedLocks::Acquier::IsQueued.queued?(redis_client, lock_name)
RedisQueuedLocks::Acquirer::IsQueued.queued?(redis_client, lock_name)
end

# @param lock_name [String]
Expand All @@ -626,7 +626,7 @@ def queued?(lock_name)
# @api public
# @since 1.0.0
def lock_info(lock_name)
RedisQueuedLocks::Acquier::LockInfo.lock_info(redis_client, lock_name)
RedisQueuedLocks::Acquirer::LockInfo.lock_info(redis_client, lock_name)
end

# @param lock_name [String]
Expand All @@ -635,7 +635,7 @@ def lock_info(lock_name)
# @api public
# @since 1.0.0
def queue_info(lock_name)
RedisQueuedLocks::Acquier::QueueInfo.queue_info(redis_client, lock_name)
RedisQueuedLocks::Acquirer::QueueInfo.queue_info(redis_client, lock_name)
end

# Retrun the current acquirer identifier.
Expand Down Expand Up @@ -760,7 +760,7 @@ def extend_lock_ttl(
instr_sampler: config[:instr_sampler], # steep:ignore
instr_sample_this: false
)
RedisQueuedLocks::Acquier::ExtendLockTTL.extend_lock_ttl(
RedisQueuedLocks::Acquirer::ExtendLockTTL.extend_lock_ttl(
redis_client,
lock_name,
milliseconds,
Expand Down Expand Up @@ -815,7 +815,7 @@ def clear_locks(
instr_sampler: config[:instr_sampler], # steep:ignore
instr_sample_this: false
)
RedisQueuedLocks::Acquier::ReleaseAllLocks.release_all_locks(
RedisQueuedLocks::Acquirer::ReleaseAllLocks.release_all_locks(
redis_client,
batch_size,
logger,
Expand Down Expand Up @@ -853,7 +853,7 @@ def clear_locks(
# @api public
# @since 1.0.0
def locks(scan_size: config[:key_extraction_batch_size], with_info: false) # steep:ignore
RedisQueuedLocks::Acquier::Locks.locks(redis_client, scan_size:, with_info:)
RedisQueuedLocks::Acquirer::Locks.locks(redis_client, scan_size:, with_info:)
end

# Extracts lock keys with their info. See #locks(with_info: true) for details.
Expand Down Expand Up @@ -884,7 +884,7 @@ def locks_info(scan_size: config[:key_extraction_batch_size]) # steep:ignore
# @api public
# @since 1.0.0
def queues(scan_size: config[:key_extraction_batch_size], with_info: false) # steep:ignore
RedisQueuedLocks::Acquier::Queues.queues(redis_client, scan_size:, with_info:)
RedisQueuedLocks::Acquirer::Queues.queues(redis_client, scan_size:, with_info:)
end

# Extracts lock queues with their info. See #queues(with_info: true) for details.
Expand All @@ -904,7 +904,7 @@ def queues_info(scan_size: config[:key_extraction_batch_size]) # steep:ignore
# @api public
# @since 1.0.0
def keys(scan_size: config[:key_extraction_batch_size]) # steep:ignore
RedisQueuedLocks::Acquier::Keys.keys(redis_client, scan_size:)
RedisQueuedLocks::Acquirer::Keys.keys(redis_client, scan_size:)
end

# @option dead_ttl [Integer]
Expand Down Expand Up @@ -946,7 +946,7 @@ def clear_dead_requests(
instr_sampler: config[:instr_sampler], # steep:ignore
instr_sample_this: false
)
RedisQueuedLocks::Acquier::ClearDeadRequests.clear_dead_requests(
RedisQueuedLocks::Acquirer::ClearDeadRequests.clear_dead_requests(
redis_client,
scan_size,
dead_ttl,
Expand Down
1 change: 0 additions & 1 deletion lib/redis_queued_locks/utilities.rb
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ def run_non_critical(&block)
# - "blocking"
# - "running"
# - "terminated"
# - "unknown"
#
# @param ractor [Ractor]
# @return [String]
Expand Down
Loading

0 comments on commit 4be6f72

Please sign in to comment.