Class: Rukawa::Remote::StatusStore

Inherits:
Object
  • Object
show all
Defined in:
lib/rukawa/remote/status_store.rb

Constant Summary collapse

ENQUEUED =
"enqueued".freeze
PERFORMING =
"performing".freeze
COMPLETED =
"completed".freeze
FAILED =
"failed".freeze

Instance Method Summary collapse

Constructor Details

#initialize(job_id:, expire_duration: Rukawa.config.status_expire_duration) ⇒ StatusStore

default expire duration is 24 hours.



10
11
12
13
# File 'lib/rukawa/remote/status_store.rb', line 10

def initialize(job_id:, expire_duration: Rukawa.config.status_expire_duration)
  @job_id = job_id
  @expire_duration = expire_duration
end

Instance Method Details

#completedObject



27
28
29
# File 'lib/rukawa/remote/status_store.rb', line 27

def completed
  Rukawa.config.status_store.write(store_key, COMPLETED, expires_in: @expire_duration)
end

#deleteObject



35
36
37
# File 'lib/rukawa/remote/status_store.rb', line 35

def delete
  Rukawa.config.status_store.delete(store_key)
end

#enqueuedObject



19
20
21
# File 'lib/rukawa/remote/status_store.rb', line 19

def enqueued
  Rukawa.config.status_store.write(store_key, ENQUEUED, expires_in: @expire_duration)
end

#failedObject



31
32
33
# File 'lib/rukawa/remote/status_store.rb', line 31

def failed
  Rukawa.config.status_store.write(store_key, FAILED, expires_in: @expire_duration)
end

#fetchObject



15
16
17
# File 'lib/rukawa/remote/status_store.rb', line 15

def fetch
  Rukawa.config.status_store.fetch(store_key)
end

#performingObject



23
24
25
# File 'lib/rukawa/remote/status_store.rb', line 23

def performing
  Rukawa.config.status_store.write(store_key, PERFORMING, expires_in: @expire_duration)
end