protocol-grpc 0.13.1 → 0.14.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 034feb2e3b17d2cdf00697215d48a3d62d328c37df11f437b410ac6a0878b16f
4
- data.tar.gz: 3a94f6c1431029e2449383ef0f51196cc4aa7dd5e60f33d938270ffa05e877a8
3
+ metadata.gz: c7aa96e69acd0574147e4c3e8c16fba62e8278d01e094267d3cb3427221d8fa0
4
+ data.tar.gz: 303976d191a6b5ff5e20db644ef2f29a71c5b7c346558eac2a3e5122c1197bff
5
5
  SHA512:
6
- metadata.gz: 141ad27dd57585879827d433964c3e8de3895cd41347b49b909bc5d33bc92bc87f5825bfd46bc167b01c99d3d7a37cd83741b2f3e473391af2148b25d427993c
7
- data.tar.gz: 8997edac6e081b1681cc8bbee2b5d4ea49de5f6af12dacd55946353a301f32d9446ab9487bf6ec27df15209303b264afa231ef5f7fbc67e7fb2bf2f03d440761
6
+ metadata.gz: 1bc1343e7e2e8e21206139992f9483a1c970b21456f90bfb124d4fdd8728eedb51b921a7d93999ece219fd4b079cb9c9e0b2433750e6ee249c234124a1dfaba3
7
+ data.tar.gz: cea3a080a0cea063968a40939451b2c2f044f1e4b9068b64f231272e7f2c2d953f6f7ceabef437762700cf2d36b04a90ffb94dfd43ef76f2e5b4ed55d6e4ba29
checksums.yaml.gz.sig CHANGED
Binary file
@@ -18,7 +18,7 @@ $ bundle add protocol-grpc
18
18
  - A {ruby Protocol::GRPC::Body::Readable} class which handles reading gRPC messages from HTTP request/response bodies with automatic framing and decoding.
19
19
  - A {ruby Protocol::GRPC::Body::Writable} class which handles writing gRPC messages to HTTP request/response bodies with automatic framing and encoding.
20
20
  - A {ruby Protocol::GRPC::Middleware} abstract base class for building gRPC server applications.
21
- - A {ruby Protocol::GRPC::Call} class which represents the context of a single gRPC RPC call, including deadline tracking.
21
+ - A {ruby Protocol::GRPC::Call} class which represents the request, response, metadata, and deadline for a single gRPC RPC call.
22
22
  - A {ruby Protocol::GRPC::Status} module with gRPC status code constants.
23
23
  - A {ruby Protocol::GRPC::Error} hierarchy for gRPC-specific error handling.
24
24
 
@@ -132,13 +132,14 @@ end
132
132
  ``` ruby
133
133
  require "protocol/grpc/call"
134
134
 
135
- call = Protocol::GRPC::Call.new(request, deadline: deadline)
135
+ call = Protocol::GRPC::Call.new(request, response, deadline: deadline)
136
136
 
137
137
  # Access request
138
138
  call.request # => Protocol::HTTP::Request
139
139
 
140
- # Check deadline
140
+ # Check deadline and status
141
141
  call.deadline.exceeded? # => false
142
+ call.status # => Protocol::GRPC::Status::OK
142
143
 
143
144
  # Access peer information
144
145
  call.peer # => Protocol::HTTP::Address
data/design.md CHANGED
@@ -535,7 +535,6 @@ module Protocol
535
535
  def initialize(request, deadline: nil)
536
536
  @request = request
537
537
  @deadline = deadline
538
- @cancelled = false
539
538
  end
540
539
 
541
540
  # @attribute [Protocol::HTTP::Request] The underlying HTTP request
@@ -562,17 +561,6 @@ module Protocol
562
561
  @deadline ? [@deadline - Time.now, 0].max : nil
563
562
  end
564
563
 
565
- # Mark this call as cancelled
566
- def cancel!
567
- @cancelled = true
568
- end
569
-
570
- # Check if call was cancelled
571
- # @returns [Boolean]
572
- def cancelled?
573
- @cancelled
574
- end
575
-
576
564
  # Get peer information (client address)
577
565
  # @returns [String | Nil]
578
566
  def peer
@@ -31,7 +31,6 @@ module Protocol
31
31
  @request = request
32
32
  @response = response
33
33
  @deadline = deadline
34
- @cancelled = false
35
34
  end
36
35
 
37
36
  # @attribute [Protocol::HTTP::Request] The underlying HTTP request.
@@ -67,15 +66,12 @@ module Protocol
67
66
  @deadline&.remaining
68
67
  end
69
68
 
70
- # Mark this call as cancelled.
71
- def cancel!
72
- @cancelled = true
73
- end
74
-
75
- # Check if the call was cancelled.
76
- # @returns [Boolean] `true` if the call was cancelled, `false` otherwise
77
- def cancelled?
78
- @cancelled
69
+ # Get the current gRPC status of the call.
70
+ # @returns [Integer | Nil] The current gRPC status code, if available.
71
+ def status
72
+ if headers = @response&.headers
73
+ headers["grpc-status"]&.to_i
74
+ end
79
75
  end
80
76
 
81
77
  # Get peer information (client address).
@@ -7,7 +7,7 @@
7
7
  module Protocol
8
8
  # @namespace
9
9
  module GRPC
10
- VERSION = "0.13.1"
10
+ VERSION = "0.14.0"
11
11
  end
12
12
  end
13
13
 
data/readme.md CHANGED
@@ -28,6 +28,11 @@ 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.14.0
32
+
33
+ - **Breaking**: Removed the unused `Protocol::GRPC::Call#cancel!` and `Protocol::GRPC::Call#cancelled?` methods.
34
+ - Added `Protocol::GRPC::Call#status` to report the status assigned to the response.
35
+
31
36
  ### v0.13.1
32
37
 
33
38
  - **Breaking**: Removed the deprecated `Protocol::GRPC::Methods` module. Use `Protocol::GRPC::Route`, `Protocol::GRPC::Metadata`, and `Protocol::GRPC::Header::Timeout` instead.
data/releases.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # Releases
2
2
 
3
+ ## v0.14.0
4
+
5
+ - **Breaking**: Removed the unused `Protocol::GRPC::Call#cancel!` and `Protocol::GRPC::Call#cancelled?` methods.
6
+ - Added `Protocol::GRPC::Call#status` to report the status assigned to the response.
7
+
3
8
  ## v0.13.1
4
9
 
5
10
  - **Breaking**: Removed the deprecated `Protocol::GRPC::Methods` module. Use `Protocol::GRPC::Route`, `Protocol::GRPC::Metadata`, and `Protocol::GRPC::Header::Timeout` instead.
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: protocol-grpc
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.13.1
4
+ version: 0.14.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Williams
metadata.gz.sig CHANGED
Binary file