class TungstenAPI::TungstenReplicator
Derived class of TungstenDataserviceManager
, designed to handle calls to Replicator tools that provide json objects
sample usage: cctrl = TungstenReplicator.new('/opt/continuent/cookbook_test/tungsten/tungsten-replicator/bin') cctrl.list() puts '' pp cctrl.get( 'status', nil) pp cctrl.get( 'services', nil) pp cctrl.get( 'tasks', 'mysvc', 'myhost') pp cctrl.get( 'thl_headers', nil, nil, '-low 10 -high 80')
Public Class Methods
new(tools_path, rmi_port=10000)
click to toggle source
Registers all the known API calls for Tungsten data service
# File lib/tungsten/api.rb, line 514 def initialize(tools_path, rmi_port=10000) @api_calls = {} add_api_call( ReplicatorAPICall.new('status', tools_path, 'trepctl', 'status -json', 'Show replicator status', rmi_port ) ) %w(tasks stages stores shards).each do |option| add_api_call( ReplicatorAPICall.new(option, tools_path,'trepctl', "status -name #{option} -json", "Show replicator #{option}", rmi_port ) ) end add_api_call( ReplicatorAPICall.new('services', tools_path, 'trepctl', 'services -json', 'Show replicator services', rmi_port ) ) add_api_call( ReplicatorAPICall.new('properties', tools_path, 'trepctl', 'properties', 'Show replicator properties', rmi_port) ) add_api_call( ReplicatorAPICall.new('thl_headers', tools_path, 'thl', 'list -headers -json', 'Show thl headers', nil) ) end
Public Instance Methods
dashes()
click to toggle source
Overriding ancestor’s method, to make a call to ‘list’ safe
# File lib/tungsten/api.rb, line 535 def dashes return ReplicatorAPICall.dashes end
get(name, service=nil, host=nil, more_options=nil)
click to toggle source
Gets a hash from a JSON
object returned from a given call
name : the api being called service : to qualify the service, if the API requires it host: to run the call with a -host option
# File lib/tungsten/api.rb, line 546 def get(name, service=nil, host=nil, more_options=nil) @api_calls[name].get(service,host,more_options) end
header()
click to toggle source
Overriding ancestor’s method, to make a call to ‘list’ safe
# File lib/tungsten/api.rb, line 528 def header return ReplicatorAPICall.header end