gruf 2.5.2 → 2.6.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/CHANGELOG.md +7 -0
- data/gruf.gemspec +6 -3
- data/lib/gruf.rb +1 -0
- data/lib/gruf/cli/executor.rb +1 -1
- data/lib/gruf/client.rb +5 -3
- data/lib/gruf/client/error_factory.rb +9 -5
- data/lib/gruf/configuration.rb +6 -2
- data/lib/gruf/controllers/base.rb +12 -1
- data/lib/gruf/controllers/service_binder.rb +28 -4
- data/lib/gruf/error.rb +1 -1
- data/lib/gruf/instrumentable_grpc_server.rb +1 -0
- data/lib/gruf/integrations/rails/railtie.rb +8 -0
- data/lib/gruf/interceptors/active_record/connection_reset.rb +2 -3
- data/lib/gruf/interceptors/authentication/basic.rb +8 -2
- data/lib/gruf/interceptors/client_interceptor.rb +28 -4
- data/lib/gruf/interceptors/instrumentation/output_metadata_timer.rb +1 -0
- data/lib/gruf/interceptors/instrumentation/request_logging/interceptor.rb +14 -13
- data/lib/gruf/interceptors/instrumentation/statsd.rb +1 -0
- data/lib/gruf/interceptors/registry.rb +4 -1
- data/lib/gruf/server.rb +15 -8
- data/lib/gruf/synchronized_client.rb +6 -4
- data/lib/gruf/version.rb +1 -1
- metadata +17 -16
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 28c2864213d853958ed8a971e0c713940fff7ffff739a968cfbd179c60e07d4a
|
4
|
+
data.tar.gz: 510a33981e2dffb15c9057615c9c818cf5338ee4bd7b99bd44aba095e6f8b9ae
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8471cda11573a443765c8b19a25fd03a4a1f90af0dc827074587bfdc252483d0b1c600ead5725a7e5407c4571eef8de293f169d5ef3de8545f14b5fb456a5629
|
7
|
+
data.tar.gz: a207cda25695c69ce3e4c2e824d85c4ba46a868dab93e27b8b671f068b42ace300f6bf565c8a955c8b5f287dbfacb66289387752d3ac9ff201e68745d3568f2b
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,13 @@ Changelog for the gruf gem. This includes internal history before the gem was ma
|
|
2
2
|
|
3
3
|
### Pending release
|
4
4
|
|
5
|
+
### 2.6.0
|
6
|
+
|
7
|
+
- Drop Ruby 2.2 support
|
8
|
+
- Abstract gruf controller's send to make it usable in filters
|
9
|
+
- Adjusts configuration reset into a Railtie for Rails systems to ensure proper OOE
|
10
|
+
- Bump rubocop to 0.64, address violations, update activesupport/concurrent-ruby dependencies to have a min version
|
11
|
+
|
5
12
|
### 2.5.2
|
6
13
|
|
7
14
|
- Log ok/validation responses at DEBUG levels to prevent log stampeding in high-volume environments
|
data/gruf.gemspec
CHANGED
@@ -32,13 +32,16 @@ Gem::Specification.new do |spec|
|
|
32
32
|
spec.executables << 'gruf'
|
33
33
|
spec.require_paths = ['lib']
|
34
34
|
|
35
|
+
spec.required_ruby_version = '~> 2.4'
|
36
|
+
|
35
37
|
spec.add_development_dependency 'bundler', '~> 1.11'
|
36
38
|
spec.add_development_dependency 'rake', '~> 10.0'
|
37
|
-
spec.add_development_dependency 'pry'
|
39
|
+
spec.add_development_dependency 'pry', '~> 0.11'
|
38
40
|
|
39
41
|
spec.add_runtime_dependency 'grpc', '~> 1.10'
|
40
42
|
spec.add_runtime_dependency 'grpc-tools', '~> 1.10'
|
41
|
-
spec.add_runtime_dependency 'activesupport'
|
42
|
-
|
43
|
+
spec.add_runtime_dependency 'activesupport', '> 4'
|
44
|
+
|
45
|
+
spec.add_runtime_dependency 'concurrent-ruby', '> 1'
|
43
46
|
spec.add_runtime_dependency 'slop', '~> 4.6'
|
44
47
|
end
|
data/lib/gruf.rb
CHANGED
@@ -35,6 +35,7 @@ require_relative 'gruf/client'
|
|
35
35
|
require_relative 'gruf/synchronized_client'
|
36
36
|
require_relative 'gruf/instrumentable_grpc_server'
|
37
37
|
require_relative 'gruf/server'
|
38
|
+
require_relative 'gruf/integrations/rails/railtie' if defined?(Rails)
|
38
39
|
|
39
40
|
##
|
40
41
|
# Initializes configuration of gruf core module
|
data/lib/gruf/cli/executor.rb
CHANGED
data/lib/gruf/client.rb
CHANGED
@@ -68,8 +68,8 @@ module Gruf
|
|
68
68
|
# Call the client's method with given params
|
69
69
|
#
|
70
70
|
# @param [String|Symbol] request_method The method that is being requested on the service
|
71
|
-
# @param [Hash] params (Optional) A hash of parameters that will be inserted into the gRPC request message that is
|
72
|
-
# for the given above call
|
71
|
+
# @param [Hash] params (Optional) A hash of parameters that will be inserted into the gRPC request message that is
|
72
|
+
# required for the given above call
|
73
73
|
# @param [Hash] metadata (Optional) A hash of metadata key/values that are transported with the client request
|
74
74
|
# @param [Hash] opts (Optional) A hash of options to send to the gRPC request_response method
|
75
75
|
# @return [Gruf::Response] The response from the server
|
@@ -82,7 +82,9 @@ module Gruf
|
|
82
82
|
md = build_metadata(metadata)
|
83
83
|
call_sig = call_signature(request_method)
|
84
84
|
|
85
|
-
|
85
|
+
unless call_sig
|
86
|
+
raise NotImplementedError, "The method #{request_method} has not been implemented in this service."
|
87
|
+
end
|
86
88
|
|
87
89
|
resp, operation = execute(call_sig, req, md, opts, &block)
|
88
90
|
|
@@ -31,11 +31,6 @@ module Gruf
|
|
31
31
|
)
|
32
32
|
@default_class = default_class || Gruf::Client::Errors::Internal
|
33
33
|
@metadata_key = (metadata_key || Gruf.error_metadata_key).to_s
|
34
|
-
default_serializer = if Gruf.error_serializer
|
35
|
-
Gruf.error_serializer.is_a?(Class) ? Gruf.error_serializer : Gruf.error_serializer.to_s.constantize
|
36
|
-
else
|
37
|
-
Gruf::Serializers::Errors::Json
|
38
|
-
end
|
39
34
|
@deserializer_class = deserializer_class || default_serializer
|
40
35
|
end
|
41
36
|
|
@@ -94,6 +89,15 @@ module Gruf
|
|
94
89
|
rescue NameError => _
|
95
90
|
@default_class
|
96
91
|
end
|
92
|
+
|
93
|
+
##
|
94
|
+
# @return [Gruf::Serializers::Errors::Base]
|
95
|
+
#
|
96
|
+
def default_serializer
|
97
|
+
return Gruf::Serializers::Errors::Json unless Gruf.error_serializer
|
98
|
+
|
99
|
+
Gruf.error_serializer.is_a?(Class) ? Gruf.error_serializer : Gruf.error_serializer.to_s.constantize
|
100
|
+
end
|
97
101
|
end
|
98
102
|
end
|
99
103
|
end
|
data/lib/gruf/configuration.rb
CHANGED
@@ -51,13 +51,17 @@ module Gruf
|
|
51
51
|
}.freeze
|
52
52
|
}.freeze
|
53
53
|
|
54
|
-
attr_accessor
|
54
|
+
attr_accessor(* VALID_CONFIG_KEYS.keys)
|
55
55
|
|
56
56
|
##
|
57
57
|
# Whenever this is extended into a class, setup the defaults
|
58
58
|
#
|
59
59
|
def self.extended(base)
|
60
|
-
|
60
|
+
if defined?(Rails)
|
61
|
+
Gruf::Integrations::Rails::Railtie.config.before_initialize { base.reset }
|
62
|
+
else
|
63
|
+
base.reset
|
64
|
+
end
|
61
65
|
end
|
62
66
|
|
63
67
|
##
|
@@ -67,6 +67,17 @@ module Gruf
|
|
67
67
|
ServiceBinder.new(service_class).bind!(self)
|
68
68
|
end
|
69
69
|
|
70
|
+
##
|
71
|
+
# Call a method on this controller.
|
72
|
+
# Override this in a subclass to modify the behavior around processing a method
|
73
|
+
#
|
74
|
+
# @param [Symbol] method_key The name of the gRPC service method being called as a Symbol
|
75
|
+
# @param [block] &block The passed block for executing the method
|
76
|
+
#
|
77
|
+
def process_action(method_key, &block)
|
78
|
+
send(method_key, &block)
|
79
|
+
end
|
80
|
+
|
70
81
|
##
|
71
82
|
# Call a method on this controller
|
72
83
|
#
|
@@ -75,7 +86,7 @@ module Gruf
|
|
75
86
|
#
|
76
87
|
def call(method_key, &block)
|
77
88
|
Interceptors::Context.new(@interceptors).intercept! do
|
78
|
-
|
89
|
+
process_action(method_key, &block)
|
79
90
|
end
|
80
91
|
rescue GRPC::BadStatus
|
81
92
|
raise # passthrough, to be caught by Gruf::Interceptors::Timer
|
@@ -58,22 +58,46 @@ module Gruf
|
|
58
58
|
@service.class_eval do
|
59
59
|
if desc.request_response?
|
60
60
|
define_method(method_key) do |message, active_call|
|
61
|
-
c = controller.new(
|
61
|
+
c = controller.new(
|
62
|
+
method_key: method_key,
|
63
|
+
service: service_ref,
|
64
|
+
message: message,
|
65
|
+
active_call: active_call,
|
66
|
+
rpc_desc: desc
|
67
|
+
)
|
62
68
|
c.call(method_key)
|
63
69
|
end
|
64
70
|
elsif desc.client_streamer?
|
65
71
|
define_method(method_key) do |active_call|
|
66
|
-
c = controller.new(
|
72
|
+
c = controller.new(
|
73
|
+
method_key: method_key,
|
74
|
+
service: service_ref,
|
75
|
+
message: proc { |&block| active_call.each_remote_read(&block) },
|
76
|
+
active_call: active_call,
|
77
|
+
rpc_desc: desc
|
78
|
+
)
|
67
79
|
c.call(method_key)
|
68
80
|
end
|
69
81
|
elsif desc.server_streamer?
|
70
82
|
define_method(method_key) do |message, active_call, &block|
|
71
|
-
c = controller.new(
|
83
|
+
c = controller.new(
|
84
|
+
method_key: method_key,
|
85
|
+
service: service_ref,
|
86
|
+
message: message,
|
87
|
+
active_call: active_call,
|
88
|
+
rpc_desc: desc
|
89
|
+
)
|
72
90
|
c.call(method_key, &block)
|
73
91
|
end
|
74
92
|
else # bidi
|
75
93
|
define_method(method_key) do |messages, active_call, &block|
|
76
|
-
c = controller.new(
|
94
|
+
c = controller.new(
|
95
|
+
method_key: method_key,
|
96
|
+
service: service_ref,
|
97
|
+
message: messages,
|
98
|
+
active_call: active_call,
|
99
|
+
rpc_desc: desc
|
100
|
+
)
|
77
101
|
c.call(method_key, &block)
|
78
102
|
end
|
79
103
|
end
|
data/lib/gruf/error.rb
CHANGED
@@ -25,9 +25,8 @@ module Gruf
|
|
25
25
|
# connection pool, we need to ensure that this is done to properly
|
26
26
|
#
|
27
27
|
def call
|
28
|
-
if enabled? && !::ActiveRecord::Base.connection.active?
|
29
|
-
|
30
|
-
end
|
28
|
+
::ActiveRecord::Base.establish_connection if enabled? && !::ActiveRecord::Base.connection.active?
|
29
|
+
|
31
30
|
yield
|
32
31
|
ensure
|
33
32
|
::ActiveRecord::Base.clear_active_connections! if enabled?
|
@@ -22,7 +22,9 @@ module Gruf
|
|
22
22
|
# Handles basic authentication for gRPC requests
|
23
23
|
#
|
24
24
|
class Basic < Gruf::Interceptors::ServerInterceptor
|
25
|
-
|
25
|
+
##
|
26
|
+
# Validate authentication
|
27
|
+
#
|
26
28
|
def call
|
27
29
|
fail!(:unauthenticated, :unauthenticated) unless bypass? || valid?
|
28
30
|
yield
|
@@ -63,7 +65,11 @@ module Gruf
|
|
63
65
|
# @return [String] The decoded request credentials
|
64
66
|
#
|
65
67
|
def request_credentials
|
66
|
-
credentials = request.active_call.respond_to?(:metadata)
|
68
|
+
credentials = if request.active_call.respond_to?(:metadata)
|
69
|
+
request.active_call.metadata['authorization'].to_s
|
70
|
+
else
|
71
|
+
''
|
72
|
+
end
|
67
73
|
Base64.decode64(credentials.to_s.gsub('Basic ', '').strip)
|
68
74
|
end
|
69
75
|
|
@@ -42,7 +42,13 @@ module Gruf
|
|
42
42
|
# @return [Object] The response message
|
43
43
|
#
|
44
44
|
def request_response(request: nil, call: nil, method: nil, metadata: nil)
|
45
|
-
rc = Gruf::Outbound::RequestContext.new(
|
45
|
+
rc = Gruf::Outbound::RequestContext.new(
|
46
|
+
type: :request_response,
|
47
|
+
requests: [request],
|
48
|
+
call: call,
|
49
|
+
method: method,
|
50
|
+
metadata: metadata
|
51
|
+
)
|
46
52
|
call(request_context: rc) do
|
47
53
|
yield
|
48
54
|
end
|
@@ -58,7 +64,13 @@ module Gruf
|
|
58
64
|
# @return [Object] The response message
|
59
65
|
#
|
60
66
|
def client_streamer(requests: nil, call: nil, method: nil, metadata: nil)
|
61
|
-
rc = Gruf::Outbound::RequestContext.new(
|
67
|
+
rc = Gruf::Outbound::RequestContext.new(
|
68
|
+
type: :client_streamer,
|
69
|
+
requests: requests,
|
70
|
+
call: call,
|
71
|
+
method: method,
|
72
|
+
metadata: metadata
|
73
|
+
)
|
62
74
|
call(request_context: rc) do
|
63
75
|
yield
|
64
76
|
end
|
@@ -74,7 +86,13 @@ module Gruf
|
|
74
86
|
# @return [Object] The response message
|
75
87
|
#
|
76
88
|
def server_streamer(request: nil, call: nil, method: nil, metadata: nil)
|
77
|
-
rc = Gruf::Outbound::RequestContext.new(
|
89
|
+
rc = Gruf::Outbound::RequestContext.new(
|
90
|
+
type: :server_streamer,
|
91
|
+
requests: [request],
|
92
|
+
call: call,
|
93
|
+
method: method,
|
94
|
+
metadata: metadata
|
95
|
+
)
|
78
96
|
call(request_context: rc) do
|
79
97
|
yield
|
80
98
|
end
|
@@ -89,7 +107,13 @@ module Gruf
|
|
89
107
|
# @param [Hash] metadata A hash of outgoing metadata
|
90
108
|
#
|
91
109
|
def bidi_streamer(requests: nil, call: nil, method: nil, metadata: nil)
|
92
|
-
rc = Gruf::Outbound::RequestContext.new(
|
110
|
+
rc = Gruf::Outbound::RequestContext.new(
|
111
|
+
type: :bidi_streamer,
|
112
|
+
requests: requests,
|
113
|
+
call: call,
|
114
|
+
method: method,
|
115
|
+
metadata: metadata
|
116
|
+
)
|
93
117
|
call(request_context: rc) do
|
94
118
|
yield
|
95
119
|
end
|
@@ -36,7 +36,6 @@ module Gruf
|
|
36
36
|
# Gruf::Instrumentation::Registry.add(:request_logging, Gruf::Instrumentation::RequestLogging::Hook)
|
37
37
|
#
|
38
38
|
class Interceptor < ::Gruf::Interceptors::ServerInterceptor
|
39
|
-
|
40
39
|
# Default mappings of codes to log levels...
|
41
40
|
LOG_LEVEL_MAP = {
|
42
41
|
'GRPC::Ok' => :debug,
|
@@ -102,6 +101,7 @@ module Gruf
|
|
102
101
|
logger.send(type, formatter.format(payload))
|
103
102
|
|
104
103
|
raise result.message unless result.successful?
|
104
|
+
|
105
105
|
result.message
|
106
106
|
end
|
107
107
|
|
@@ -122,11 +122,9 @@ module Gruf
|
|
122
122
|
# @return [String] The appropriate message body
|
123
123
|
#
|
124
124
|
def message(request, result)
|
125
|
-
if result.successful?
|
126
|
-
|
127
|
-
|
128
|
-
"[#{result.message_class_name}] (#{request.method_name}) #{result.message.message}"
|
129
|
-
end
|
125
|
+
return "[GRPC::Ok] (#{request.method_name})" if result.successful?
|
126
|
+
|
127
|
+
"[#{result.message_class_name}] (#{request.method_name}) #{result.message.message}"
|
130
128
|
end
|
131
129
|
|
132
130
|
##
|
@@ -149,13 +147,14 @@ module Gruf
|
|
149
147
|
unless @formatter
|
150
148
|
fmt = options.fetch(:formatter, :plain)
|
151
149
|
@formatter = case fmt
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
150
|
+
when Symbol
|
151
|
+
prefix = 'Gruf::Interceptors::Instrumentation::RequestLogging::Formatters::'
|
152
|
+
klass = "#{prefix}#{fmt.to_s.capitalize}"
|
153
|
+
fmt = klass.constantize.new
|
154
|
+
when Class
|
155
|
+
fmt = fmt.new
|
156
|
+
else
|
157
|
+
fmt
|
159
158
|
end
|
160
159
|
raise InvalidFormatterError unless fmt.is_a?(Formatters::Base)
|
161
160
|
end
|
@@ -188,7 +187,9 @@ module Gruf
|
|
188
187
|
#
|
189
188
|
def redact!(parts = [], idx = 0, params = {}, redacted_string = 'REDACTED')
|
190
189
|
return unless parts.is_a?(Array) && params.is_a?(Hash)
|
190
|
+
|
191
191
|
return if idx >= parts.size || !params.key?(parts[idx])
|
192
|
+
|
192
193
|
if idx == parts.size - 1
|
193
194
|
if params[parts[idx]].is_a? Hash
|
194
195
|
hash_deep_redact!(params[parts[idx]], redacted_string)
|
@@ -22,7 +22,7 @@ module Gruf
|
|
22
22
|
class InterceptorNotFoundError < StandardError; end
|
23
23
|
|
24
24
|
def initialize
|
25
|
-
@registry
|
25
|
+
@registry = []
|
26
26
|
end
|
27
27
|
|
28
28
|
##
|
@@ -49,6 +49,7 @@ module Gruf
|
|
49
49
|
def remove(interceptor_class)
|
50
50
|
pos = @registry.find_index { |opts| opts.fetch(:klass, '') == interceptor_class }
|
51
51
|
raise InterceptorNotFoundError if pos.nil?
|
52
|
+
|
52
53
|
@registry.delete_at(pos)
|
53
54
|
end
|
54
55
|
|
@@ -64,6 +65,7 @@ module Gruf
|
|
64
65
|
interceptors_mutex do
|
65
66
|
pos = @registry.find_index { |opts| opts.fetch(:klass, '') == before_class }
|
66
67
|
raise InterceptorNotFoundError if pos.nil?
|
68
|
+
|
67
69
|
@registry.insert(
|
68
70
|
pos,
|
69
71
|
klass: interceptor_class,
|
@@ -84,6 +86,7 @@ module Gruf
|
|
84
86
|
interceptors_mutex do
|
85
87
|
pos = @registry.find_index { |opts| opts.fetch(:klass, '') == after_class }
|
86
88
|
raise InterceptorNotFoundError if pos.nil?
|
89
|
+
|
87
90
|
@registry.insert(
|
88
91
|
(pos + 1),
|
89
92
|
klass: interceptor_class,
|
data/lib/gruf/server.rb
CHANGED
@@ -94,6 +94,7 @@ module Gruf
|
|
94
94
|
stop_server_thread = Thread.new do
|
95
95
|
loop do
|
96
96
|
break if @stop_server
|
97
|
+
|
97
98
|
@stop_server_mu.synchronize { @stop_server_cv.wait(@stop_server_mu, 10) }
|
98
99
|
end
|
99
100
|
logger.info { 'Shutting down...' }
|
@@ -120,6 +121,7 @@ module Gruf
|
|
120
121
|
#
|
121
122
|
def add_service(klass)
|
122
123
|
raise ServerAlreadyStartedError if @started
|
124
|
+
|
123
125
|
@services << klass unless @services.include?(klass)
|
124
126
|
end
|
125
127
|
|
@@ -132,6 +134,7 @@ module Gruf
|
|
132
134
|
#
|
133
135
|
def add_interceptor(klass, opts = {})
|
134
136
|
raise ServerAlreadyStartedError if @started
|
137
|
+
|
135
138
|
@interceptors.use(klass, opts)
|
136
139
|
end
|
137
140
|
|
@@ -144,6 +147,7 @@ module Gruf
|
|
144
147
|
#
|
145
148
|
def insert_interceptor_before(before_class, interceptor_class, opts = {})
|
146
149
|
raise ServerAlreadyStartedError if @started
|
150
|
+
|
147
151
|
@interceptors.insert_before(before_class, interceptor_class, opts)
|
148
152
|
end
|
149
153
|
|
@@ -156,6 +160,7 @@ module Gruf
|
|
156
160
|
#
|
157
161
|
def insert_interceptor_after(after_class, interceptor_class, opts = {})
|
158
162
|
raise ServerAlreadyStartedError if @started
|
163
|
+
|
159
164
|
@interceptors.insert_after(after_class, interceptor_class, opts)
|
160
165
|
end
|
161
166
|
|
@@ -175,6 +180,7 @@ module Gruf
|
|
175
180
|
#
|
176
181
|
def remove_interceptor(klass)
|
177
182
|
raise ServerAlreadyStartedError if @started
|
183
|
+
|
178
184
|
@interceptors.remove(klass)
|
179
185
|
end
|
180
186
|
|
@@ -183,6 +189,7 @@ module Gruf
|
|
183
189
|
#
|
184
190
|
def clear_interceptors
|
185
191
|
raise ServerAlreadyStartedError if @started
|
192
|
+
|
186
193
|
@interceptors.clear
|
187
194
|
end
|
188
195
|
|
@@ -221,10 +228,12 @@ module Gruf
|
|
221
228
|
# :nocov:
|
222
229
|
def load_controllers
|
223
230
|
return unless File.directory?(controllers_path)
|
231
|
+
|
224
232
|
path = File.realpath(controllers_path)
|
225
233
|
$LOAD_PATH.unshift(path)
|
226
234
|
Dir["#{path}/**/*.rb"].each do |f|
|
227
235
|
next if f.include?('_pb') # exclude if people include proto generated files in app/rpc
|
236
|
+
|
228
237
|
logger.info "- Loading gRPC service file: #{f}"
|
229
238
|
load File.realpath(f)
|
230
239
|
end
|
@@ -245,14 +254,12 @@ module Gruf
|
|
245
254
|
#
|
246
255
|
# :nocov:
|
247
256
|
def ssl_credentials
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
:this_port_is_insecure
|
255
|
-
end
|
257
|
+
return :this_port_is_insecure unless options.fetch(:use_ssl, Gruf.use_ssl)
|
258
|
+
|
259
|
+
private_key = File.read(options.fetch(:ssl_key_file, Gruf.ssl_key_file))
|
260
|
+
cert_chain = File.read(options.fetch(:ssl_crt_file, Gruf.ssl_crt_file))
|
261
|
+
certs = [nil, [{ private_key: private_key, cert_chain: cert_chain }], false]
|
262
|
+
GRPC::Core::ServerCredentials.new(*certs)
|
256
263
|
end
|
257
264
|
# :nocov:
|
258
265
|
|
@@ -28,8 +28,10 @@ module Gruf
|
|
28
28
|
#
|
29
29
|
# @param [Module] service The namespace of the client Stub that is desired to load
|
30
30
|
# @param [Hash] options A hash of options for the client
|
31
|
-
# @option options [Array] :unsynchronized_methods A list of methods (as symbols) that
|
32
|
-
#
|
31
|
+
# @option options [Array] :unsynchronized_methods A list of methods (as symbols) that
|
32
|
+
# should be excluded from synchronization
|
33
|
+
# @option options [Integer] :internal_cache_expiry The length of time to keep results
|
34
|
+
# around for other threads to fetch (in seconds)
|
33
35
|
# @param [Hash] client_options A hash of options to pass to the gRPC client stub
|
34
36
|
#
|
35
37
|
def initialize(service:, options: {}, client_options: {})
|
@@ -45,8 +47,8 @@ module Gruf
|
|
45
47
|
# params, block until the active call is complete. When unblocked, callers will get a copy of the original result.
|
46
48
|
#
|
47
49
|
# @param [String|Symbol] request_method The method that is being requested on the service
|
48
|
-
# @param [Hash] params (Optional) A hash of parameters that will be inserted into the gRPC request
|
49
|
-
# for the given above call
|
50
|
+
# @param [Hash] params (Optional) A hash of parameters that will be inserted into the gRPC request
|
51
|
+
# message that is required for the given above call
|
50
52
|
# @param [Hash] metadata (Optional) A hash of metadata key/values that are transported with the client request
|
51
53
|
# @param [Hash] opts (Optional) A hash of options to send to the gRPC request_response method
|
52
54
|
# @return [Gruf::Response] The response from the server
|
data/lib/gruf/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gruf
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Shaun McCormick
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-04-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -42,16 +42,16 @@ dependencies:
|
|
42
42
|
name: pry
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - "
|
45
|
+
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '0'
|
47
|
+
version: '0.11'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- - "
|
52
|
+
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '0'
|
54
|
+
version: '0.11'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: grpc
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -84,30 +84,30 @@ dependencies:
|
|
84
84
|
name: activesupport
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
|
-
- - "
|
87
|
+
- - ">"
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version: '
|
89
|
+
version: '4'
|
90
90
|
type: :runtime
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
|
-
- - "
|
94
|
+
- - ">"
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version: '
|
96
|
+
version: '4'
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
98
|
name: concurrent-ruby
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
|
-
- - "
|
101
|
+
- - ">"
|
102
102
|
- !ruby/object:Gem::Version
|
103
|
-
version: '
|
103
|
+
version: '1'
|
104
104
|
type: :runtime
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
|
-
- - "
|
108
|
+
- - ">"
|
109
109
|
- !ruby/object:Gem::Version
|
110
|
-
version: '
|
110
|
+
version: '1'
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
112
|
name: slop
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
@@ -149,6 +149,7 @@ files:
|
|
149
149
|
- lib/gruf/errors/field.rb
|
150
150
|
- lib/gruf/errors/helpers.rb
|
151
151
|
- lib/gruf/instrumentable_grpc_server.rb
|
152
|
+
- lib/gruf/integrations/rails/railtie.rb
|
152
153
|
- lib/gruf/interceptors/active_record/connection_reset.rb
|
153
154
|
- lib/gruf/interceptors/authentication/basic.rb
|
154
155
|
- lib/gruf/interceptors/base.rb
|
@@ -183,9 +184,9 @@ require_paths:
|
|
183
184
|
- lib
|
184
185
|
required_ruby_version: !ruby/object:Gem::Requirement
|
185
186
|
requirements:
|
186
|
-
- - "
|
187
|
+
- - "~>"
|
187
188
|
- !ruby/object:Gem::Version
|
188
|
-
version: '
|
189
|
+
version: '2.4'
|
189
190
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
190
191
|
requirements:
|
191
192
|
- - ">="
|