class TungstenScriptDatasource
Public Class Methods
new(ti, service, is_direct = false)
click to toggle source
# File lib/tungsten/datasource.rb, line 2 def initialize(ti, service, is_direct = false) @ti = ti @service = service @is_direct = is_direct end
Public Instance Methods
_stop_server()
click to toggle source
# File lib/tungsten/datasource.rb, line 37 def _stop_server raise "Undefined function: #{self.class.name()}._stop_server" end
can_lock_tables?()
click to toggle source
# File lib/tungsten/datasource.rb, line 62 def can_lock_tables? false end
can_manage_service?()
click to toggle source
# File lib/tungsten/datasource.rb, line 12 def can_manage_service? false end
can_sql?()
click to toggle source
# File lib/tungsten/datasource.rb, line 78 def can_sql? @ti.can_sql?(@service, @is_direct) end
host()
click to toggle source
# File lib/tungsten/datasource.rb, line 103 def host begin TU.log_cmd_results?(false) if @is_direct == true return @ti.setting(@ti.setting_key(REPL_SERVICES, @service, "repl_direct_datasource_host")) else return @ti.setting(@ti.setting_key(REPL_SERVICES, @service, "repl_datasource_host")) end ensure TU.log_cmd_results?(true) end end
is_running?()
click to toggle source
# File lib/tungsten/datasource.rb, line 16 def is_running? raise "Undefined function: #{self.class.name()}.is_running?" end
lock_tables()
click to toggle source
# File lib/tungsten/datasource.rb, line 66 def lock_tables raise "Undefined function: #{self.class.name()}.lock_tables" end
password()
click to toggle source
# File lib/tungsten/datasource.rb, line 142 def password begin # Disable logging of command results so the password doesn't end up in a log file TU.log_cmd_results?(false) if @is_direct == true return @ti.setting(@ti.setting_key(REPL_SERVICES, @service, "repl_direct_datasource_password")) else return @ti.setting(@ti.setting_key(REPL_SERVICES, @service, "repl_datasource_password")) end ensure TU.log_cmd_results?(true) end end
port()
click to toggle source
# File lib/tungsten/datasource.rb, line 116 def port begin TU.log_cmd_results?(false) if @is_direct == true return @ti.setting(@ti.setting_key(REPL_SERVICES, @service, "repl_direct_datasource_port")) else return @ti.setting(@ti.setting_key(REPL_SERVICES, @service, "repl_datasource_port")) end ensure TU.log_cmd_results?(true) end end
snapshot_paths()
click to toggle source
# File lib/tungsten/datasource.rb, line 74 def snapshot_paths raise "Undefined function: #{self.class.name()}.snapshot_paths" end
sql_result(sql)
click to toggle source
# File lib/tungsten/datasource.rb, line 86 def sql_result(sql) @ti.sql_result(@service, sql, @is_direct) end
sql_results(sql)
click to toggle source
# File lib/tungsten/datasource.rb, line 82 def sql_results(sql) @ti.sql_results(@service, sql, @is_direct) end
start()
click to toggle source
# File lib/tungsten/datasource.rb, line 41 def start if @is_direct == true raise "Unable to start the direct datasource for #{@service} replication service" end unless can_manage_service?() raise "Unable to start the datasource for #{@service} replication service" end if is_running?() == true return end TU.notice("Start the #{self.title()} service") _start_server() end
stop()
click to toggle source
# File lib/tungsten/datasource.rb, line 20 def stop if @is_direct == true raise "Unable to stop the direct datasource for #{@service} replication service" end unless can_manage_service?() raise "Unable to stop the datasource for #{@service} replication service" end if is_running?() == false return end TU.notice("Stop the #{self.title()} service") _stop_server() end
title()
click to toggle source
# File lib/tungsten/datasource.rb, line 8 def title raise "Undefined function: #{self.class.name()}.title" end
unlock_tables()
click to toggle source
# File lib/tungsten/datasource.rb, line 70 def unlock_tables raise "Undefined function: #{self.class.name()}.unlock_tables" end
url()
click to toggle source
# File lib/tungsten/datasource.rb, line 90 def url begin TU.log_cmd_results?(false) if @is_direct == true return @ti.setting(@ti.setting_key(REPL_SERVICES, @service, "repl_direct_datasource_jdbcqueryurl")) else return @ti.setting(@ti.setting_key(REPL_SERVICES, @service, "repl_datasource_jdbcqueryurl")) end ensure TU.log_cmd_results?(true) end end
user()
click to toggle source
# File lib/tungsten/datasource.rb, line 129 def user begin TU.log_cmd_results?(false) if @is_direct == true return @ti.setting(@ti.setting_key(REPL_SERVICES, @service, "repl_direct_datasource_user")) else return @ti.setting(@ti.setting_key(REPL_SERVICES, @service, "repl_datasource_user")) end ensure TU.log_cmd_results?(true) end end