Navigation Menu

Skip to content

Commit

Permalink
Collect similar methods
Browse files Browse the repository at this point in the history
  • Loading branch information
piroor committed Apr 14, 2015
1 parent a38f90c commit ea38c60
Showing 1 changed file with 20 additions and 20 deletions.
40 changes: 20 additions & 20 deletions lib/droonga/plugins/system/absorb_data.rb
Expand Up @@ -179,26 +179,6 @@ def source_dataset
Catalog::Dataset::DEFAULT_NAME
end

def get_source_tables(&block)
source_client.request("dataset" => source_dataset,
"type" => "table_list") do |response|
unless response
raise EmptyResponse.new("table_list returns nil response")
end
unless response["body"]
raise EmptyBody.new("table_list returns nil result")
end

message_body = response["body"]
body = message_body[1]
tables = body[1..-1]
table_names = tables.collect do |table|
table[1]
end
yield(table_names)
end
end

def source_client_options
{
:host => source_host,
Expand All @@ -220,6 +200,26 @@ def source_client
@source_client ||= Droonga::Client.new(source_client_options)
end

def get_source_tables(&block)
source_client.request("dataset" => source_dataset,
"type" => "table_list") do |response|
unless response
raise EmptyResponse.new("table_list returns nil response")
end
unless response["body"]
raise EmptyBody.new("table_list returns nil result")
end

message_body = response["body"]
body = message_body[1]
tables = body[1..-1]
table_names = tables.collect do |table|
table[1]
end
yield(table_names)
end
end

def get_total_n_source_records(&block)
get_source_tables do |source_tables|
queries = {}
Expand Down

0 comments on commit ea38c60

Please sign in to comment.