class Proxy::RemoteExecution::Ssh::JobStorage
Public Class Methods
new()
click to toggle source
# File lib/smart_proxy_remote_execution_ssh/job_storage.rb, line 6 def initialize @db = Sequel.sqlite @db.create_table :jobs do DateTime :timestamp, null: false, default: Sequel::CURRENT_TIMESTAMP String :uuid, fixed: true, size: 36, primary_key: true, null: false String :hostname, null: false, index: true String :execution_plan_uuid, fixed: true, size: 36, null: false, index: true Integer :run_step_id, null: false String :effective_user String :job, text: true end end
Public Instance Methods
drop_job(execution_plan_uuid, run_step_id)
click to toggle source
# File lib/smart_proxy_remote_execution_ssh/job_storage.rb, line 39 def drop_job(execution_plan_uuid, run_step_id) jobs.where(execution_plan_uuid: execution_plan_uuid, run_step_id: run_step_id).delete end
find_job(uuid, hostname)
click to toggle source
# File lib/smart_proxy_remote_execution_ssh/job_storage.rb, line 19 def find_job(uuid, hostname) jobs.where(uuid: uuid, hostname: hostname).first end
job_uuids_for_host(hostname)
click to toggle source
# File lib/smart_proxy_remote_execution_ssh/job_storage.rb, line 23 def job_uuids_for_host(hostname) jobs_for_host(hostname).order(:timestamp) .select_map(:uuid) end
store_job(hostname, execution_plan_uuid, run_step_id, job, uuid: SecureRandom.uuid, timestamp: Time.now.utc, effective_user: nil)
click to toggle source
# File lib/smart_proxy_remote_execution_ssh/job_storage.rb, line 28 def store_job(hostname, execution_plan_uuid, run_step_id, job, uuid: SecureRandom.uuid, timestamp: Time.now.utc, effective_user: nil) jobs.insert(timestamp: timestamp, uuid: uuid, hostname: hostname, execution_plan_uuid: execution_plan_uuid, run_step_id: run_step_id, job: job, effective_user: effective_user) uuid end
Private Instance Methods
jobs()
click to toggle source
# File lib/smart_proxy_remote_execution_ssh/job_storage.rb, line 49 def jobs @db[:jobs] end
jobs_for_host(hostname)
click to toggle source
# File lib/smart_proxy_remote_execution_ssh/job_storage.rb, line 45 def jobs_for_host(hostname) jobs.where(hostname: hostname) end