idservice_client 0.0.1

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.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 0689408a70bda648709ea7e135d75a91ad3d21cd
4
+ data.tar.gz: 6115b8a08c962287c2f5cc8f2a4f34b0a6b424cc
5
+ SHA512:
6
+ metadata.gz: c600d19f35814c0459b01bd04627d9354b8281907e5a96721f89b3206733b1f7e1ff51766f6417c83bfaa79ebd7c3391ba8400890c02e4f332b329bab1582bd7
7
+ data.tar.gz: df0ab07fae263b50c8852b13f858a01cb17ab3d1dcd146f20f387f6453c885cfc679eff47ad97f89684163ddf57b74a22a0432394723904b13cfae9f2a5047e3
data/Gemfile ADDED
@@ -0,0 +1,5 @@
1
+ source 'https://rubygems.org'
2
+ source 'http://192.168.3.220:9292/'
3
+
4
+ # Specify your gem's dependencies in stat-count-client.gemspec
5
+ gemspec
@@ -0,0 +1,19 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ idservice_client (0.0.1)
5
+
6
+ GEM
7
+ remote: https://rubygems.org/
8
+ remote: http://192.168.3.220:9292/
9
+ specs:
10
+ thrift (0.9.1)
11
+ thrift-client (0.0.7)
12
+ thrift (~> 0.9.0)
13
+
14
+ PLATFORMS
15
+ ruby
16
+
17
+ DEPENDENCIES
18
+ idservice_client!
19
+ thrift-client
data/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2012 TODO: Write your name
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,29 @@
1
+ # Stat::Count::Client
2
+
3
+ TODO: Write a gem description
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ gem 'stat-count-client'
10
+
11
+ And then execute:
12
+
13
+ $ bundle
14
+
15
+ Or install it yourself as:
16
+
17
+ $ gem install stat-count-client
18
+
19
+ ## Usage
20
+
21
+ TODO: Write usage instructions here
22
+
23
+ ## Contributing
24
+
25
+ 1. Fork it
26
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
27
+ 3. Commit your changes (`git commit -am 'Added some feature'`)
28
+ 4. Push to the branch (`git push origin my-new-feature`)
29
+ 5. Create new Pull Request
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env rake
2
+ require "bundler/gem_tasks"
@@ -0,0 +1 @@
1
+ thrift -out /workspaces/ruby/idservice-client/lib --gen rb /workspaces/ruby/idservice-client/doc/idservice.thrift
@@ -0,0 +1,43 @@
1
+ namespace java com.nali.center.thrift
2
+ namespace rb center.thrift
3
+
4
+ exception InvalidAppNameRuntimeException {
5
+ 1: string message
6
+ }
7
+
8
+ service IIdentityService {
9
+
10
+ /**
11
+ * 获取制定应用当前的最新ID。
12
+ *
13
+ * @param appName
14
+ * 应用名称。
15
+ * @return 当前应用的最新ID。
16
+ * @throws InvalidAppNameException
17
+ * 应用name不合法异常
18
+ */
19
+ i64 getNextId(1:string appName) throws (1:InvalidAppNameRuntimeException ianrex),
20
+
21
+ /**
22
+ * 获取多个应用的ID
23
+ *
24
+ * @param appNameCntMap
25
+ * 键值对,key:appName,value:生成的ID数
26
+ *
27
+ * @return 键值对,key:appName,value:id列表
28
+ * @throws InvalidAppNameException
29
+ */
30
+ map<string, list<i64>> getMultiNextId(1:map<string, i32> appNameCntMap) throws (1:InvalidAppNameRuntimeException ianrex),
31
+
32
+ /**
33
+ * 获取制定应用当前的最新多个ID
34
+ *
35
+ * @param appName
36
+ * 应用名称。
37
+ * @param count
38
+ * 数量
39
+ * @return ID的列表
40
+ * @throws InvalidAppNameException
41
+ */
42
+ list<i64> getNextIds(1:string appName, 2:i32 count) throws (1:InvalidAppNameRuntimeException ianrex)
43
+ }
@@ -0,0 +1,213 @@
1
+ #
2
+ # Autogenerated by Thrift Compiler (0.9.0)
3
+ #
4
+ # DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
5
+ #
6
+
7
+ require 'thrift'
8
+ require 'idservice_types'
9
+
10
+ module Center
11
+ module Thrift
12
+ module IIdentityService
13
+ class Client
14
+ include ::Thrift::Client
15
+
16
+ def getNextId(appName)
17
+ send_getNextId(appName)
18
+ return recv_getNextId()
19
+ end
20
+
21
+ def send_getNextId(appName)
22
+ send_message('getNextId', GetNextId_args, :appName => appName)
23
+ end
24
+
25
+ def recv_getNextId()
26
+ result = receive_message(GetNextId_result)
27
+ return result.success unless result.success.nil?
28
+ raise result.ianrex unless result.ianrex.nil?
29
+ raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'getNextId failed: unknown result')
30
+ end
31
+
32
+ def getMultiNextId(appNameCntMap)
33
+ send_getMultiNextId(appNameCntMap)
34
+ return recv_getMultiNextId()
35
+ end
36
+
37
+ def send_getMultiNextId(appNameCntMap)
38
+ send_message('getMultiNextId', GetMultiNextId_args, :appNameCntMap => appNameCntMap)
39
+ end
40
+
41
+ def recv_getMultiNextId()
42
+ result = receive_message(GetMultiNextId_result)
43
+ return result.success unless result.success.nil?
44
+ raise result.ianrex unless result.ianrex.nil?
45
+ raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'getMultiNextId failed: unknown result')
46
+ end
47
+
48
+ def getNextIds(appName, count)
49
+ send_getNextIds(appName, count)
50
+ return recv_getNextIds()
51
+ end
52
+
53
+ def send_getNextIds(appName, count)
54
+ send_message('getNextIds', GetNextIds_args, :appName => appName, :count => count)
55
+ end
56
+
57
+ def recv_getNextIds()
58
+ result = receive_message(GetNextIds_result)
59
+ return result.success unless result.success.nil?
60
+ raise result.ianrex unless result.ianrex.nil?
61
+ raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'getNextIds failed: unknown result')
62
+ end
63
+
64
+ end
65
+
66
+ class Processor
67
+ include ::Thrift::Processor
68
+
69
+ def process_getNextId(seqid, iprot, oprot)
70
+ args = read_args(iprot, GetNextId_args)
71
+ result = GetNextId_result.new()
72
+ begin
73
+ result.success = @handler.getNextId(args.appName)
74
+ rescue ::Center::Thrift::InvalidAppNameRuntimeException => ianrex
75
+ result.ianrex = ianrex
76
+ end
77
+ write_result(result, oprot, 'getNextId', seqid)
78
+ end
79
+
80
+ def process_getMultiNextId(seqid, iprot, oprot)
81
+ args = read_args(iprot, GetMultiNextId_args)
82
+ result = GetMultiNextId_result.new()
83
+ begin
84
+ result.success = @handler.getMultiNextId(args.appNameCntMap)
85
+ rescue ::Center::Thrift::InvalidAppNameRuntimeException => ianrex
86
+ result.ianrex = ianrex
87
+ end
88
+ write_result(result, oprot, 'getMultiNextId', seqid)
89
+ end
90
+
91
+ def process_getNextIds(seqid, iprot, oprot)
92
+ args = read_args(iprot, GetNextIds_args)
93
+ result = GetNextIds_result.new()
94
+ begin
95
+ result.success = @handler.getNextIds(args.appName, args.count)
96
+ rescue ::Center::Thrift::InvalidAppNameRuntimeException => ianrex
97
+ result.ianrex = ianrex
98
+ end
99
+ write_result(result, oprot, 'getNextIds', seqid)
100
+ end
101
+
102
+ end
103
+
104
+ # HELPER FUNCTIONS AND STRUCTURES
105
+
106
+ class GetNextId_args
107
+ include ::Thrift::Struct, ::Thrift::Struct_Union
108
+ APPNAME = 1
109
+
110
+ FIELDS = {
111
+ APPNAME => {:type => ::Thrift::Types::STRING, :name => 'appName'}
112
+ }
113
+
114
+ def struct_fields; FIELDS; end
115
+
116
+ def validate
117
+ end
118
+
119
+ ::Thrift::Struct.generate_accessors self
120
+ end
121
+
122
+ class GetNextId_result
123
+ include ::Thrift::Struct, ::Thrift::Struct_Union
124
+ SUCCESS = 0
125
+ IANREX = 1
126
+
127
+ FIELDS = {
128
+ SUCCESS => {:type => ::Thrift::Types::I64, :name => 'success'},
129
+ IANREX => {:type => ::Thrift::Types::STRUCT, :name => 'ianrex', :class => ::Center::Thrift::InvalidAppNameRuntimeException}
130
+ }
131
+
132
+ def struct_fields; FIELDS; end
133
+
134
+ def validate
135
+ end
136
+
137
+ ::Thrift::Struct.generate_accessors self
138
+ end
139
+
140
+ class GetMultiNextId_args
141
+ include ::Thrift::Struct, ::Thrift::Struct_Union
142
+ APPNAMECNTMAP = 1
143
+
144
+ FIELDS = {
145
+ APPNAMECNTMAP => {:type => ::Thrift::Types::MAP, :name => 'appNameCntMap', :key => {:type => ::Thrift::Types::STRING}, :value => {:type => ::Thrift::Types::I32}}
146
+ }
147
+
148
+ def struct_fields; FIELDS; end
149
+
150
+ def validate
151
+ end
152
+
153
+ ::Thrift::Struct.generate_accessors self
154
+ end
155
+
156
+ class GetMultiNextId_result
157
+ include ::Thrift::Struct, ::Thrift::Struct_Union
158
+ SUCCESS = 0
159
+ IANREX = 1
160
+
161
+ FIELDS = {
162
+ SUCCESS => {:type => ::Thrift::Types::MAP, :name => 'success', :key => {:type => ::Thrift::Types::STRING}, :value => {:type => ::Thrift::Types::LIST, :element => {:type => ::Thrift::Types::I64}}},
163
+ IANREX => {:type => ::Thrift::Types::STRUCT, :name => 'ianrex', :class => ::Center::Thrift::InvalidAppNameRuntimeException}
164
+ }
165
+
166
+ def struct_fields; FIELDS; end
167
+
168
+ def validate
169
+ end
170
+
171
+ ::Thrift::Struct.generate_accessors self
172
+ end
173
+
174
+ class GetNextIds_args
175
+ include ::Thrift::Struct, ::Thrift::Struct_Union
176
+ APPNAME = 1
177
+ COUNT = 2
178
+
179
+ FIELDS = {
180
+ APPNAME => {:type => ::Thrift::Types::STRING, :name => 'appName'},
181
+ COUNT => {:type => ::Thrift::Types::I32, :name => 'count'}
182
+ }
183
+
184
+ def struct_fields; FIELDS; end
185
+
186
+ def validate
187
+ end
188
+
189
+ ::Thrift::Struct.generate_accessors self
190
+ end
191
+
192
+ class GetNextIds_result
193
+ include ::Thrift::Struct, ::Thrift::Struct_Union
194
+ SUCCESS = 0
195
+ IANREX = 1
196
+
197
+ FIELDS = {
198
+ SUCCESS => {:type => ::Thrift::Types::LIST, :name => 'success', :element => {:type => ::Thrift::Types::I64}},
199
+ IANREX => {:type => ::Thrift::Types::STRUCT, :name => 'ianrex', :class => ::Center::Thrift::InvalidAppNameRuntimeException}
200
+ }
201
+
202
+ def struct_fields; FIELDS; end
203
+
204
+ def validate
205
+ end
206
+
207
+ ::Thrift::Struct.generate_accessors self
208
+ end
209
+
210
+ end
211
+
212
+ end
213
+ end
@@ -0,0 +1,6 @@
1
+ #encoding: UTF-8
2
+
3
+ require "idservice_client/version"
4
+ require "idservice_types"
5
+ require "i_identity_service"
6
+ require "idservice_constants"
@@ -0,0 +1,5 @@
1
+ module IdService
2
+ module Client
3
+ VERSION = "0.0.1"
4
+ end
5
+ end
@@ -0,0 +1,13 @@
1
+ #
2
+ # Autogenerated by Thrift Compiler (0.9.0)
3
+ #
4
+ # DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
5
+ #
6
+
7
+ require 'thrift'
8
+ require 'idservice_types'
9
+
10
+ module Center
11
+ module Thrift
12
+ end
13
+ end
@@ -0,0 +1,33 @@
1
+ #
2
+ # Autogenerated by Thrift Compiler (0.9.0)
3
+ #
4
+ # DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
5
+ #
6
+
7
+ require 'thrift'
8
+
9
+ module Center
10
+ module Thrift
11
+ class InvalidAppNameRuntimeException < ::Thrift::Exception
12
+ include ::Thrift::Struct, ::Thrift::Struct_Union
13
+ def initialize(message=nil)
14
+ super()
15
+ self.message = message
16
+ end
17
+
18
+ MESSAGE = 1
19
+
20
+ FIELDS = {
21
+ MESSAGE => {:type => ::Thrift::Types::STRING, :name => 'message'}
22
+ }
23
+
24
+ def struct_fields; FIELDS; end
25
+
26
+ def validate
27
+ end
28
+
29
+ ::Thrift::Struct.generate_accessors self
30
+ end
31
+
32
+ end
33
+ end
@@ -0,0 +1,28 @@
1
+ #encoding: UTF-8
2
+
3
+ $:.unshift File.join(File.dirname(__FILE__),"..","lib")
4
+ $:.unshift File.join(File.dirname(__FILE__),"..")
5
+
6
+ require "rubygems"
7
+ require "idservice_client"
8
+ require "thrift_client"
9
+ require "test/unit"
10
+
11
+ class TC_IdServiceClientTest < Test::Unit::TestCase
12
+ # Called before every test method runs. Can be used
13
+ # to set up fixture information.
14
+ def setup
15
+ @client = ThriftClient.new({"servers" => "192.168.3.161:9097", "client_class" => "Center::Thrift::IIdentityService::Client"});
16
+ end
17
+
18
+ # Called after every test method runs. Can be used to tear
19
+ # down fixture information.
20
+
21
+ def teardown
22
+ # Do nothing
23
+ end
24
+
25
+ def test_getId()
26
+ partResult=@client.getNextId("ting.tb_feed");
27
+ end
28
+ end
metadata ADDED
@@ -0,0 +1,73 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: idservice_client
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - gavin
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2013-09-17 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: thrift-client
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - '>='
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - '>='
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ description: ruby thrift client for identity service
28
+ email:
29
+ - gavin@ximalya.com
30
+ executables: []
31
+ extensions: []
32
+ extra_rdoc_files: []
33
+ files:
34
+ - Gemfile
35
+ - Gemfile.lock
36
+ - LICENSE
37
+ - Rakefile
38
+ - README.md
39
+ - test/thrift_idservice_client_test.rb
40
+ - lib/i_identity_service.rb
41
+ - lib/idservice_client/version.rb
42
+ - lib/idservice_client.rb
43
+ - lib/idservice_constants.rb
44
+ - lib/idservice_types.rb
45
+ - doc/gen.txt
46
+ - doc/idservice.thrift
47
+ homepage: http://www.ximalaya.com
48
+ licenses: []
49
+ metadata: {}
50
+ post_install_message:
51
+ rdoc_options: []
52
+ require_paths:
53
+ - lib
54
+ - test
55
+ required_ruby_version: !ruby/object:Gem::Requirement
56
+ requirements:
57
+ - - '>='
58
+ - !ruby/object:Gem::Version
59
+ version: '0'
60
+ required_rubygems_version: !ruby/object:Gem::Requirement
61
+ requirements:
62
+ - - '>='
63
+ - !ruby/object:Gem::Version
64
+ version: '0'
65
+ requirements: []
66
+ rubyforge_project:
67
+ rubygems_version: 2.0.3
68
+ signing_key:
69
+ specification_version: 4
70
+ summary: idservice client
71
+ test_files:
72
+ - test/thrift_idservice_client_test.rb
73
+ has_rdoc: