Class: TungstenScriptDatasource
- Inherits:
-
Object
- Object
- TungstenScriptDatasource
show all
- Defined in:
- lib/tungsten/datasource.rb
Instance Method Summary
collapse
Constructor Details
Returns a new instance of TungstenScriptDatasource.
2
3
4
5
6
|
# File 'lib/tungsten/datasource.rb', line 2
def initialize(ti, service, is_direct = false)
@ti = ti
@service = service
@is_direct = is_direct
end
|
Instance Method Details
#_stop_server ⇒ Object
37
38
39
|
# File 'lib/tungsten/datasource.rb', line 37
def _stop_server
raise "Undefined function: #{self.class.name()}._stop_server"
end
|
#can_lock_tables? ⇒ Boolean
62
63
64
|
# File 'lib/tungsten/datasource.rb', line 62
def can_lock_tables?
false
end
|
#can_manage_service? ⇒ Boolean
12
13
14
|
# File 'lib/tungsten/datasource.rb', line 12
def can_manage_service?
false
end
|
#can_sql? ⇒ Boolean
78
79
80
|
# File 'lib/tungsten/datasource.rb', line 78
def can_sql?
@ti.can_sql?(@service, @is_direct)
end
|
#host ⇒ Object
103
104
105
106
107
108
109
110
111
112
113
114
|
# 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? ⇒ Boolean
16
17
18
|
# File 'lib/tungsten/datasource.rb', line 16
def is_running?
raise "Undefined function: #{self.class.name()}.is_running?"
end
|
#lock_tables ⇒ Object
66
67
68
|
# File 'lib/tungsten/datasource.rb', line 66
def lock_tables
raise "Undefined function: #{self.class.name()}.lock_tables"
end
|
#password ⇒ Object
142
143
144
145
146
147
148
149
150
151
152
153
154
|
# File 'lib/tungsten/datasource.rb', line 142
def password
begin
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 ⇒ Object
116
117
118
119
120
121
122
123
124
125
126
127
|
# 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 ⇒ Object
74
75
76
|
# File 'lib/tungsten/datasource.rb', line 74
def snapshot_paths
raise "Undefined function: #{self.class.name()}.snapshot_paths"
end
|
#sql_result(sql) ⇒ Object
86
87
88
|
# File 'lib/tungsten/datasource.rb', line 86
def sql_result(sql)
@ti.sql_result(@service, sql, @is_direct)
end
|
#sql_results(sql) ⇒ Object
82
83
84
|
# File 'lib/tungsten/datasource.rb', line 82
def sql_results(sql)
@ti.sql_results(@service, sql, @is_direct)
end
|
#start ⇒ Object
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
|
# 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 ⇒ Object
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
# 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 ⇒ Object
8
9
10
|
# File 'lib/tungsten/datasource.rb', line 8
def title
raise "Undefined function: #{self.class.name()}.title"
end
|
#unlock_tables ⇒ Object
70
71
72
|
# File 'lib/tungsten/datasource.rb', line 70
def unlock_tables
raise "Undefined function: #{self.class.name()}.unlock_tables"
end
|
#url ⇒ Object
90
91
92
93
94
95
96
97
98
99
100
101
|
# 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 ⇒ Object
129
130
131
132
133
134
135
136
137
138
139
140
|
# 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
|