Class: TungstenScriptDatasource

Inherits:
Object
  • Object
show all
Defined in:
lib/tungsten/datasource.rb

Direct Known Subclasses

TungstenScriptMySQLDatasource

Instance Method Summary collapse

Constructor Details

#initialize(ti, service, is_direct = false) ⇒ TungstenScriptDatasource

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_serverObject



33
34
35
# File 'lib/tungsten/datasource.rb', line 33

def _stop_server
  raise "Undefined function: #{self.class.name()}._stop_server"
end

#can_lock_tables?Boolean

Returns:

  • (Boolean)


58
59
60
# File 'lib/tungsten/datasource.rb', line 58

def can_lock_tables?
  false
end

#can_manage_service?Boolean

Returns:

  • (Boolean)


8
9
10
# File 'lib/tungsten/datasource.rb', line 8

def can_manage_service?
  false
end

#can_sql?Boolean

Returns:

  • (Boolean)


74
75
76
# File 'lib/tungsten/datasource.rb', line 74

def can_sql?
  @ti.can_sql?(@service, @is_direct)
end

#is_running?Boolean

Returns:

  • (Boolean)


12
13
14
# File 'lib/tungsten/datasource.rb', line 12

def is_running?
  raise "Undefined function: #{self.class.name()}.is_running?"
end

#lock_tablesObject



62
63
64
# File 'lib/tungsten/datasource.rb', line 62

def lock_tables
  raise "Undefined function: #{self.class.name()}.lock_tables"
end

#snapshot_pathsObject



70
71
72
# File 'lib/tungsten/datasource.rb', line 70

def snapshot_paths
  raise "Undefined function: #{self.class.name()}.snapshot_paths"
end

#sql_result(sql) ⇒ Object



82
83
84
# File 'lib/tungsten/datasource.rb', line 82

def sql_result(sql)
  @ti.sql_result(@service, sql, @is_direct)
end

#sql_results(sql) ⇒ Object



78
79
80
# File 'lib/tungsten/datasource.rb', line 78

def sql_results(sql)
  @ti.sql_results(@service, sql, @is_direct)
end

#startObject



37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/tungsten/datasource.rb', line 37

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.class.name()} service")
  _start_server()
end

#stopObject



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/tungsten/datasource.rb', line 16

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.class.name()} service")
  _stop_server()
end

#unlock_tablesObject



66
67
68
# File 'lib/tungsten/datasource.rb', line 66

def unlock_tables
  raise "Undefined function: #{self.class.name()}.unlock_tables"
end