protobuf-rpc-register 0.13.0 → 0.16.0
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 +4 -4
- data/lib/protobuf/rpc/clients/base.rb +8 -8
- data/lib/protobuf/rpc/interactions/base.rb +0 -2
- data/lib/protobuf/rpc/register/version.rb +1 -1
- data/lib/protobuf/rpc/register.rb +3 -0
- data/lib/protobuf/rpc/serializer.rb +4 -4
- data/lib/protobuf/rpc/services/base.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 4bc0f91ec8ea5ee657d4af4f06265376d1f1b763
|
|
4
|
+
data.tar.gz: 530cd29b6136e0e0fcc905d2368778a2670a31b5
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 426b92a8e4331358d4e3f5ad0413cca9445ec1cb77f941a093a7fa75bbb97ae0161c47ccd9d4199be925a8bca9156895f8fcd8a7f5d03a9b5c43e186a28aac9d
|
|
7
|
+
data.tar.gz: c21f5b37bff9a820518907d6c47ff25084fec9991e8399e29cce476c205bbd7ee05011e5bca32b40b3261fc0c0791572d8de00c51f03c5bd878919c780cffdcb
|
|
@@ -26,9 +26,9 @@ module Protobuf
|
|
|
26
26
|
def send_rpc_request(method, msg, serializer:)
|
|
27
27
|
res = nil
|
|
28
28
|
|
|
29
|
-
internal_client.send(method, Serializer.dump(msg, serializer: serializer)) do |c|
|
|
29
|
+
internal_client.send(method, ::Protobuf::Rpc::Serializer.dump(msg, serializer: serializer)) do |c|
|
|
30
30
|
c.on_success do |rpc_compressed_message|
|
|
31
|
-
res = Protobuf::Rpc::Serializer.load(rpc_compressed_message)
|
|
31
|
+
res = ::Protobuf::Rpc::Serializer.load(rpc_compressed_message)
|
|
32
32
|
end
|
|
33
33
|
|
|
34
34
|
c.on_failure do |error|
|
|
@@ -41,14 +41,14 @@ module Protobuf
|
|
|
41
41
|
|
|
42
42
|
def check_response_error(res, raise_error: true)
|
|
43
43
|
case res
|
|
44
|
-
when Protobuf::Rpc::Messages::Error
|
|
44
|
+
when ::Protobuf::Rpc::Messages::Error
|
|
45
45
|
error_class = self.class.mutex.synchronize { define_error_class(res) }
|
|
46
46
|
error = error_class.new(res.error_message)
|
|
47
47
|
error.set_backtrace(res.error_backtrace)
|
|
48
48
|
raise_error(error, raise_error)
|
|
49
|
-
when Protobuf::Error, Protobuf::Rpc::ClientError
|
|
50
|
-
error_reason = Protobuf::Socketrpc::ErrorReason.name_for_tag(res.code).to_s.downcase
|
|
51
|
-
error_class = Protobuf::Rpc.const_get(error_reason.camelize)
|
|
49
|
+
when ::Protobuf::Error, ::Protobuf::Rpc::ClientError
|
|
50
|
+
error_reason = ::Protobuf::Socketrpc::ErrorReason.name_for_tag(res.code).to_s.downcase
|
|
51
|
+
error_class = ::Protobuf::Rpc.const_get(error_reason.camelize)
|
|
52
52
|
error = error_class.new(res.message)
|
|
53
53
|
raise_error(error, raise_error)
|
|
54
54
|
else
|
|
@@ -109,13 +109,13 @@ module Protobuf
|
|
|
109
109
|
names = self.class.name.split('::')
|
|
110
110
|
msg_class_name = [names[0..-3], 'Messages', names[-1]].flatten.join('::')
|
|
111
111
|
|
|
112
|
-
msg = if args.first.is_a?(Protobuf::Message)
|
|
112
|
+
msg = if args.first.is_a?(::Protobuf::Message)
|
|
113
113
|
args.shift
|
|
114
114
|
elsif Object.const_defined?(msg_class_name, false)
|
|
115
115
|
msg_class = Object.const_get(msg_class_name)
|
|
116
116
|
msg_class.new(*args)
|
|
117
117
|
elsif args.first.respond_to?(:to_hash)
|
|
118
|
-
Messages::RpcCompressedMessage.new(response_body: args.first.to_hash.to_json,
|
|
118
|
+
::Protobuf::Rpc::Messages::RpcCompressedMessage.new(response_body: args.first.to_hash.to_json,
|
|
119
119
|
serializer: :JSON,
|
|
120
120
|
compressed: false)
|
|
121
121
|
else
|
|
@@ -25,8 +25,6 @@ module Protobuf
|
|
|
25
25
|
super
|
|
26
26
|
require 'new_relic/agent'
|
|
27
27
|
subclass.include ::NewRelic::Agent::Instrumentation::ControllerInstrumentation
|
|
28
|
-
subclass.include ::NewRelic::Agent::MethodTracer
|
|
29
|
-
subclass.add_method_tracer :run
|
|
30
28
|
subclass.add_transaction_tracer :run
|
|
31
29
|
end
|
|
32
30
|
end
|
|
@@ -2,15 +2,15 @@ module Protobuf
|
|
|
2
2
|
module Rpc
|
|
3
3
|
class Serializer
|
|
4
4
|
def self.dump(msg, serializer:)
|
|
5
|
-
return msg if msg.is_a?(Messages::RpcCompressedMessage)
|
|
6
|
-
dumped_message = Messages::RpcCompressedMessage.new(compressed: false)
|
|
5
|
+
return msg if msg.is_a?(::Protobuf::Rpc::Messages::RpcCompressedMessage)
|
|
6
|
+
dumped_message = ::Protobuf::Rpc::Messages::RpcCompressedMessage.new(compressed: false)
|
|
7
7
|
|
|
8
8
|
# serialize the message
|
|
9
9
|
case msg
|
|
10
10
|
when ::Protobuf::Message
|
|
11
11
|
proto(dumped_message, msg)
|
|
12
12
|
when StandardError
|
|
13
|
-
error = Messages::Error.new(error_class: msg.class.name,
|
|
13
|
+
error = ::Protobuf::Rpc::Messages::Error.new(error_class: msg.class.name,
|
|
14
14
|
error_message: msg.message,
|
|
15
15
|
error_backtrace: msg.backtrace)
|
|
16
16
|
proto(dumped_message, error)
|
|
@@ -45,7 +45,7 @@ module Protobuf
|
|
|
45
45
|
end
|
|
46
46
|
|
|
47
47
|
def self.load(msg)
|
|
48
|
-
return msg unless msg.is_a?(Messages::RpcCompressedMessage)
|
|
48
|
+
return msg unless msg.is_a?(::Protobuf::Rpc::Messages::RpcCompressedMessage)
|
|
49
49
|
body = msg.compressed ? ActiveSupport::Gzip.decompress(msg.response_body) : msg.response_body
|
|
50
50
|
|
|
51
51
|
if msg.response_type.present?
|
|
@@ -48,7 +48,7 @@ module Protobuf
|
|
|
48
48
|
begin
|
|
49
49
|
result = interaction.run!(req.to_hash)
|
|
50
50
|
case result
|
|
51
|
-
when Protobuf::Message
|
|
51
|
+
when ::Protobuf::Message
|
|
52
52
|
result
|
|
53
53
|
when ::ActiveRecord::Base, ::ActiveRecord::Relation
|
|
54
54
|
result = result.to_proto(deprecated: false, except: interaction.except_attributes, include: interaction.include_attributes)
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: protobuf-rpc-register
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.16.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- scorix
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2016-06-
|
|
11
|
+
date: 2016-06-20 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bundler
|