activerecord-hive-adapter 0.0.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +3 -0
- data/Gemfile +4 -0
- data/README.md +3 -0
- data/Rakefile +2 -0
- data/activerecord-hive-adapter.gemspec +24 -0
- data/lib/active_record/connection_adapters/hive_adapter.rb +252 -0
- data/lib/activerecord-hive-adapter.rb +8 -0
- data/lib/activerecord_hive_adapter/hive_connector.rb +49 -0
- data/lib/activerecord_hive_adapter/version.rb +3 -0
- data/vendor/thrift_hive/gen-rb/facebook_service.rb +700 -0
- data/vendor/thrift_hive/gen-rb/fb303_constants.rb +8 -0
- data/vendor/thrift_hive/gen-rb/fb303_types.rb +18 -0
- data/vendor/thrift_hive/gen-rb/hive_metastore_constants.rb +40 -0
- data/vendor/thrift_hive/gen-rb/hive_metastore_types.rb +629 -0
- data/vendor/thrift_hive/gen-rb/hive_service_constants.rb +8 -0
- data/vendor/thrift_hive/gen-rb/hive_service_types.rb +67 -0
- data/vendor/thrift_hive/gen-rb/queryplan_constants.rb +8 -0
- data/vendor/thrift_hive/gen-rb/queryplan_types.rb +256 -0
- data/vendor/thrift_hive/gen-rb/serde_constants.rb +92 -0
- data/vendor/thrift_hive/gen-rb/serde_types.rb +7 -0
- data/vendor/thrift_hive/gen-rb/thrift_hive.rb +504 -0
- data/vendor/thrift_hive/gen-rb/thrift_hive_metastore.rb +3856 -0
- metadata +94 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 048e4f9f58a988c42097e307614d26551c8a3d76
|
4
|
+
data.tar.gz: 6509a4c28d70d7363fc2e7724d9cc1092cd8c111
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: db003f76f8e161610d03a1c09c573594de1a0c6bd59c8b38d12b9fecb34f71107e79c909b8415edf5825b29fa5751fbccf32809608435cb2035c9bcd9d6b2b21
|
7
|
+
data.tar.gz: 507cccacdb27222b5bd91223041104cdbc02f27dd0d1d24993427624504698597e328d914552e53d7ccd1883f595158fa193be56772f9fbf0bcd193f6d7a4b15
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/README.md
ADDED
data/Rakefile
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
require "activerecord_hive_adapter/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |s|
|
6
|
+
s.name = "activerecord-hive-adapter"
|
7
|
+
s.version = ActiverecordHiveAdapter::VERSION
|
8
|
+
s.platform = Gem::Platform::RUBY
|
9
|
+
s.authors = ["Nanda Sankaran"]
|
10
|
+
s.email = ["nanda@mobme.in"]
|
11
|
+
s.homepage = ""
|
12
|
+
s.summary = %q{Hive adapter for ActiveRecord}
|
13
|
+
s.description = %q{Hive adapter for ActiveRecord}
|
14
|
+
|
15
|
+
s.rubyforge_project = 'activerecord-hive-adapter'
|
16
|
+
|
17
|
+
s.add_dependency('thrift')
|
18
|
+
s.add_dependency('arel')
|
19
|
+
|
20
|
+
s.files = `git ls-files`.split("\n")
|
21
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
22
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
23
|
+
s.require_paths = ["lib", "vendor/thrift_hive/gen-rb"]
|
24
|
+
end
|
@@ -0,0 +1,252 @@
|
|
1
|
+
module Arel
|
2
|
+
module Visitors
|
3
|
+
class Hive < Arel::Visitors::ToSql
|
4
|
+
|
5
|
+
end
|
6
|
+
end
|
7
|
+
end
|
8
|
+
|
9
|
+
module ActiveRecord
|
10
|
+
class Base
|
11
|
+
def self.hive_connection(config)
|
12
|
+
connection_params = config.values_at(:host, :port, :database, :timeout)
|
13
|
+
ConnectionAdapters::HiveAdapter.new(nil, logger, connection_params, config)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
module ConnectionAdapters
|
18
|
+
class HiveColumn < Column
|
19
|
+
def initialize(name, default, sql_type, partition)
|
20
|
+
super(name, default, sql_type)
|
21
|
+
@partition = partition
|
22
|
+
end
|
23
|
+
|
24
|
+
def partition?
|
25
|
+
@partition
|
26
|
+
end
|
27
|
+
|
28
|
+
def extract_default(default)
|
29
|
+
case [type, default]
|
30
|
+
when [:date, 'current_date'] then return default
|
31
|
+
when [:datetime, 'current_time'] then return default
|
32
|
+
end
|
33
|
+
super
|
34
|
+
end
|
35
|
+
|
36
|
+
def realized_default
|
37
|
+
# returns realized value of defaults
|
38
|
+
case [type, default]
|
39
|
+
when [:date, 'current_date'] then Date.today
|
40
|
+
when [:datetime, 'current_time'] then DateTime.now
|
41
|
+
else default
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
class HiveAdapter < AbstractAdapter
|
47
|
+
|
48
|
+
module TableDefinitionExtensions
|
49
|
+
attr_reader :partitions
|
50
|
+
|
51
|
+
def partition(name, type, options={ })
|
52
|
+
column(name, type, options)
|
53
|
+
@partitions = [] unless @partitions
|
54
|
+
@partitions << @columns.pop
|
55
|
+
end
|
56
|
+
|
57
|
+
def row_format
|
58
|
+
'ROW FORMAT DELIMITED FIELDS TERMINATED BY "\t"'
|
59
|
+
end
|
60
|
+
|
61
|
+
def external
|
62
|
+
true
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
NATIVE_DATABASE_TYPES = {
|
67
|
+
:string => { :name => "string" },
|
68
|
+
:text => { :name => "string" },
|
69
|
+
:integer => { :name => "int" },
|
70
|
+
:float => { :name => "float" },
|
71
|
+
:double => { :name => "double" },
|
72
|
+
:datetime => { :name => "string" },
|
73
|
+
:timestamp => { :name => "string" },
|
74
|
+
:time => { :name => "string" },
|
75
|
+
:date => { :name => "string" },
|
76
|
+
:binary => { :name => "string" },
|
77
|
+
:boolean => { :name => "tinyint" }
|
78
|
+
}
|
79
|
+
|
80
|
+
class BindSubstitution < Arel::Visitors::Hive
|
81
|
+
include Arel::Visitors::BindVisitor
|
82
|
+
end
|
83
|
+
|
84
|
+
def initialize(connection, logger, connection_params, config)
|
85
|
+
super(connection, logger)
|
86
|
+
@connection_params = connection_params
|
87
|
+
connect
|
88
|
+
@visitor = BindSubstitution.new(self)
|
89
|
+
end
|
90
|
+
|
91
|
+
def connect
|
92
|
+
@connection = ActiveRecordHiveAdapter::HiveConnector.new(*@connection_params)
|
93
|
+
end
|
94
|
+
|
95
|
+
def disconnect
|
96
|
+
@connection.close
|
97
|
+
end
|
98
|
+
|
99
|
+
def reconnect!
|
100
|
+
disconnect
|
101
|
+
connect
|
102
|
+
end
|
103
|
+
|
104
|
+
def active?
|
105
|
+
begin
|
106
|
+
@connection.execute("SET check=1")
|
107
|
+
true
|
108
|
+
rescue
|
109
|
+
false
|
110
|
+
end
|
111
|
+
end
|
112
|
+
|
113
|
+
def execute(sql, name=nil)
|
114
|
+
with_auto_reconnect do
|
115
|
+
log(sql, name) { @connection.execute(sql) }
|
116
|
+
end
|
117
|
+
end
|
118
|
+
|
119
|
+
def adapter_name #:nodoc:
|
120
|
+
'Hive'
|
121
|
+
end
|
122
|
+
|
123
|
+
def supports_migrations? #:nodoc:
|
124
|
+
true
|
125
|
+
end
|
126
|
+
|
127
|
+
def supports_primary_key? #:nodoc:
|
128
|
+
false
|
129
|
+
end
|
130
|
+
|
131
|
+
def native_database_types
|
132
|
+
NATIVE_DATABASE_TYPES
|
133
|
+
end
|
134
|
+
|
135
|
+
def query(sql, name=nil)
|
136
|
+
with_auto_reconnect do
|
137
|
+
log(sql, name) do
|
138
|
+
@connection.execute(sql)
|
139
|
+
@connection.fetch_all
|
140
|
+
end
|
141
|
+
end
|
142
|
+
end
|
143
|
+
|
144
|
+
def select(sql, name=nil, binds=[])
|
145
|
+
with_auto_reconnect do
|
146
|
+
log(sql, name) do
|
147
|
+
@connection.execute(sql)
|
148
|
+
fields = @connection.get_schema.fieldSchemas.map { |f| f.name }
|
149
|
+
res = @connection.fetch_all
|
150
|
+
res.map { |row| Hash[*fields.zip(row.split("\t")).flatten] }
|
151
|
+
end
|
152
|
+
end
|
153
|
+
end
|
154
|
+
|
155
|
+
def select_rows(sql, name=nil)
|
156
|
+
query(sql, name)
|
157
|
+
end
|
158
|
+
|
159
|
+
def database_name
|
160
|
+
@connection.database
|
161
|
+
end
|
162
|
+
|
163
|
+
def tables(name=nil)
|
164
|
+
query("SHOW TABLES", name)
|
165
|
+
end
|
166
|
+
|
167
|
+
def primary_key(table_name)
|
168
|
+
nil
|
169
|
+
end
|
170
|
+
|
171
|
+
def columns(table, name=nil)
|
172
|
+
res = query("DESCRIBE FORMATTED #{quote_table_name(table)}", name)
|
173
|
+
|
174
|
+
table_info_index = res.find_index { |ln| ln.start_with?("# Detailed Table Information") }
|
175
|
+
begin_partition = false
|
176
|
+
columns = []
|
177
|
+
res.slice(0, table_info_index - 1).each do |ln|
|
178
|
+
if ln.start_with?("# Partition Information")
|
179
|
+
begin_partition = true
|
180
|
+
next
|
181
|
+
end
|
182
|
+
next if ln.strip.empty?
|
183
|
+
next if ln.start_with?("# col_name")
|
184
|
+
col_name, sql_type, comment = ln.split(/\s+/)
|
185
|
+
meta = Hash[comment.to_s.split(',').map { |meta| property, value = meta.split('=') }]
|
186
|
+
type = meta['ar_type'] || sql_type
|
187
|
+
columns << HiveColumn.new(col_name, meta['ar_default'], type, begin_partition)
|
188
|
+
end
|
189
|
+
columns
|
190
|
+
end
|
191
|
+
|
192
|
+
def create_table(table_name, options={ })
|
193
|
+
table_definition = TableDefinition.new(self)
|
194
|
+
table_definition.extend(TableDefinitionExtensions)
|
195
|
+
|
196
|
+
yield table_definition if block_given?
|
197
|
+
|
198
|
+
if options[:force] && table_exists?(table_name)
|
199
|
+
drop_table(table_name, options)
|
200
|
+
end
|
201
|
+
|
202
|
+
create_sql = "CREATE#{' EXTERNAL' if table_definition.external} TABLE "
|
203
|
+
create_sql << "#{quote_table_name(table_name)} ("
|
204
|
+
create_sql << table_definition.to_sql
|
205
|
+
create_sql << ") "
|
206
|
+
create_sql << "#{partitioned_by(table_definition.partitions)} "
|
207
|
+
create_sql << table_definition.row_format
|
208
|
+
execute create_sql
|
209
|
+
end
|
210
|
+
|
211
|
+
def add_column_options!(sql, options) #:nodoc:
|
212
|
+
meta = ""
|
213
|
+
meta << "ar_type=#{options[:column].type}"
|
214
|
+
meta << ",ar_default=#{options[:default]}" if options[:default]
|
215
|
+
sql << " COMMENT '#{meta}'"
|
216
|
+
end
|
217
|
+
|
218
|
+
def add_index(table_name, column_name, options = { })
|
219
|
+
raise NotImplementedError
|
220
|
+
end
|
221
|
+
|
222
|
+
def add_column(table_name, column_name, type, options = { })
|
223
|
+
sql = "ALTER TABLE #{quote_table_name(table_name)} ADD COLUMNS (#{quote_column_name(column_name)} #{type_to_sql(type)}"
|
224
|
+
o = { }
|
225
|
+
o[:default] = options[:default] if options[:default]
|
226
|
+
o[:column] = HiveColumn.new(column_name, nil, type, false)
|
227
|
+
add_column_options!(sql, o)
|
228
|
+
sql << ")"
|
229
|
+
execute(sql)
|
230
|
+
end
|
231
|
+
|
232
|
+
def partitioned_by(partitions)
|
233
|
+
unless partitions.to_a.empty?
|
234
|
+
spec = "PARTITIONED BY ("
|
235
|
+
spec << partitions.map do |p|
|
236
|
+
options = { :default => p.default, :column => p }
|
237
|
+
add_column_options!("#{p.name} #{p.sql_type}", options)
|
238
|
+
end.join(", ") << ")"
|
239
|
+
end
|
240
|
+
end
|
241
|
+
|
242
|
+
def with_auto_reconnect
|
243
|
+
yield
|
244
|
+
rescue Thrift::TransportException => e
|
245
|
+
raise unless e.message == "end of file reached"
|
246
|
+
reconnect!
|
247
|
+
yield
|
248
|
+
end
|
249
|
+
end
|
250
|
+
|
251
|
+
end
|
252
|
+
end
|
@@ -0,0 +1,49 @@
|
|
1
|
+
module ActiveRecordHiveAdapter
|
2
|
+
|
3
|
+
class HiveConnector
|
4
|
+
attr_reader :database
|
5
|
+
|
6
|
+
def initialize(host, port, database, timeout)
|
7
|
+
socket = Thrift::Socket.new(host, port, timeout)
|
8
|
+
@transport = Thrift::BufferedTransport.new(socket)
|
9
|
+
protocol = Thrift::BinaryProtocol.new(@transport)
|
10
|
+
@client = ThriftHive::Client.new(protocol)
|
11
|
+
open(database)
|
12
|
+
end
|
13
|
+
|
14
|
+
def open(database)
|
15
|
+
@transport.open
|
16
|
+
self.database = database
|
17
|
+
end
|
18
|
+
|
19
|
+
def reconnect!
|
20
|
+
close
|
21
|
+
open(self.database)
|
22
|
+
end
|
23
|
+
|
24
|
+
def close
|
25
|
+
@transport.close rescue IOError
|
26
|
+
end
|
27
|
+
|
28
|
+
def open?
|
29
|
+
@transport.open?
|
30
|
+
end
|
31
|
+
|
32
|
+
def execute(sql)
|
33
|
+
@client.execute(sql)
|
34
|
+
end
|
35
|
+
|
36
|
+
def fetch_all
|
37
|
+
@client.fetchAll()
|
38
|
+
end
|
39
|
+
|
40
|
+
def get_schema
|
41
|
+
@client.getSchema()
|
42
|
+
end
|
43
|
+
|
44
|
+
def database=(new_database)
|
45
|
+
execute("USE #{new_database}")
|
46
|
+
@database = new_database
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
@@ -0,0 +1,700 @@
|
|
1
|
+
#
|
2
|
+
# Autogenerated by Thrift
|
3
|
+
#
|
4
|
+
# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
|
5
|
+
#
|
6
|
+
|
7
|
+
require 'thrift'
|
8
|
+
require 'fb303_types'
|
9
|
+
|
10
|
+
module FacebookService
|
11
|
+
class Client
|
12
|
+
include ::Thrift::Client
|
13
|
+
|
14
|
+
def getName()
|
15
|
+
send_getName()
|
16
|
+
return recv_getName()
|
17
|
+
end
|
18
|
+
|
19
|
+
def send_getName()
|
20
|
+
send_message('getName', GetName_args)
|
21
|
+
end
|
22
|
+
|
23
|
+
def recv_getName()
|
24
|
+
result = receive_message(GetName_result)
|
25
|
+
return result.success unless result.success.nil?
|
26
|
+
raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'getName failed: unknown result')
|
27
|
+
end
|
28
|
+
|
29
|
+
def getVersion()
|
30
|
+
send_getVersion()
|
31
|
+
return recv_getVersion()
|
32
|
+
end
|
33
|
+
|
34
|
+
def send_getVersion()
|
35
|
+
send_message('getVersion', GetVersion_args)
|
36
|
+
end
|
37
|
+
|
38
|
+
def recv_getVersion()
|
39
|
+
result = receive_message(GetVersion_result)
|
40
|
+
return result.success unless result.success.nil?
|
41
|
+
raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'getVersion failed: unknown result')
|
42
|
+
end
|
43
|
+
|
44
|
+
def getStatus()
|
45
|
+
send_getStatus()
|
46
|
+
return recv_getStatus()
|
47
|
+
end
|
48
|
+
|
49
|
+
def send_getStatus()
|
50
|
+
send_message('getStatus', GetStatus_args)
|
51
|
+
end
|
52
|
+
|
53
|
+
def recv_getStatus()
|
54
|
+
result = receive_message(GetStatus_result)
|
55
|
+
return result.success unless result.success.nil?
|
56
|
+
raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'getStatus failed: unknown result')
|
57
|
+
end
|
58
|
+
|
59
|
+
def getStatusDetails()
|
60
|
+
send_getStatusDetails()
|
61
|
+
return recv_getStatusDetails()
|
62
|
+
end
|
63
|
+
|
64
|
+
def send_getStatusDetails()
|
65
|
+
send_message('getStatusDetails', GetStatusDetails_args)
|
66
|
+
end
|
67
|
+
|
68
|
+
def recv_getStatusDetails()
|
69
|
+
result = receive_message(GetStatusDetails_result)
|
70
|
+
return result.success unless result.success.nil?
|
71
|
+
raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'getStatusDetails failed: unknown result')
|
72
|
+
end
|
73
|
+
|
74
|
+
def getCounters()
|
75
|
+
send_getCounters()
|
76
|
+
return recv_getCounters()
|
77
|
+
end
|
78
|
+
|
79
|
+
def send_getCounters()
|
80
|
+
send_message('getCounters', GetCounters_args)
|
81
|
+
end
|
82
|
+
|
83
|
+
def recv_getCounters()
|
84
|
+
result = receive_message(GetCounters_result)
|
85
|
+
return result.success unless result.success.nil?
|
86
|
+
raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'getCounters failed: unknown result')
|
87
|
+
end
|
88
|
+
|
89
|
+
def getCounter(key)
|
90
|
+
send_getCounter(key)
|
91
|
+
return recv_getCounter()
|
92
|
+
end
|
93
|
+
|
94
|
+
def send_getCounter(key)
|
95
|
+
send_message('getCounter', GetCounter_args, :key => key)
|
96
|
+
end
|
97
|
+
|
98
|
+
def recv_getCounter()
|
99
|
+
result = receive_message(GetCounter_result)
|
100
|
+
return result.success unless result.success.nil?
|
101
|
+
raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'getCounter failed: unknown result')
|
102
|
+
end
|
103
|
+
|
104
|
+
def setOption(key, value)
|
105
|
+
send_setOption(key, value)
|
106
|
+
recv_setOption()
|
107
|
+
end
|
108
|
+
|
109
|
+
def send_setOption(key, value)
|
110
|
+
send_message('setOption', SetOption_args, :key => key, :value => value)
|
111
|
+
end
|
112
|
+
|
113
|
+
def recv_setOption()
|
114
|
+
result = receive_message(SetOption_result)
|
115
|
+
return
|
116
|
+
end
|
117
|
+
|
118
|
+
def getOption(key)
|
119
|
+
send_getOption(key)
|
120
|
+
return recv_getOption()
|
121
|
+
end
|
122
|
+
|
123
|
+
def send_getOption(key)
|
124
|
+
send_message('getOption', GetOption_args, :key => key)
|
125
|
+
end
|
126
|
+
|
127
|
+
def recv_getOption()
|
128
|
+
result = receive_message(GetOption_result)
|
129
|
+
return result.success unless result.success.nil?
|
130
|
+
raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'getOption failed: unknown result')
|
131
|
+
end
|
132
|
+
|
133
|
+
def getOptions()
|
134
|
+
send_getOptions()
|
135
|
+
return recv_getOptions()
|
136
|
+
end
|
137
|
+
|
138
|
+
def send_getOptions()
|
139
|
+
send_message('getOptions', GetOptions_args)
|
140
|
+
end
|
141
|
+
|
142
|
+
def recv_getOptions()
|
143
|
+
result = receive_message(GetOptions_result)
|
144
|
+
return result.success unless result.success.nil?
|
145
|
+
raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'getOptions failed: unknown result')
|
146
|
+
end
|
147
|
+
|
148
|
+
def getCpuProfile(profileDurationInSec)
|
149
|
+
send_getCpuProfile(profileDurationInSec)
|
150
|
+
return recv_getCpuProfile()
|
151
|
+
end
|
152
|
+
|
153
|
+
def send_getCpuProfile(profileDurationInSec)
|
154
|
+
send_message('getCpuProfile', GetCpuProfile_args, :profileDurationInSec => profileDurationInSec)
|
155
|
+
end
|
156
|
+
|
157
|
+
def recv_getCpuProfile()
|
158
|
+
result = receive_message(GetCpuProfile_result)
|
159
|
+
return result.success unless result.success.nil?
|
160
|
+
raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'getCpuProfile failed: unknown result')
|
161
|
+
end
|
162
|
+
|
163
|
+
def aliveSince()
|
164
|
+
send_aliveSince()
|
165
|
+
return recv_aliveSince()
|
166
|
+
end
|
167
|
+
|
168
|
+
def send_aliveSince()
|
169
|
+
send_message('aliveSince', AliveSince_args)
|
170
|
+
end
|
171
|
+
|
172
|
+
def recv_aliveSince()
|
173
|
+
result = receive_message(AliveSince_result)
|
174
|
+
return result.success unless result.success.nil?
|
175
|
+
raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'aliveSince failed: unknown result')
|
176
|
+
end
|
177
|
+
|
178
|
+
def reinitialize()
|
179
|
+
send_reinitialize()
|
180
|
+
end
|
181
|
+
|
182
|
+
def send_reinitialize()
|
183
|
+
send_message('reinitialize', Reinitialize_args)
|
184
|
+
end
|
185
|
+
def shutdown()
|
186
|
+
send_shutdown()
|
187
|
+
end
|
188
|
+
|
189
|
+
def send_shutdown()
|
190
|
+
send_message('shutdown', Shutdown_args)
|
191
|
+
end
|
192
|
+
end
|
193
|
+
|
194
|
+
class Processor
|
195
|
+
include ::Thrift::Processor
|
196
|
+
|
197
|
+
def process_getName(seqid, iprot, oprot)
|
198
|
+
args = read_args(iprot, GetName_args)
|
199
|
+
result = GetName_result.new()
|
200
|
+
result.success = @handler.getName()
|
201
|
+
write_result(result, oprot, 'getName', seqid)
|
202
|
+
end
|
203
|
+
|
204
|
+
def process_getVersion(seqid, iprot, oprot)
|
205
|
+
args = read_args(iprot, GetVersion_args)
|
206
|
+
result = GetVersion_result.new()
|
207
|
+
result.success = @handler.getVersion()
|
208
|
+
write_result(result, oprot, 'getVersion', seqid)
|
209
|
+
end
|
210
|
+
|
211
|
+
def process_getStatus(seqid, iprot, oprot)
|
212
|
+
args = read_args(iprot, GetStatus_args)
|
213
|
+
result = GetStatus_result.new()
|
214
|
+
result.success = @handler.getStatus()
|
215
|
+
write_result(result, oprot, 'getStatus', seqid)
|
216
|
+
end
|
217
|
+
|
218
|
+
def process_getStatusDetails(seqid, iprot, oprot)
|
219
|
+
args = read_args(iprot, GetStatusDetails_args)
|
220
|
+
result = GetStatusDetails_result.new()
|
221
|
+
result.success = @handler.getStatusDetails()
|
222
|
+
write_result(result, oprot, 'getStatusDetails', seqid)
|
223
|
+
end
|
224
|
+
|
225
|
+
def process_getCounters(seqid, iprot, oprot)
|
226
|
+
args = read_args(iprot, GetCounters_args)
|
227
|
+
result = GetCounters_result.new()
|
228
|
+
result.success = @handler.getCounters()
|
229
|
+
write_result(result, oprot, 'getCounters', seqid)
|
230
|
+
end
|
231
|
+
|
232
|
+
def process_getCounter(seqid, iprot, oprot)
|
233
|
+
args = read_args(iprot, GetCounter_args)
|
234
|
+
result = GetCounter_result.new()
|
235
|
+
result.success = @handler.getCounter(args.key)
|
236
|
+
write_result(result, oprot, 'getCounter', seqid)
|
237
|
+
end
|
238
|
+
|
239
|
+
def process_setOption(seqid, iprot, oprot)
|
240
|
+
args = read_args(iprot, SetOption_args)
|
241
|
+
result = SetOption_result.new()
|
242
|
+
@handler.setOption(args.key, args.value)
|
243
|
+
write_result(result, oprot, 'setOption', seqid)
|
244
|
+
end
|
245
|
+
|
246
|
+
def process_getOption(seqid, iprot, oprot)
|
247
|
+
args = read_args(iprot, GetOption_args)
|
248
|
+
result = GetOption_result.new()
|
249
|
+
result.success = @handler.getOption(args.key)
|
250
|
+
write_result(result, oprot, 'getOption', seqid)
|
251
|
+
end
|
252
|
+
|
253
|
+
def process_getOptions(seqid, iprot, oprot)
|
254
|
+
args = read_args(iprot, GetOptions_args)
|
255
|
+
result = GetOptions_result.new()
|
256
|
+
result.success = @handler.getOptions()
|
257
|
+
write_result(result, oprot, 'getOptions', seqid)
|
258
|
+
end
|
259
|
+
|
260
|
+
def process_getCpuProfile(seqid, iprot, oprot)
|
261
|
+
args = read_args(iprot, GetCpuProfile_args)
|
262
|
+
result = GetCpuProfile_result.new()
|
263
|
+
result.success = @handler.getCpuProfile(args.profileDurationInSec)
|
264
|
+
write_result(result, oprot, 'getCpuProfile', seqid)
|
265
|
+
end
|
266
|
+
|
267
|
+
def process_aliveSince(seqid, iprot, oprot)
|
268
|
+
args = read_args(iprot, AliveSince_args)
|
269
|
+
result = AliveSince_result.new()
|
270
|
+
result.success = @handler.aliveSince()
|
271
|
+
write_result(result, oprot, 'aliveSince', seqid)
|
272
|
+
end
|
273
|
+
|
274
|
+
def process_reinitialize(seqid, iprot, oprot)
|
275
|
+
args = read_args(iprot, Reinitialize_args)
|
276
|
+
@handler.reinitialize()
|
277
|
+
return
|
278
|
+
end
|
279
|
+
|
280
|
+
def process_shutdown(seqid, iprot, oprot)
|
281
|
+
args = read_args(iprot, Shutdown_args)
|
282
|
+
@handler.shutdown()
|
283
|
+
return
|
284
|
+
end
|
285
|
+
|
286
|
+
end
|
287
|
+
|
288
|
+
# HELPER FUNCTIONS AND STRUCTURES
|
289
|
+
|
290
|
+
class GetName_args
|
291
|
+
include ::Thrift::Struct, ::Thrift::Struct_Union
|
292
|
+
|
293
|
+
FIELDS = {
|
294
|
+
|
295
|
+
}
|
296
|
+
|
297
|
+
def struct_fields; FIELDS; end
|
298
|
+
|
299
|
+
def validate
|
300
|
+
end
|
301
|
+
|
302
|
+
::Thrift::Struct.generate_accessors self
|
303
|
+
end
|
304
|
+
|
305
|
+
class GetName_result
|
306
|
+
include ::Thrift::Struct, ::Thrift::Struct_Union
|
307
|
+
SUCCESS = 0
|
308
|
+
|
309
|
+
FIELDS = {
|
310
|
+
SUCCESS => {:type => ::Thrift::Types::STRING, :name => 'success'}
|
311
|
+
}
|
312
|
+
|
313
|
+
def struct_fields; FIELDS; end
|
314
|
+
|
315
|
+
def validate
|
316
|
+
end
|
317
|
+
|
318
|
+
::Thrift::Struct.generate_accessors self
|
319
|
+
end
|
320
|
+
|
321
|
+
class GetVersion_args
|
322
|
+
include ::Thrift::Struct, ::Thrift::Struct_Union
|
323
|
+
|
324
|
+
FIELDS = {
|
325
|
+
|
326
|
+
}
|
327
|
+
|
328
|
+
def struct_fields; FIELDS; end
|
329
|
+
|
330
|
+
def validate
|
331
|
+
end
|
332
|
+
|
333
|
+
::Thrift::Struct.generate_accessors self
|
334
|
+
end
|
335
|
+
|
336
|
+
class GetVersion_result
|
337
|
+
include ::Thrift::Struct, ::Thrift::Struct_Union
|
338
|
+
SUCCESS = 0
|
339
|
+
|
340
|
+
FIELDS = {
|
341
|
+
SUCCESS => {:type => ::Thrift::Types::STRING, :name => 'success'}
|
342
|
+
}
|
343
|
+
|
344
|
+
def struct_fields; FIELDS; end
|
345
|
+
|
346
|
+
def validate
|
347
|
+
end
|
348
|
+
|
349
|
+
::Thrift::Struct.generate_accessors self
|
350
|
+
end
|
351
|
+
|
352
|
+
class GetStatus_args
|
353
|
+
include ::Thrift::Struct, ::Thrift::Struct_Union
|
354
|
+
|
355
|
+
FIELDS = {
|
356
|
+
|
357
|
+
}
|
358
|
+
|
359
|
+
def struct_fields; FIELDS; end
|
360
|
+
|
361
|
+
def validate
|
362
|
+
end
|
363
|
+
|
364
|
+
::Thrift::Struct.generate_accessors self
|
365
|
+
end
|
366
|
+
|
367
|
+
class GetStatus_result
|
368
|
+
include ::Thrift::Struct, ::Thrift::Struct_Union
|
369
|
+
SUCCESS = 0
|
370
|
+
|
371
|
+
FIELDS = {
|
372
|
+
SUCCESS => {:type => ::Thrift::Types::I32, :name => 'success', :enum_class => Fb_status}
|
373
|
+
}
|
374
|
+
|
375
|
+
def struct_fields; FIELDS; end
|
376
|
+
|
377
|
+
def validate
|
378
|
+
unless @success.nil? || Fb_status::VALID_VALUES.include?(@success)
|
379
|
+
raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Invalid value of field success!')
|
380
|
+
end
|
381
|
+
end
|
382
|
+
|
383
|
+
::Thrift::Struct.generate_accessors self
|
384
|
+
end
|
385
|
+
|
386
|
+
class GetStatusDetails_args
|
387
|
+
include ::Thrift::Struct, ::Thrift::Struct_Union
|
388
|
+
|
389
|
+
FIELDS = {
|
390
|
+
|
391
|
+
}
|
392
|
+
|
393
|
+
def struct_fields; FIELDS; end
|
394
|
+
|
395
|
+
def validate
|
396
|
+
end
|
397
|
+
|
398
|
+
::Thrift::Struct.generate_accessors self
|
399
|
+
end
|
400
|
+
|
401
|
+
class GetStatusDetails_result
|
402
|
+
include ::Thrift::Struct, ::Thrift::Struct_Union
|
403
|
+
SUCCESS = 0
|
404
|
+
|
405
|
+
FIELDS = {
|
406
|
+
SUCCESS => {:type => ::Thrift::Types::STRING, :name => 'success'}
|
407
|
+
}
|
408
|
+
|
409
|
+
def struct_fields; FIELDS; end
|
410
|
+
|
411
|
+
def validate
|
412
|
+
end
|
413
|
+
|
414
|
+
::Thrift::Struct.generate_accessors self
|
415
|
+
end
|
416
|
+
|
417
|
+
class GetCounters_args
|
418
|
+
include ::Thrift::Struct, ::Thrift::Struct_Union
|
419
|
+
|
420
|
+
FIELDS = {
|
421
|
+
|
422
|
+
}
|
423
|
+
|
424
|
+
def struct_fields; FIELDS; end
|
425
|
+
|
426
|
+
def validate
|
427
|
+
end
|
428
|
+
|
429
|
+
::Thrift::Struct.generate_accessors self
|
430
|
+
end
|
431
|
+
|
432
|
+
class GetCounters_result
|
433
|
+
include ::Thrift::Struct, ::Thrift::Struct_Union
|
434
|
+
SUCCESS = 0
|
435
|
+
|
436
|
+
FIELDS = {
|
437
|
+
SUCCESS => {:type => ::Thrift::Types::MAP, :name => 'success', :key => {:type => ::Thrift::Types::STRING}, :value => {:type => ::Thrift::Types::I64}}
|
438
|
+
}
|
439
|
+
|
440
|
+
def struct_fields; FIELDS; end
|
441
|
+
|
442
|
+
def validate
|
443
|
+
end
|
444
|
+
|
445
|
+
::Thrift::Struct.generate_accessors self
|
446
|
+
end
|
447
|
+
|
448
|
+
class GetCounter_args
|
449
|
+
include ::Thrift::Struct, ::Thrift::Struct_Union
|
450
|
+
KEY = 1
|
451
|
+
|
452
|
+
FIELDS = {
|
453
|
+
KEY => {:type => ::Thrift::Types::STRING, :name => 'key'}
|
454
|
+
}
|
455
|
+
|
456
|
+
def struct_fields; FIELDS; end
|
457
|
+
|
458
|
+
def validate
|
459
|
+
end
|
460
|
+
|
461
|
+
::Thrift::Struct.generate_accessors self
|
462
|
+
end
|
463
|
+
|
464
|
+
class GetCounter_result
|
465
|
+
include ::Thrift::Struct, ::Thrift::Struct_Union
|
466
|
+
SUCCESS = 0
|
467
|
+
|
468
|
+
FIELDS = {
|
469
|
+
SUCCESS => {:type => ::Thrift::Types::I64, :name => 'success'}
|
470
|
+
}
|
471
|
+
|
472
|
+
def struct_fields; FIELDS; end
|
473
|
+
|
474
|
+
def validate
|
475
|
+
end
|
476
|
+
|
477
|
+
::Thrift::Struct.generate_accessors self
|
478
|
+
end
|
479
|
+
|
480
|
+
class SetOption_args
|
481
|
+
include ::Thrift::Struct, ::Thrift::Struct_Union
|
482
|
+
KEY = 1
|
483
|
+
VALUE = 2
|
484
|
+
|
485
|
+
FIELDS = {
|
486
|
+
KEY => {:type => ::Thrift::Types::STRING, :name => 'key'},
|
487
|
+
VALUE => {:type => ::Thrift::Types::STRING, :name => 'value'}
|
488
|
+
}
|
489
|
+
|
490
|
+
def struct_fields; FIELDS; end
|
491
|
+
|
492
|
+
def validate
|
493
|
+
end
|
494
|
+
|
495
|
+
::Thrift::Struct.generate_accessors self
|
496
|
+
end
|
497
|
+
|
498
|
+
class SetOption_result
|
499
|
+
include ::Thrift::Struct, ::Thrift::Struct_Union
|
500
|
+
|
501
|
+
FIELDS = {
|
502
|
+
|
503
|
+
}
|
504
|
+
|
505
|
+
def struct_fields; FIELDS; end
|
506
|
+
|
507
|
+
def validate
|
508
|
+
end
|
509
|
+
|
510
|
+
::Thrift::Struct.generate_accessors self
|
511
|
+
end
|
512
|
+
|
513
|
+
class GetOption_args
|
514
|
+
include ::Thrift::Struct, ::Thrift::Struct_Union
|
515
|
+
KEY = 1
|
516
|
+
|
517
|
+
FIELDS = {
|
518
|
+
KEY => {:type => ::Thrift::Types::STRING, :name => 'key'}
|
519
|
+
}
|
520
|
+
|
521
|
+
def struct_fields; FIELDS; end
|
522
|
+
|
523
|
+
def validate
|
524
|
+
end
|
525
|
+
|
526
|
+
::Thrift::Struct.generate_accessors self
|
527
|
+
end
|
528
|
+
|
529
|
+
class GetOption_result
|
530
|
+
include ::Thrift::Struct, ::Thrift::Struct_Union
|
531
|
+
SUCCESS = 0
|
532
|
+
|
533
|
+
FIELDS = {
|
534
|
+
SUCCESS => {:type => ::Thrift::Types::STRING, :name => 'success'}
|
535
|
+
}
|
536
|
+
|
537
|
+
def struct_fields; FIELDS; end
|
538
|
+
|
539
|
+
def validate
|
540
|
+
end
|
541
|
+
|
542
|
+
::Thrift::Struct.generate_accessors self
|
543
|
+
end
|
544
|
+
|
545
|
+
class GetOptions_args
|
546
|
+
include ::Thrift::Struct, ::Thrift::Struct_Union
|
547
|
+
|
548
|
+
FIELDS = {
|
549
|
+
|
550
|
+
}
|
551
|
+
|
552
|
+
def struct_fields; FIELDS; end
|
553
|
+
|
554
|
+
def validate
|
555
|
+
end
|
556
|
+
|
557
|
+
::Thrift::Struct.generate_accessors self
|
558
|
+
end
|
559
|
+
|
560
|
+
class GetOptions_result
|
561
|
+
include ::Thrift::Struct, ::Thrift::Struct_Union
|
562
|
+
SUCCESS = 0
|
563
|
+
|
564
|
+
FIELDS = {
|
565
|
+
SUCCESS => {:type => ::Thrift::Types::MAP, :name => 'success', :key => {:type => ::Thrift::Types::STRING}, :value => {:type => ::Thrift::Types::STRING}}
|
566
|
+
}
|
567
|
+
|
568
|
+
def struct_fields; FIELDS; end
|
569
|
+
|
570
|
+
def validate
|
571
|
+
end
|
572
|
+
|
573
|
+
::Thrift::Struct.generate_accessors self
|
574
|
+
end
|
575
|
+
|
576
|
+
class GetCpuProfile_args
|
577
|
+
include ::Thrift::Struct, ::Thrift::Struct_Union
|
578
|
+
PROFILEDURATIONINSEC = 1
|
579
|
+
|
580
|
+
FIELDS = {
|
581
|
+
PROFILEDURATIONINSEC => {:type => ::Thrift::Types::I32, :name => 'profileDurationInSec'}
|
582
|
+
}
|
583
|
+
|
584
|
+
def struct_fields; FIELDS; end
|
585
|
+
|
586
|
+
def validate
|
587
|
+
end
|
588
|
+
|
589
|
+
::Thrift::Struct.generate_accessors self
|
590
|
+
end
|
591
|
+
|
592
|
+
class GetCpuProfile_result
|
593
|
+
include ::Thrift::Struct, ::Thrift::Struct_Union
|
594
|
+
SUCCESS = 0
|
595
|
+
|
596
|
+
FIELDS = {
|
597
|
+
SUCCESS => {:type => ::Thrift::Types::STRING, :name => 'success'}
|
598
|
+
}
|
599
|
+
|
600
|
+
def struct_fields; FIELDS; end
|
601
|
+
|
602
|
+
def validate
|
603
|
+
end
|
604
|
+
|
605
|
+
::Thrift::Struct.generate_accessors self
|
606
|
+
end
|
607
|
+
|
608
|
+
class AliveSince_args
|
609
|
+
include ::Thrift::Struct, ::Thrift::Struct_Union
|
610
|
+
|
611
|
+
FIELDS = {
|
612
|
+
|
613
|
+
}
|
614
|
+
|
615
|
+
def struct_fields; FIELDS; end
|
616
|
+
|
617
|
+
def validate
|
618
|
+
end
|
619
|
+
|
620
|
+
::Thrift::Struct.generate_accessors self
|
621
|
+
end
|
622
|
+
|
623
|
+
class AliveSince_result
|
624
|
+
include ::Thrift::Struct, ::Thrift::Struct_Union
|
625
|
+
SUCCESS = 0
|
626
|
+
|
627
|
+
FIELDS = {
|
628
|
+
SUCCESS => {:type => ::Thrift::Types::I64, :name => 'success'}
|
629
|
+
}
|
630
|
+
|
631
|
+
def struct_fields; FIELDS; end
|
632
|
+
|
633
|
+
def validate
|
634
|
+
end
|
635
|
+
|
636
|
+
::Thrift::Struct.generate_accessors self
|
637
|
+
end
|
638
|
+
|
639
|
+
class Reinitialize_args
|
640
|
+
include ::Thrift::Struct, ::Thrift::Struct_Union
|
641
|
+
|
642
|
+
FIELDS = {
|
643
|
+
|
644
|
+
}
|
645
|
+
|
646
|
+
def struct_fields; FIELDS; end
|
647
|
+
|
648
|
+
def validate
|
649
|
+
end
|
650
|
+
|
651
|
+
::Thrift::Struct.generate_accessors self
|
652
|
+
end
|
653
|
+
|
654
|
+
class Reinitialize_result
|
655
|
+
include ::Thrift::Struct, ::Thrift::Struct_Union
|
656
|
+
|
657
|
+
FIELDS = {
|
658
|
+
|
659
|
+
}
|
660
|
+
|
661
|
+
def struct_fields; FIELDS; end
|
662
|
+
|
663
|
+
def validate
|
664
|
+
end
|
665
|
+
|
666
|
+
::Thrift::Struct.generate_accessors self
|
667
|
+
end
|
668
|
+
|
669
|
+
class Shutdown_args
|
670
|
+
include ::Thrift::Struct, ::Thrift::Struct_Union
|
671
|
+
|
672
|
+
FIELDS = {
|
673
|
+
|
674
|
+
}
|
675
|
+
|
676
|
+
def struct_fields; FIELDS; end
|
677
|
+
|
678
|
+
def validate
|
679
|
+
end
|
680
|
+
|
681
|
+
::Thrift::Struct.generate_accessors self
|
682
|
+
end
|
683
|
+
|
684
|
+
class Shutdown_result
|
685
|
+
include ::Thrift::Struct, ::Thrift::Struct_Union
|
686
|
+
|
687
|
+
FIELDS = {
|
688
|
+
|
689
|
+
}
|
690
|
+
|
691
|
+
def struct_fields; FIELDS; end
|
692
|
+
|
693
|
+
def validate
|
694
|
+
end
|
695
|
+
|
696
|
+
::Thrift::Struct.generate_accessors self
|
697
|
+
end
|
698
|
+
|
699
|
+
end
|
700
|
+
|