bosrvclient 0.1.1 → 0.1.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: eedce98fcce6e2bd1dd158f0e71df9958e82ac0f
4
- data.tar.gz: 961dfa20b4c530199758f63bcd770153b659ac6a
3
+ metadata.gz: 5d3a58316a483ff781612d134ad763c5bdc4483b
4
+ data.tar.gz: b63cd5904a254b1239f3087a6b846c8ea911f42b
5
5
  SHA512:
6
- metadata.gz: f14967dddba67f43eb98c6b26686a6d7fb402fc66f403c78b72f0f593df9dc88ea8663e169782cdd7945c1bff54b591417715195a61fa4d79db3757ebed7f5ed
7
- data.tar.gz: 6e7f99c3681c2d63cffc2968d4994814f04d4921a155d3155d2e543102c3911d71c6da8cfbb72ebc81bc3c9a9fb3caeb28bf645faf7a5591ee1998bba1bf5817
6
+ metadata.gz: cb0688e937d1e89552575501cf525481380e924e3cae20064b02f7d27be2a3f8fb78bc38eba39c69248240e69da21a79b634ef93be19ce7637000a0cd7cda88a
7
+ data.tar.gz: f7691086b8128cfd14493312e37fcea839e34b923c3d5880b73f8bbdea946584c83b175b524967c039806c8e77d428f5e52c2dd3accd3be82b9393104212f3ee
@@ -27,6 +27,23 @@ module Bosrv
27
27
  raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'ping failed: unknown result')
28
28
  end
29
29
 
30
+ def star_apply(token, srvname, cmd_stmt, autocommit)
31
+ send_star_apply(token, srvname, cmd_stmt, autocommit)
32
+ return recv_star_apply()
33
+ end
34
+
35
+ def send_star_apply(token, srvname, cmd_stmt, autocommit)
36
+ send_message('star_apply', Star_apply_args, :token => token, :srvname => srvname, :cmd_stmt => cmd_stmt, :autocommit => autocommit)
37
+ end
38
+
39
+ def recv_star_apply()
40
+ result = receive_message(Star_apply_result)
41
+ return result.success unless result.success.nil?
42
+ raise result.err unless result.err.nil?
43
+ raise result.arr unless result.arr.nil?
44
+ raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'star_apply failed: unknown result')
45
+ end
46
+
30
47
  def sql_begin(token)
31
48
  send_sql_begin(token)
32
49
  return recv_sql_begin()
@@ -224,6 +241,23 @@ module Bosrv
224
241
  raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'get_table_relation failed: unknown result')
225
242
  end
226
243
 
244
+ def get_table_create_stmt(token, resource, inmemory)
245
+ send_get_table_create_stmt(token, resource, inmemory)
246
+ return recv_get_table_create_stmt()
247
+ end
248
+
249
+ def send_get_table_create_stmt(token, resource, inmemory)
250
+ send_message('get_table_create_stmt', Get_table_create_stmt_args, :token => token, :resource => resource, :inmemory => inmemory)
251
+ end
252
+
253
+ def recv_get_table_create_stmt()
254
+ result = receive_message(Get_table_create_stmt_result)
255
+ return result.success unless result.success.nil?
256
+ raise result.err unless result.err.nil?
257
+ raise result.arr unless result.arr.nil?
258
+ raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'get_table_create_stmt failed: unknown result')
259
+ end
260
+
227
261
  def get_qbo_list(token, path)
228
262
  send_get_qbo_list(token, path)
229
263
  return recv_get_qbo_list()
@@ -304,6 +338,19 @@ module Bosrv
304
338
  write_result(result, oprot, 'ping', seqid)
305
339
  end
306
340
 
341
+ def process_star_apply(seqid, iprot, oprot)
342
+ args = read_args(iprot, Star_apply_args)
343
+ result = Star_apply_result.new()
344
+ begin
345
+ result.success = @handler.star_apply(args.token, args.srvname, args.cmd_stmt, args.autocommit)
346
+ rescue ::Exc::ServiceError => err
347
+ result.err = err
348
+ rescue ::Exc::AuthError => arr
349
+ result.arr = arr
350
+ end
351
+ write_result(result, oprot, 'star_apply', seqid)
352
+ end
353
+
307
354
  def process_sql_begin(seqid, iprot, oprot)
308
355
  args = read_args(iprot, Sql_begin_args)
309
356
  result = Sql_begin_result.new()
@@ -459,6 +506,19 @@ module Bosrv
459
506
  write_result(result, oprot, 'get_table_relation', seqid)
460
507
  end
461
508
 
509
+ def process_get_table_create_stmt(seqid, iprot, oprot)
510
+ args = read_args(iprot, Get_table_create_stmt_args)
511
+ result = Get_table_create_stmt_result.new()
512
+ begin
513
+ result.success = @handler.get_table_create_stmt(args.token, args.resource, args.inmemory)
514
+ rescue ::Exc::ServiceError => err
515
+ result.err = err
516
+ rescue ::Exc::AuthError => arr
517
+ result.arr = arr
518
+ end
519
+ write_result(result, oprot, 'get_table_create_stmt', seqid)
520
+ end
521
+
462
522
  def process_get_qbo_list(seqid, iprot, oprot)
463
523
  args = read_args(iprot, Get_qbo_list_args)
464
524
  result = Get_qbo_list_result.new()
@@ -546,6 +606,48 @@ module Bosrv
546
606
  ::Thrift::Struct.generate_accessors self
547
607
  end
548
608
 
609
+ class Star_apply_args
610
+ include ::Thrift::Struct, ::Thrift::Struct_Union
611
+ TOKEN = 1
612
+ SRVNAME = 2
613
+ CMD_STMT = 3
614
+ AUTOCOMMIT = 4
615
+
616
+ FIELDS = {
617
+ TOKEN => {:type => ::Thrift::Types::STRING, :name => 'token'},
618
+ SRVNAME => {:type => ::Thrift::Types::STRING, :name => 'srvname'},
619
+ CMD_STMT => {:type => ::Thrift::Types::STRING, :name => 'cmd_stmt'},
620
+ AUTOCOMMIT => {:type => ::Thrift::Types::BOOL, :name => 'autocommit'}
621
+ }
622
+
623
+ def struct_fields; FIELDS; end
624
+
625
+ def validate
626
+ end
627
+
628
+ ::Thrift::Struct.generate_accessors self
629
+ end
630
+
631
+ class Star_apply_result
632
+ include ::Thrift::Struct, ::Thrift::Struct_Union
633
+ SUCCESS = 0
634
+ ERR = 1
635
+ ARR = 2
636
+
637
+ FIELDS = {
638
+ SUCCESS => {:type => ::Thrift::Types::STRING, :name => 'success'},
639
+ ERR => {:type => ::Thrift::Types::STRUCT, :name => 'err', :class => ::Exc::ServiceError},
640
+ ARR => {:type => ::Thrift::Types::STRUCT, :name => 'arr', :class => ::Exc::AuthError}
641
+ }
642
+
643
+ def struct_fields; FIELDS; end
644
+
645
+ def validate
646
+ end
647
+
648
+ ::Thrift::Struct.generate_accessors self
649
+ end
650
+
549
651
  class Sql_begin_args
550
652
  include ::Thrift::Struct, ::Thrift::Struct_Union
551
653
  TOKEN = 1
@@ -1017,6 +1119,46 @@ module Bosrv
1017
1119
  ::Thrift::Struct.generate_accessors self
1018
1120
  end
1019
1121
 
1122
+ class Get_table_create_stmt_args
1123
+ include ::Thrift::Struct, ::Thrift::Struct_Union
1124
+ TOKEN = 1
1125
+ RESOURCE = 2
1126
+ INMEMORY = 3
1127
+
1128
+ FIELDS = {
1129
+ TOKEN => {:type => ::Thrift::Types::STRING, :name => 'token'},
1130
+ RESOURCE => {:type => ::Thrift::Types::STRING, :name => 'resource'},
1131
+ INMEMORY => {:type => ::Thrift::Types::BOOL, :name => 'inmemory'}
1132
+ }
1133
+
1134
+ def struct_fields; FIELDS; end
1135
+
1136
+ def validate
1137
+ end
1138
+
1139
+ ::Thrift::Struct.generate_accessors self
1140
+ end
1141
+
1142
+ class Get_table_create_stmt_result
1143
+ include ::Thrift::Struct, ::Thrift::Struct_Union
1144
+ SUCCESS = 0
1145
+ ERR = 1
1146
+ ARR = 2
1147
+
1148
+ FIELDS = {
1149
+ SUCCESS => {:type => ::Thrift::Types::STRING, :name => 'success'},
1150
+ ERR => {:type => ::Thrift::Types::STRUCT, :name => 'err', :class => ::Exc::ServiceError},
1151
+ ARR => {:type => ::Thrift::Types::STRUCT, :name => 'arr', :class => ::Exc::AuthError}
1152
+ }
1153
+
1154
+ def struct_fields; FIELDS; end
1155
+
1156
+ def validate
1157
+ end
1158
+
1159
+ ::Thrift::Struct.generate_accessors self
1160
+ end
1161
+
1020
1162
  class Get_qbo_list_args
1021
1163
  include ::Thrift::Struct, ::Thrift::Struct_Union
1022
1164
  TOKEN = 1
@@ -1,16 +1,25 @@
1
+ require 'openssl'
1
2
  require 'thrift'
2
3
  require_relative 'big_object_service'
4
+ require 'uri'
3
5
 
4
6
  module Bosrv
5
- def Bosrv.connect(addr_info, timeout=nil)
6
- transport = Thrift::BufferedTransport.new(
7
- Thrift::Socket.new(*addr_info)
7
+ def Bosrv.connect(addr_info, secure=false, timeout=nil)
8
+ uri = URI(addr_info)
9
+ builder = secure ? URI::HTTPS : URI::HTTP
10
+ token = uri.password
11
+ transport = Thrift::HTTPClientTransport.new(
12
+ builder.build({
13
+ :host => uri.host,
14
+ :port => uri.port
15
+ }),
16
+ { :ssl_verify_mode => OpenSSL::SSL::VERIFY_NONE }
8
17
  )
9
- protocol = Thrift::BinaryProtocol.new(transport)
18
+ protocol = Thrift::JsonProtocol.new(transport)
10
19
  client = Bosrv::BigObjectService::Client.new(protocol)
11
20
  transport.open()
12
- yield client
21
+ yield [token, client]
13
22
  ensure
14
- transport.close()
23
+ #transport.close()
15
24
  end
16
25
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bosrvclient
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeffrey Jen