Class: ActiveJob::Locking::Adapters::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/activejob/locking/adapters/base.rb

Direct Known Subclasses

Memory, RedisSemaphore, Redlock, SuoRedis

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(key, options) ⇒ Base

Returns a new instance of Base.



8
9
10
11
12
# File 'lib/activejob/locking/adapters/base.rb', line 8

def initialize(key, options)
  @key = key
  @options = options
  @lock_manager = self.create_lock_manager
end

Instance Attribute Details

#keyObject (readonly)

Returns the value of attribute key.



5
6
7
# File 'lib/activejob/locking/adapters/base.rb', line 5

def key
  @key
end

#lock_managerObject (readonly)

Returns the value of attribute lock_manager.



5
6
7
# File 'lib/activejob/locking/adapters/base.rb', line 5

def lock_manager
  @lock_manager
end

#lock_tokenObject

Returns the value of attribute lock_token.



6
7
8
# File 'lib/activejob/locking/adapters/base.rb', line 6

def lock_token
  @lock_token
end

#optionsObject (readonly)

Returns the value of attribute options.



5
6
7
# File 'lib/activejob/locking/adapters/base.rb', line 5

def options
  @options
end

Instance Method Details

#create_lock_managerObject



14
15
16
# File 'lib/activejob/locking/adapters/base.rb', line 14

def create_lock_manager
  raise('Subclass must implement')
end

#lockObject



18
19
20
# File 'lib/activejob/locking/adapters/base.rb', line 18

def lock
  raise('Subclass must implement')
end

#refresh_lock!(refresh) ⇒ Object



26
27
28
# File 'lib/activejob/locking/adapters/base.rb', line 26

def refresh_lock!(refresh)
  raise('Subclass must implement')
end

#unlockObject



22
23
24
# File 'lib/activejob/locking/adapters/base.rb', line 22

def unlock
  raise('Subclass must implement')
end