msgpack-rpc 0.4.1 → 0.4.2
Sign up to get free protection for your applications and to get access to all the features.
- data/ChangeLog +4 -0
- data/lib/msgpack/rpc/exception.rb +4 -3
- data/lib/msgpack/rpc/version.rb +1 -1
- metadata +4 -5
- data/lib/msgpack/rpc/exception.rb.old +0 -303
data/ChangeLog
CHANGED
@@ -70,10 +70,12 @@ class RPCError < Error
|
|
70
70
|
|
71
71
|
def is?(code)
|
72
72
|
if code.is_a?(Class) && code < RPCError
|
73
|
+
if code == RemoteError
|
74
|
+
return @code[0] != ?.
|
75
|
+
end
|
73
76
|
code = code::CODE
|
74
77
|
end
|
75
|
-
@code == code || @code[0,code.length+1] == "#{code}."
|
76
|
-
(code == ".RemoteError" && @code[0] != ?.)
|
78
|
+
@code == code || @code[0,code.length+1] == "#{code}."
|
77
79
|
end
|
78
80
|
end
|
79
81
|
|
@@ -194,7 +196,6 @@ class RPCError
|
|
194
196
|
TransportError::CODE => TransportError,
|
195
197
|
CallError::CODE => CallError,
|
196
198
|
ServerError::CODE => ServerError,
|
197
|
-
RemoteError::CODE => RemoteError,
|
198
199
|
NetworkUnreachableError::CODE => NetworkUnreachableError,
|
199
200
|
ConnectionRefusedError::CODE => ConnectionRefusedError,
|
200
201
|
ConnectionTimeoutError::CODE => ConnectionTimeoutError,
|
data/lib/msgpack/rpc/version.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: msgpack-rpc
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 11
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 4
|
9
|
-
-
|
10
|
-
version: 0.4.
|
9
|
+
- 2
|
10
|
+
version: 0.4.2
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- FURUHASHI Sadayuki
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-08-
|
18
|
+
date: 2010-08-28 00:00:00 +09:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -68,7 +68,6 @@ files:
|
|
68
68
|
- lib/msgpack/rpc/client.rb
|
69
69
|
- lib/msgpack/rpc/dispatcher.rb
|
70
70
|
- lib/msgpack/rpc/exception.rb
|
71
|
-
- lib/msgpack/rpc/exception.rb.old
|
72
71
|
- lib/msgpack/rpc/future.rb
|
73
72
|
- lib/msgpack/rpc/loop.rb
|
74
73
|
- lib/msgpack/rpc/message.rb
|
@@ -1,303 +0,0 @@
|
|
1
|
-
#
|
2
|
-
# MessagePack-RPC for Ruby
|
3
|
-
#
|
4
|
-
# Copyright (C) 2010 FURUHASHI Sadayuki
|
5
|
-
#
|
6
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
7
|
-
# you may not use this file except in compliance with the License.
|
8
|
-
# You may obtain a copy of the License at
|
9
|
-
#
|
10
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
11
|
-
#
|
12
|
-
# Unless required by applicable law or agreed to in writing, software
|
13
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
14
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
15
|
-
# See the License for the specific language governing permissions and
|
16
|
-
# limitations under the License.
|
17
|
-
#
|
18
|
-
module MessagePack
|
19
|
-
module RPC
|
20
|
-
|
21
|
-
|
22
|
-
class Error < StandardError
|
23
|
-
end
|
24
|
-
|
25
|
-
class RPCError < Error
|
26
|
-
def initialize(msg)
|
27
|
-
super(msg)
|
28
|
-
end
|
29
|
-
end
|
30
|
-
|
31
|
-
class RemoteError < RPCError
|
32
|
-
def initialize(msg, result = nil)
|
33
|
-
super(msg)
|
34
|
-
@result = result
|
35
|
-
end
|
36
|
-
attr_reader :result
|
37
|
-
end
|
38
|
-
|
39
|
-
class TimeoutError < Error
|
40
|
-
def initialize(msg = "request timed out")
|
41
|
-
super
|
42
|
-
end
|
43
|
-
end
|
44
|
-
|
45
|
-
class ConnectError < TimeoutError
|
46
|
-
def initialize(msg = "connect failed")
|
47
|
-
super
|
48
|
-
end
|
49
|
-
end
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
##
|
54
|
-
## MessagePack-RPC Exception
|
55
|
-
##
|
56
|
-
#
|
57
|
-
# MessagePack-RPC Transport Layer
|
58
|
-
# [int, msgid, object, object] を転送する
|
59
|
-
# これを転送できない場合はTransportError
|
60
|
-
#
|
61
|
-
# メッセージ到達 1
|
62
|
-
# ハンドラ到達 2
|
63
|
-
# リトライ推奨 r
|
64
|
-
#
|
65
|
-
# RPCError
|
66
|
-
# |
|
67
|
-
# +-- TimeoutError : [?]
|
68
|
-
# |
|
69
|
-
# +-- TransportError : []
|
70
|
-
# | |
|
71
|
-
# | +-- NetworkUnreachableError
|
72
|
-
# | |
|
73
|
-
# | +-- ConnectionRefusedError
|
74
|
-
# | |
|
75
|
-
# | +-- ConnectionTimeoutError
|
76
|
-
# | |
|
77
|
-
# | +-- MalformedMessageError
|
78
|
-
# | |
|
79
|
-
# | +-- ConnectionClosedError
|
80
|
-
# |
|
81
|
-
# +-- CallError : [1]
|
82
|
-
# | |
|
83
|
-
# | +-- NoMethodError
|
84
|
-
# | |
|
85
|
-
# | +-- ArgumentError
|
86
|
-
# |
|
87
|
-
# +-- ServerError : [1, 2?, r]
|
88
|
-
# | |
|
89
|
-
# | +-- ServerBusyError
|
90
|
-
# | |
|
91
|
-
# | +-- GatewayError
|
92
|
-
# | |
|
93
|
-
# | +-- GatewayTimeoutError
|
94
|
-
# |
|
95
|
-
# +-- RemoteError : [1, 2]
|
96
|
-
# |
|
97
|
-
# +-- RemoteRuntimeError
|
98
|
-
# |
|
99
|
-
# +-- (user-defined errors)
|
100
|
-
#
|
101
|
-
##
|
102
|
-
## MessagePack-RPC Exception
|
103
|
-
##
|
104
|
-
#
|
105
|
-
# RPCError
|
106
|
-
# |
|
107
|
-
# +-- TimeoutError : 到達=不明 リトライ=アプリ判断
|
108
|
-
# |
|
109
|
-
# +-- TransportError : 到達=していない リトライ=非推奨
|
110
|
-
# | |
|
111
|
-
# | +-- NetworkUnreachableError
|
112
|
-
# | |
|
113
|
-
# | +-- ConnectionRefusedError
|
114
|
-
# | |
|
115
|
-
# | +-- ConnectionTimeoutError
|
116
|
-
# |
|
117
|
-
# +-- SessionError : 到達=した リトライ=非推奨
|
118
|
-
# | |
|
119
|
-
# | +-- MessageRefusedError
|
120
|
-
# | | |
|
121
|
-
# | | +-- MessageTooLargeError
|
122
|
-
# | |
|
123
|
-
# | +-- NoMethodError
|
124
|
-
# | |
|
125
|
-
# | +-- ArgumentError
|
126
|
-
# |
|
127
|
-
# +-- ServerError : 到達=した リトライ=推奨
|
128
|
-
# | |
|
129
|
-
# | +-- ServerBusyError
|
130
|
-
# |
|
131
|
-
# +-- RemoteError
|
132
|
-
# |
|
133
|
-
# +-- RemoteRuntimeError
|
134
|
-
# |
|
135
|
-
# +-- (user-defined errors)
|
136
|
-
#
|
137
|
-
#
|
138
|
-
##
|
139
|
-
## MessagePack-RPC Exception
|
140
|
-
##
|
141
|
-
#
|
142
|
-
# RPCError
|
143
|
-
# |
|
144
|
-
# +-- TimeoutError
|
145
|
-
# |
|
146
|
-
# +-- ClientError
|
147
|
-
# | |
|
148
|
-
# | +-- TransportError
|
149
|
-
# | | |
|
150
|
-
# | | +-- NetworkUnreachableError
|
151
|
-
# | | |
|
152
|
-
# | | +-- ConnectionRefusedError
|
153
|
-
# | | |
|
154
|
-
# | | +-- ConnectionTimeoutError
|
155
|
-
# | | |
|
156
|
-
# | | +-- MessageTooLargeError
|
157
|
-
# | |
|
158
|
-
# | +-- SessionError
|
159
|
-
# | |
|
160
|
-
# | +-- NoMethodError
|
161
|
-
# | |
|
162
|
-
# | +-- ArgumentError
|
163
|
-
# |
|
164
|
-
# +-- ServerError
|
165
|
-
# | |
|
166
|
-
# | +-- ServerBusyError
|
167
|
-
# |
|
168
|
-
# +-- RemoteError
|
169
|
-
# |
|
170
|
-
# +-- (Remote)RuntimeError
|
171
|
-
# |
|
172
|
-
# +-- (user-defined errors)
|
173
|
-
#
|
174
|
-
|
175
|
-
=begin
|
176
|
-
class Error < StandardError
|
177
|
-
end
|
178
|
-
|
179
|
-
class RPCError < Error
|
180
|
-
def initialize(msg, code)
|
181
|
-
super(msg)
|
182
|
-
@code = code
|
183
|
-
end
|
184
|
-
attr_reader :code
|
185
|
-
end
|
186
|
-
|
187
|
-
|
188
|
-
class TimeoutError < RPCError
|
189
|
-
CODE = ".TimeoutError"
|
190
|
-
def initialize(msg = "request timed out")
|
191
|
-
super(msg, CODE)
|
192
|
-
end
|
193
|
-
end
|
194
|
-
|
195
|
-
|
196
|
-
class ClientError < RPCError
|
197
|
-
CODE = ".ClientError"
|
198
|
-
def initialize(msg, code)
|
199
|
-
super(msg, code)
|
200
|
-
end
|
201
|
-
end
|
202
|
-
|
203
|
-
|
204
|
-
class TransportError < ClientError
|
205
|
-
CODE = ".TransportError"
|
206
|
-
def initialize(msg, code = CODE)
|
207
|
-
super(msg, CODE)
|
208
|
-
end
|
209
|
-
end
|
210
|
-
|
211
|
-
class NetworkUnreachableError < TransportError
|
212
|
-
CODE = ".NetworkUnreachableError"
|
213
|
-
def initialize(msg = "network unreachable")
|
214
|
-
super(msg, CODE)
|
215
|
-
end
|
216
|
-
end
|
217
|
-
|
218
|
-
class ConnectionRefusedError < TransportError
|
219
|
-
CODE = -52
|
220
|
-
def initialize(msg = "connection refused")
|
221
|
-
super(msg, CODE)
|
222
|
-
end
|
223
|
-
end
|
224
|
-
|
225
|
-
class ConnectionTimeoutError < TransportError
|
226
|
-
CODE = -53
|
227
|
-
def initialize(msg = "connection timed out")
|
228
|
-
super(msg, CODE)
|
229
|
-
end
|
230
|
-
end
|
231
|
-
|
232
|
-
|
233
|
-
class MessageRefusedError < ClientError
|
234
|
-
CODE = -40
|
235
|
-
def initialize(msg = "broken message", code = CODE)
|
236
|
-
super(msg, code)
|
237
|
-
end
|
238
|
-
end
|
239
|
-
|
240
|
-
class MessageTooLargeError < MessageRefusedError
|
241
|
-
CODE = -41
|
242
|
-
def initialize(msg = "messge too large")
|
243
|
-
super(msg, CODE)
|
244
|
-
end
|
245
|
-
end
|
246
|
-
|
247
|
-
|
248
|
-
class CallError < ClientError
|
249
|
-
CODE = -20
|
250
|
-
def initialize(msg, code = CODE)
|
251
|
-
super(msg, code)
|
252
|
-
end
|
253
|
-
end
|
254
|
-
|
255
|
-
class NoMethodError < CallError
|
256
|
-
CODE = -21
|
257
|
-
def initialize(msg = "method not found")
|
258
|
-
super(msg, CODE)
|
259
|
-
end
|
260
|
-
end
|
261
|
-
|
262
|
-
class ArgumentError < NoMethodError
|
263
|
-
CODE = -22
|
264
|
-
def initialize(msg = "invalid argument")
|
265
|
-
super(msg, CODE)
|
266
|
-
end
|
267
|
-
end
|
268
|
-
|
269
|
-
|
270
|
-
class ServerError < RPCError
|
271
|
-
CODE = -30
|
272
|
-
def initialize(msg, code = CODE)
|
273
|
-
super(msg, code)
|
274
|
-
end
|
275
|
-
end
|
276
|
-
|
277
|
-
class ServerBusyError < ServerError
|
278
|
-
CODE = -31
|
279
|
-
def initialize(msg = "server temporally busy")
|
280
|
-
super(msg, CODE)
|
281
|
-
end
|
282
|
-
end
|
283
|
-
|
284
|
-
|
285
|
-
class RemoteError < RPCError
|
286
|
-
def initialize(msg, code, result = nil)
|
287
|
-
super(msg, code)
|
288
|
-
@result = result
|
289
|
-
end
|
290
|
-
attr_reader :result
|
291
|
-
end
|
292
|
-
|
293
|
-
class RemoteRuntimeError < RemoteRuntimeError
|
294
|
-
CODE = -10
|
295
|
-
def initialize(msg, result = nil)
|
296
|
-
super(msg, CODE, result)
|
297
|
-
end
|
298
|
-
end
|
299
|
-
=end
|
300
|
-
|
301
|
-
|
302
|
-
end
|
303
|
-
end
|