protocol-grpc 0.3.0 → 0.4.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
- checksums.yaml.gz.sig +0 -0
- data/context/getting-started.md +0 -2
- data/design.md +4 -4
- data/lib/protocol/grpc/body/readable_body.rb +5 -0
- data/lib/protocol/grpc/interface.rb +4 -2
- data/lib/protocol/grpc/version.rb +1 -2
- data/readme.md +4 -0
- data/releases.md +4 -0
- data.tar.gz.sig +0 -0
- metadata +1 -1
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 301c1d74991d960be7af4b50850ffa24aab9e4c2c7aedc97759518027aacfe18
|
|
4
|
+
data.tar.gz: ac2fe4b32aa211ef8dbf4329a8677ae09deced47ab21816c0b6fb361d346dcd2
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 2467aaa36d36c6d011ee4913984defc1974d008bf25081777863d83b4c3c7c7825556ae571a99cc74858a7eece0c99cf253953230bbb7220244082a2c32bd95f
|
|
7
|
+
data.tar.gz: 222fe2052157790f288d72f6f6feff1ad42d507ab188e2bce23cbf0f2e9fa63d7eb0966f774935e5ae0ad3e5a497170f8b126f9dfa4d10ccf53b7f385d7b8437
|
checksums.yaml.gz.sig
CHANGED
|
Binary file
|
data/context/getting-started.md
CHANGED
data/design.md
CHANGED
|
@@ -779,10 +779,10 @@ module Protocol
|
|
|
779
779
|
# Handle the RPC
|
|
780
780
|
begin
|
|
781
781
|
handle_rpc(request, handler, handler_method, request_class, response_class)
|
|
782
|
-
rescue Error =>
|
|
783
|
-
trailers_only_error(e.status_code,
|
|
784
|
-
rescue =>
|
|
785
|
-
trailers_only_error(Status::INTERNAL,
|
|
782
|
+
rescue Error => error
|
|
783
|
+
trailers_only_error(e.status_code, error.message)
|
|
784
|
+
rescue => error
|
|
785
|
+
trailers_only_error(Status::INTERNAL, error.message)
|
|
786
786
|
end
|
|
787
787
|
end
|
|
788
788
|
|
|
@@ -15,6 +15,11 @@ module Protocol
|
|
|
15
15
|
# This is the standard readable body for gRPC - all gRPC responses use message framing.
|
|
16
16
|
# Wraps the underlying HTTP body and transforms raw chunks into decoded gRPC messages.
|
|
17
17
|
class ReadableBody < Protocol::HTTP::Body::Wrapper
|
|
18
|
+
# Wrap the body of a message.
|
|
19
|
+
#
|
|
20
|
+
# @parameter message [Request | Response] The message to wrap.
|
|
21
|
+
# @parameter options [Hash] The options to pass to the initializer.
|
|
22
|
+
# @returns [ReadableBody | Nil] The wrapped body or `nil` if the message has no body.
|
|
18
23
|
def self.wrap(message, **options)
|
|
19
24
|
if body = message.body
|
|
20
25
|
message.body = self.new(body, **options)
|
|
@@ -11,8 +11,8 @@ module Protocol
|
|
|
11
11
|
# Can be used by both client stubs and server implementations.
|
|
12
12
|
class Interface
|
|
13
13
|
# RPC method definition
|
|
14
|
-
RPC = Struct.new(:request_class, :response_class, :streaming, :method, keyword_init: true) do
|
|
15
|
-
def initialize(request_class:, response_class:, streaming: :unary, method: nil)
|
|
14
|
+
RPC = Struct.new(:name, :request_class, :response_class, :streaming, :method, keyword_init: true) do
|
|
15
|
+
def initialize(name:, request_class:, response_class:, streaming: :unary, method: nil)
|
|
16
16
|
super
|
|
17
17
|
end
|
|
18
18
|
|
|
@@ -40,6 +40,8 @@ module Protocol
|
|
|
40
40
|
# @parameter streaming [Symbol] Streaming type (:unary, :server_streaming, :client_streaming, :bidirectional)
|
|
41
41
|
# @parameter method [Symbol | Nil] Optional explicit Ruby method name (snake_case). If not provided, automatically converts PascalCase to snake_case.
|
|
42
42
|
def self.rpc(name, **options)
|
|
43
|
+
options[:name] = name
|
|
44
|
+
|
|
43
45
|
# Ensure snake_case method name is always available
|
|
44
46
|
options[:method] ||= pascal_case_to_snake_case(name.to_s).to_sym
|
|
45
47
|
|
data/readme.md
CHANGED
|
@@ -28,6 +28,10 @@ Please see the [project documentation](https://socketry.github.io/protocol-grpc/
|
|
|
28
28
|
|
|
29
29
|
Please see the [project releases](https://socketry.github.io/protocol-grpc/releases/index) for all releases.
|
|
30
30
|
|
|
31
|
+
### v0.4.0
|
|
32
|
+
|
|
33
|
+
- Add `RPC#name`.
|
|
34
|
+
|
|
31
35
|
### v0.3.0
|
|
32
36
|
|
|
33
37
|
- **Breaking**: `Protocol::GRPC::Call` now takes a `response` object parameter instead of separate `response_headers`.
|
data/releases.md
CHANGED
data.tar.gz.sig
CHANGED
|
Binary file
|
metadata
CHANGED
metadata.gz.sig
CHANGED
|
Binary file
|