connectrpc 0.1.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 +7 -0
- data/LICENSE +21 -0
- data/README.md +501 -0
- data/docs/design.md +504 -0
- data/docs/development.md +566 -0
- data/docs/grpc-web.md +165 -0
- data/docs/grpc.md +75 -0
- data/docs/rbs.md +469 -0
- data/docs/streaming.md +251 -0
- data/exe/protoc-gen-connectrpc-ruby +23 -0
- data/lib/connectrpc/bindings/descriptors/status.bin +15 -0
- data/lib/connectrpc/bindings/google_protobuf.rb +92 -0
- data/lib/connectrpc/cancellation.rb +220 -0
- data/lib/connectrpc/client.rb +260 -0
- data/lib/connectrpc/compression.rb +120 -0
- data/lib/connectrpc/deadline.rb +81 -0
- data/lib/connectrpc/error.rb +72 -0
- data/lib/connectrpc/generator/names.rb +105 -0
- data/lib/connectrpc/generator/rbs_renderer.rb +93 -0
- data/lib/connectrpc/generator/renderer.rb +115 -0
- data/lib/connectrpc/generator/runtime_names.rb +84 -0
- data/lib/connectrpc/generator/schema.rb +218 -0
- data/lib/connectrpc/generator/streaming_methods.rb +29 -0
- data/lib/connectrpc/generator.rb +42 -0
- data/lib/connectrpc/get_query.rb +159 -0
- data/lib/connectrpc/grpc.rb +200 -0
- data/lib/connectrpc/grpc_client.rb +23 -0
- data/lib/connectrpc/grpc_server.rb +158 -0
- data/lib/connectrpc/grpc_web.rb +131 -0
- data/lib/connectrpc/grpc_web_cors.rb +135 -0
- data/lib/connectrpc/grpc_web_io.rb +156 -0
- data/lib/connectrpc/grpc_web_server.rb +207 -0
- data/lib/connectrpc/instrumentation.rb +216 -0
- data/lib/connectrpc/message_io.rb +47 -0
- data/lib/connectrpc/metadata.rb +105 -0
- data/lib/connectrpc/method.rb +68 -0
- data/lib/connectrpc/protocol.rb +189 -0
- data/lib/connectrpc/server.rb +398 -0
- data/lib/connectrpc/streaming/client.rb +104 -0
- data/lib/connectrpc/streaming/client_execution.rb +87 -0
- data/lib/connectrpc/streaming/client_scope.rb +105 -0
- data/lib/connectrpc/streaming/framing.rb +123 -0
- data/lib/connectrpc/streaming/framing_io.rb +61 -0
- data/lib/connectrpc/streaming/method.rb +33 -0
- data/lib/connectrpc/streaming/server.rb +122 -0
- data/lib/connectrpc/streaming/server_execution.rb +88 -0
- data/lib/connectrpc/streaming/server_terminal.rb +70 -0
- data/lib/connectrpc/streaming/session.rb +143 -0
- data/lib/connectrpc/streaming/session_completion.rb +134 -0
- data/lib/connectrpc/streaming/session_io.rb +107 -0
- data/lib/connectrpc/streaming/session_messages.rb +119 -0
- data/lib/connectrpc/streaming/strategy.rb +95 -0
- data/lib/connectrpc/streaming/streams.rb +116 -0
- data/lib/connectrpc/streaming/terminal.rb +52 -0
- data/lib/connectrpc/transports/net_http.rb +246 -0
- data/lib/connectrpc/version.rb +5 -0
- data/lib/connectrpc.rb +38 -0
- data/rbs/google_protobuf_4_36/runtime.rbs +41 -0
- data/sig/connectrpc.rbs +772 -0
- data/sig/manifest.yaml +2 -0
- data/third_party/README.md +16 -0
- data/third_party/google/LICENSE +201 -0
- data/third_party/google/rpc/status.proto +48 -0
- data/third_party/protobuf-LICENSE +32 -0
- metadata +106 -0
data/sig/connectrpc.rbs
ADDED
|
@@ -0,0 +1,772 @@
|
|
|
1
|
+
module ConnectRPC
|
|
2
|
+
VERSION: String
|
|
3
|
+
type idempotency = :unknown | :no_side_effects | :idempotent
|
|
4
|
+
type codec = :proto | :json
|
|
5
|
+
type server_protocol = :connect | :grpc | :grpc_web
|
|
6
|
+
type server_protocol_selection = server_protocol | :auto | Array[server_protocol]
|
|
7
|
+
type grpc_web_cardinality = :unary | :server_stream
|
|
8
|
+
type headers = Hash[String, Array[String]]
|
|
9
|
+
type metadata_input = Metadata | Hash[String, String | Array[String]]
|
|
10
|
+
|
|
11
|
+
# Tokens belong to the binding. Only schema facts or an application assertion
|
|
12
|
+
# associate them with instance types; the constructor cannot infer that link.
|
|
13
|
+
class Method[Req, Resp]
|
|
14
|
+
def initialize: (service: String, name: String, request_type: Object, response_type: Object, ?cardinality: :unary, ?idempotency: idempotency) -> void
|
|
15
|
+
attr_reader service: String
|
|
16
|
+
attr_reader name: String
|
|
17
|
+
attr_reader idempotency: idempotency
|
|
18
|
+
attr_reader path: String
|
|
19
|
+
attr_reader request_type: Object
|
|
20
|
+
attr_reader response_type: Object
|
|
21
|
+
def cardinality: () -> :unary
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
type declaration = Method[untyped, untyped] | ServerStreamMethod[untyped, untyped] | ClientStreamMethod[untyped, untyped] | BidiStreamMethod[untyped, untyped]
|
|
25
|
+
type streaming_cardinality = :server_stream | :client_stream | :bidi_stream
|
|
26
|
+
|
|
27
|
+
class Service
|
|
28
|
+
def initialize: (name: String, methods: Array[declaration]) -> void
|
|
29
|
+
attr_reader name: String
|
|
30
|
+
attr_reader methods: Array[declaration]
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
# Custom token-based codecs erase message identity at this boundary.
|
|
34
|
+
interface _Binding
|
|
35
|
+
def encode: (untyped message, type: Object, codec: codec) -> String
|
|
36
|
+
def decode: (String bytes, type: Object, codec: codec) -> untyped
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
interface _Transport
|
|
40
|
+
def call: (TransportRequest) -> TransportResponse
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
type cancellation_reason = :canceled | :deadline_exceeded
|
|
44
|
+
|
|
45
|
+
# Read-only transport/host cancellation SPI. Each call owns its arbitration.
|
|
46
|
+
interface _Cancellation
|
|
47
|
+
def cancelled?: () -> bool
|
|
48
|
+
def reason: () -> cancellation_reason?
|
|
49
|
+
def check!: () -> nil
|
|
50
|
+
def on_cancel: () { () -> void } -> CancellationRegistration
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
class CancellationSource
|
|
54
|
+
def initialize: () -> void
|
|
55
|
+
attr_reader token: CancellationToken
|
|
56
|
+
def cancel: () -> bool
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
class CancellationToken
|
|
60
|
+
def cancelled?: () -> bool
|
|
61
|
+
def reason: () -> (:canceled | nil)
|
|
62
|
+
def check!: () -> nil
|
|
63
|
+
def on_cancel: () { () -> void } -> CancellationRegistration
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
class CancellationRegistration
|
|
67
|
+
def unregister: () -> bool
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
interface _Input
|
|
71
|
+
def read: (Integer) -> String?
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
interface _Handler[Req, Resp]
|
|
75
|
+
def call: (Req, Context) -> Resp
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
interface _Subscriber
|
|
79
|
+
# Observers may implement any of attach, detach, processing_finished, finished.
|
|
80
|
+
# Ruby's optional structural methods are deliberately not required here.
|
|
81
|
+
def start: (Instrumentation::Call) -> Object?
|
|
82
|
+
end
|
|
83
|
+
|
|
84
|
+
class Instrumentation
|
|
85
|
+
type delivery = :unobserved | :body_closed | :response_finished | :completed | :aborted
|
|
86
|
+
type decision = :processed | :admission_rejected | :host_rejected
|
|
87
|
+
def initialize: (subscribers: Array[_Subscriber], ?on_error: (^(StandardError) -> void | _InstrumentationErrorHandler)?) -> void
|
|
88
|
+
|
|
89
|
+
class Call
|
|
90
|
+
def initialize: (role: :client | :server, protocol: :connect | :grpc | :grpc_web, method: declaration?, server_address: String?, server_port: Integer?, carrier: Hash[String, String | Array[String]]) -> void
|
|
91
|
+
| (:client | :server, :connect | :grpc | :grpc_web, declaration?, String?, Integer?, Hash[String, String | Array[String]]) -> void
|
|
92
|
+
attr_reader role: :client | :server
|
|
93
|
+
attr_reader protocol: :connect | :grpc | :grpc_web
|
|
94
|
+
attr_reader method: declaration?
|
|
95
|
+
attr_reader server_address: String?
|
|
96
|
+
attr_reader server_port: Integer?
|
|
97
|
+
attr_reader carrier: Hash[String, String | Array[String]]
|
|
98
|
+
end
|
|
99
|
+
|
|
100
|
+
class Outcome
|
|
101
|
+
def initialize: (code: String?, http_status: Integer?, error: Exception?, normalized_error: Exception?, duration: Float, request_bytes: Integer?, response_bytes: Integer?, request_metadata: headers, response_metadata: headers) -> void
|
|
102
|
+
| (String?, Integer?, Exception?, Exception?, Float, Integer?, Integer?, headers, headers) -> void
|
|
103
|
+
attr_reader code: String?
|
|
104
|
+
attr_reader http_status: Integer?
|
|
105
|
+
attr_reader error: Exception?
|
|
106
|
+
attr_reader normalized_error: Exception?
|
|
107
|
+
attr_reader duration: Float
|
|
108
|
+
attr_reader request_bytes: Integer?
|
|
109
|
+
attr_reader response_bytes: Integer?
|
|
110
|
+
attr_reader request_metadata: headers
|
|
111
|
+
attr_reader response_metadata: headers
|
|
112
|
+
end
|
|
113
|
+
|
|
114
|
+
class Completion
|
|
115
|
+
def initialize: (outcome: Outcome?, processing_state: :not_started | :running | :finished, decision: decision, delivery: delivery, error: Exception?, http_status: Integer?, duration: Float) -> void
|
|
116
|
+
| (Outcome?, :not_started | :running | :finished, decision, delivery, Exception?, Integer?, Float) -> void
|
|
117
|
+
attr_reader outcome: Outcome?
|
|
118
|
+
attr_reader processing_state: :not_started | :running | :finished
|
|
119
|
+
attr_reader decision: decision
|
|
120
|
+
attr_reader delivery: delivery
|
|
121
|
+
attr_reader error: Exception?
|
|
122
|
+
attr_reader http_status: Integer?
|
|
123
|
+
attr_reader duration: Float
|
|
124
|
+
end
|
|
125
|
+
|
|
126
|
+
class Handle
|
|
127
|
+
def record_failure: (Exception) -> nil
|
|
128
|
+
def host_rejected!: () -> bool
|
|
129
|
+
def host_rejected?: () -> bool
|
|
130
|
+
def activate: [T] () { () -> T } -> T
|
|
131
|
+
def finish: (delivery: delivery, ?error: Exception?, ?decision: decision, ?http_status: Integer?) -> nil
|
|
132
|
+
end
|
|
133
|
+
end
|
|
134
|
+
|
|
135
|
+
interface _Clock
|
|
136
|
+
def call: () -> Numeric
|
|
137
|
+
end
|
|
138
|
+
|
|
139
|
+
interface _Invoker
|
|
140
|
+
def call: (Method[untyped, untyped], untyped, Context) -> untyped
|
|
141
|
+
end
|
|
142
|
+
|
|
143
|
+
interface _InstrumentationErrorHandler
|
|
144
|
+
def call: (StandardError) -> void
|
|
145
|
+
end
|
|
146
|
+
|
|
147
|
+
interface _ObserverAttach
|
|
148
|
+
def attach: () -> Object?
|
|
149
|
+
end
|
|
150
|
+
interface _ObserverDetach
|
|
151
|
+
def detach: (Object?) -> void
|
|
152
|
+
end
|
|
153
|
+
interface _ObserverProcessingFinished
|
|
154
|
+
def processing_finished: (Instrumentation::Outcome) -> void
|
|
155
|
+
end
|
|
156
|
+
interface _ObserverFinished
|
|
157
|
+
def finished: (Instrumentation::Completion) -> void
|
|
158
|
+
end
|
|
159
|
+
|
|
160
|
+
module Bindings
|
|
161
|
+
class GoogleProtobuf
|
|
162
|
+
def encode_status: (Error) -> String
|
|
163
|
+
def decode_status: (String, code: Integer) -> Error
|
|
164
|
+
def initialize: () -> void
|
|
165
|
+
def encode: (untyped message, type: Object, codec: codec) -> String
|
|
166
|
+
def decode: (String bytes, type: Object, codec: codec) -> untyped
|
|
167
|
+
end
|
|
168
|
+
end
|
|
169
|
+
|
|
170
|
+
module Transports
|
|
171
|
+
class NetHTTP
|
|
172
|
+
def initialize: () -> void
|
|
173
|
+
def call: (TransportRequest) -> TransportResponse
|
|
174
|
+
end
|
|
175
|
+
end
|
|
176
|
+
|
|
177
|
+
class Client
|
|
178
|
+
def initialize: (base_url: String, binding: _Binding, ?transport: (_Transport | _StreamingTransport | _GRPCTransport)?, ?codec: codec, ?request_limit: Integer, ?response_limit: Integer, ?request_wire_limit: Integer, ?response_wire_limit: Integer, ?accept_encoding: Array[:identity | :gzip]?, ?use_get: bool, ?get_url_limit: Integer, ?protocol: :connect | :grpc, ?mode: :unary, ?encoding: :identity | :gzip, ?instrumentation: Instrumentation?, ?terminal_wire_limit: Integer, ?terminal_limit: Integer, ?status_codec: _GRPCStatusCodec?, ?grpc_status_wire_limit: Integer, ?grpc_status_limit: Integer) -> void
|
|
179
|
+
def call: [Req, Resp] (Method[Req, Resp], Req request, ?metadata: metadata_input, ?timeout: Numeric?, ?cancellation: CancellationToken?) -> Response[Resp]
|
|
180
|
+
end
|
|
181
|
+
|
|
182
|
+
class Server
|
|
183
|
+
# Generated .handlers checks each concrete callable before this heterogeneous
|
|
184
|
+
# registration map erases its individual request/response associations.
|
|
185
|
+
def initialize: (services: Array[Service], binding: _Binding, ?handlers: Hash[String, registered_handler], ?invoker: (^(Method[untyped, untyped], untyped, Context) -> untyped | _Invoker)?, ?request_limit: Integer, ?response_limit: Integer, ?request_wire_limit: Integer, ?response_wire_limit: Integer, ?protocol: server_protocol_selection, ?mode: :unary, ?encoding: :identity | :gzip, ?instrumentation: Instrumentation?, ?get_query_limit: Integer?, ?terminal_wire_limit: Integer, ?terminal_limit: Integer, ?status_codec: _GRPCStatusCodec?, ?grpc_status_wire_limit: Integer, ?grpc_status_limit: Integer, ?cors: GRPCWebCORS?) -> void
|
|
186
|
+
attr_reader services: Array[Service]
|
|
187
|
+
def handles?: (String path) -> bool
|
|
188
|
+
def start_call: (path: String, headers: headers, ?http_method: String) -> Instrumentation::Handle?
|
|
189
|
+
def call: (path: String, http_method: String, headers: headers, input: _Input?, ?query: String, ?lifecycle: Instrumentation::Handle?, ?cancellation: _Cancellation?) -> TransportResponse
|
|
190
|
+
end
|
|
191
|
+
|
|
192
|
+
# Complete records retain precise readers; partial construction admits nil defaults.
|
|
193
|
+
interface _PartialResponse[M]
|
|
194
|
+
def message: () -> M
|
|
195
|
+
def message=: (M) -> M
|
|
196
|
+
def metadata: () -> Metadata?
|
|
197
|
+
def metadata=: (Metadata?) -> Metadata?
|
|
198
|
+
def trailers: () -> Metadata?
|
|
199
|
+
def trailers=: (Metadata?) -> Metadata?
|
|
200
|
+
def []: (:message | "message" | 0 | -3) -> M
|
|
201
|
+
| (:metadata | "metadata" | 1 | -2) -> Metadata?
|
|
202
|
+
| (:trailers | "trailers" | 2 | -1) -> Metadata?
|
|
203
|
+
def []=: (:message | "message" | 0 | -3, M) -> M
|
|
204
|
+
| (:metadata | "metadata" | 1 | -2, Metadata?) -> Metadata?
|
|
205
|
+
| (:trailers | "trailers" | 2 | -1, Metadata?) -> Metadata?
|
|
206
|
+
def to_h: () -> Hash[Symbol, M? | Metadata?]
|
|
207
|
+
def members: () -> Array[Symbol]
|
|
208
|
+
def size: () -> Integer
|
|
209
|
+
def length: () -> Integer
|
|
210
|
+
def to_a: () -> Array[M? | Metadata?]
|
|
211
|
+
def values: () -> Array[M? | Metadata?]
|
|
212
|
+
def deconstruct: () -> Array[M? | Metadata?]
|
|
213
|
+
def each: () { (M | Metadata | nil) -> void } -> self
|
|
214
|
+
| () -> Enumerator[M | Metadata | nil, self]
|
|
215
|
+
def each_pair: () { ([Symbol, M | Metadata | nil]) -> void } -> self
|
|
216
|
+
| () -> Enumerator[[Symbol, M | Metadata | nil], self]
|
|
217
|
+
def deconstruct_keys: (Array[Symbol]?) -> Hash[Symbol, M | Metadata | nil]
|
|
218
|
+
def values_at: (*(Integer | Range[Integer])) -> Array[M | Metadata | nil | nil]
|
|
219
|
+
|
|
220
|
+
end
|
|
221
|
+
|
|
222
|
+
class Response[M]
|
|
223
|
+
def self.new: [T] (message: T, metadata: Metadata, trailers: Metadata) -> Response[T]
|
|
224
|
+
| [T] ({ message: T, metadata: Metadata, trailers: Metadata }) -> Response[T]
|
|
225
|
+
| [T] (message: T, ?metadata: Metadata?, ?trailers: Metadata?) -> _PartialResponse[T]
|
|
226
|
+
| [T] ({ message: T, ?metadata: Metadata?, ?trailers: Metadata? }) -> _PartialResponse[T]
|
|
227
|
+
| (?metadata: Metadata?, ?trailers: Metadata?) -> _PartialResponse[nil]
|
|
228
|
+
| ({ ?metadata: Metadata?, ?trailers: Metadata? }) -> _PartialResponse[nil]
|
|
229
|
+
def self.[]: [T] (message: T, metadata: Metadata, trailers: Metadata) -> Response[T]
|
|
230
|
+
| [T] ({ message: T, metadata: Metadata, trailers: Metadata }) -> Response[T]
|
|
231
|
+
| [T] (message: T, ?metadata: Metadata?, ?trailers: Metadata?) -> _PartialResponse[T]
|
|
232
|
+
| [T] ({ message: T, ?metadata: Metadata?, ?trailers: Metadata? }) -> _PartialResponse[T]
|
|
233
|
+
| (?metadata: Metadata?, ?trailers: Metadata?) -> _PartialResponse[nil]
|
|
234
|
+
| ({ ?metadata: Metadata?, ?trailers: Metadata? }) -> _PartialResponse[nil]
|
|
235
|
+
attr_accessor message: M
|
|
236
|
+
attr_accessor metadata: Metadata
|
|
237
|
+
attr_accessor trailers: Metadata
|
|
238
|
+
def []: (:message | "message" | 0 | -3) -> M
|
|
239
|
+
| (:metadata | "metadata" | 1 | -2) -> Metadata
|
|
240
|
+
| (:trailers | "trailers" | 2 | -1) -> Metadata
|
|
241
|
+
def []=: (:message | "message" | 0 | -3, M) -> M
|
|
242
|
+
| (:metadata | "metadata" | 1 | -2, Metadata) -> Metadata
|
|
243
|
+
| (:trailers | "trailers" | 2 | -1, Metadata) -> Metadata
|
|
244
|
+
def to_h: () -> Hash[Symbol, M | Metadata]
|
|
245
|
+
def members: () -> Array[Symbol]
|
|
246
|
+
def size: () -> Integer
|
|
247
|
+
def length: () -> Integer
|
|
248
|
+
def to_a: () -> Array[M | Metadata]
|
|
249
|
+
def values: () -> Array[M | Metadata]
|
|
250
|
+
def deconstruct: () -> Array[M | Metadata]
|
|
251
|
+
def each: () { (M | Metadata) -> void } -> self
|
|
252
|
+
| () -> Enumerator[M | Metadata, self]
|
|
253
|
+
def each_pair: () { ([Symbol, M | Metadata]) -> void } -> self
|
|
254
|
+
| () -> Enumerator[[Symbol, M | Metadata], self]
|
|
255
|
+
def deconstruct_keys: (Array[Symbol]?) -> Hash[Symbol, M | Metadata]
|
|
256
|
+
def values_at: (*(Integer | Range[Integer])) -> Array[M | Metadata | nil]
|
|
257
|
+
|
|
258
|
+
end
|
|
259
|
+
|
|
260
|
+
interface _PartialTransportRequest
|
|
261
|
+
def url: () -> URI::Generic?
|
|
262
|
+
def url=: (URI::Generic?) -> URI::Generic?
|
|
263
|
+
def http_method: () -> String?
|
|
264
|
+
def http_method=: (String?) -> String?
|
|
265
|
+
def headers: () -> headers?
|
|
266
|
+
def headers=: (headers?) -> headers?
|
|
267
|
+
def body: () -> String?
|
|
268
|
+
def body=: (String?) -> String?
|
|
269
|
+
def response_limit: () -> Integer?
|
|
270
|
+
def response_limit=: (Integer?) -> Integer?
|
|
271
|
+
def deadline: () -> Deadline?
|
|
272
|
+
def deadline=: (Deadline?) -> Deadline?
|
|
273
|
+
def lifecycle: () -> Instrumentation::Handle?
|
|
274
|
+
def lifecycle=: (Instrumentation::Handle?) -> Instrumentation::Handle?
|
|
275
|
+
def cancellation: () -> _Cancellation?
|
|
276
|
+
def cancellation=: (_Cancellation?) -> _Cancellation?
|
|
277
|
+
def []: (:url | "url" | 0 | -8) -> URI::Generic?
|
|
278
|
+
| (:http_method | "http_method" | 1 | -7) -> String?
|
|
279
|
+
| (:headers | "headers" | 2 | -6) -> headers?
|
|
280
|
+
| (:body | "body" | 3 | -5) -> String?
|
|
281
|
+
| (:response_limit | "response_limit" | 4 | -4) -> Integer?
|
|
282
|
+
| (:deadline | "deadline" | 5 | -3) -> Deadline?
|
|
283
|
+
| (:lifecycle | "lifecycle" | 6 | -2) -> Instrumentation::Handle?
|
|
284
|
+
| (:cancellation | "cancellation" | 7 | -1) -> _Cancellation?
|
|
285
|
+
def []=: (:url | "url" | 0 | -8, URI::Generic?) -> URI::Generic?
|
|
286
|
+
| (:http_method | "http_method" | 1 | -7, String?) -> String?
|
|
287
|
+
| (:headers | "headers" | 2 | -6, headers?) -> headers?
|
|
288
|
+
| (:body | "body" | 3 | -5, String?) -> String?
|
|
289
|
+
| (:response_limit | "response_limit" | 4 | -4, Integer?) -> Integer?
|
|
290
|
+
| (:deadline | "deadline" | 5 | -3, Deadline?) -> Deadline?
|
|
291
|
+
| (:lifecycle | "lifecycle" | 6 | -2, Instrumentation::Handle?) -> Instrumentation::Handle?
|
|
292
|
+
| (:cancellation | "cancellation" | 7 | -1, _Cancellation?) -> _Cancellation?
|
|
293
|
+
def to_h: () -> Hash[Symbol, URI::Generic? | String? | headers? | Integer? | Deadline? | Instrumentation::Handle? | _Cancellation?]
|
|
294
|
+
def members: () -> Array[Symbol]
|
|
295
|
+
def size: () -> Integer
|
|
296
|
+
def length: () -> Integer
|
|
297
|
+
def to_a: () -> Array[URI::Generic? | String? | headers? | Integer? | Deadline? | Instrumentation::Handle? | _Cancellation?]
|
|
298
|
+
def values: () -> Array[URI::Generic? | String? | headers? | Integer? | Deadline? | Instrumentation::Handle? | _Cancellation?]
|
|
299
|
+
def deconstruct: () -> Array[URI::Generic? | String? | headers? | Integer? | Deadline? | Instrumentation::Handle? | _Cancellation?]
|
|
300
|
+
def each: () { (URI::Generic | String | headers | Integer | Deadline | Instrumentation::Handle | _Cancellation | nil) -> void } -> self
|
|
301
|
+
| () -> Enumerator[URI::Generic | String | headers | Integer | Deadline | Instrumentation::Handle | _Cancellation | nil, self]
|
|
302
|
+
def each_pair: () { ([Symbol, URI::Generic | String | headers | Integer | Deadline | Instrumentation::Handle | _Cancellation | nil]) -> void } -> self
|
|
303
|
+
| () -> Enumerator[[Symbol, URI::Generic | String | headers | Integer | Deadline | Instrumentation::Handle | _Cancellation | nil], self]
|
|
304
|
+
def deconstruct_keys: (Array[Symbol]?) -> Hash[Symbol, URI::Generic | String | headers | Integer | Deadline | Instrumentation::Handle | _Cancellation | nil]
|
|
305
|
+
def values_at: (*(Integer | Range[Integer])) -> Array[URI::Generic | String | headers | Integer | Deadline | Instrumentation::Handle | _Cancellation | nil | nil]
|
|
306
|
+
|
|
307
|
+
end
|
|
308
|
+
|
|
309
|
+
class TransportRequest
|
|
310
|
+
def self.new: (url: URI::Generic, http_method: String, headers: headers, body: String, response_limit: Integer, ?deadline: Deadline?, ?lifecycle: Instrumentation::Handle?, ?cancellation: _Cancellation?) -> TransportRequest
|
|
311
|
+
| ({ url: URI::Generic, http_method: String, headers: headers, body: String, response_limit: Integer, ?deadline: Deadline?, ?lifecycle: Instrumentation::Handle?, ?cancellation: _Cancellation? }) -> TransportRequest
|
|
312
|
+
| (?url: URI::Generic?, ?http_method: String?, ?headers: headers?, ?body: String?, ?response_limit: Integer?, ?deadline: Deadline?, ?lifecycle: Instrumentation::Handle?, ?cancellation: _Cancellation?) -> _PartialTransportRequest
|
|
313
|
+
| ({ ?url: URI::Generic?, ?http_method: String?, ?headers: headers?, ?body: String?, ?response_limit: Integer?, ?deadline: Deadline?, ?lifecycle: Instrumentation::Handle?, ?cancellation: _Cancellation? }) -> _PartialTransportRequest
|
|
314
|
+
def self.[]: (url: URI::Generic, http_method: String, headers: headers, body: String, response_limit: Integer, ?deadline: Deadline?, ?lifecycle: Instrumentation::Handle?, ?cancellation: _Cancellation?) -> TransportRequest
|
|
315
|
+
| ({ url: URI::Generic, http_method: String, headers: headers, body: String, response_limit: Integer, ?deadline: Deadline?, ?lifecycle: Instrumentation::Handle?, ?cancellation: _Cancellation? }) -> TransportRequest
|
|
316
|
+
| (?url: URI::Generic?, ?http_method: String?, ?headers: headers?, ?body: String?, ?response_limit: Integer?, ?deadline: Deadline?, ?lifecycle: Instrumentation::Handle?, ?cancellation: _Cancellation?) -> _PartialTransportRequest
|
|
317
|
+
| ({ ?url: URI::Generic?, ?http_method: String?, ?headers: headers?, ?body: String?, ?response_limit: Integer?, ?deadline: Deadline?, ?lifecycle: Instrumentation::Handle?, ?cancellation: _Cancellation? }) -> _PartialTransportRequest
|
|
318
|
+
attr_accessor url: URI::Generic
|
|
319
|
+
attr_accessor http_method: String
|
|
320
|
+
attr_accessor headers: headers
|
|
321
|
+
attr_accessor body: String
|
|
322
|
+
attr_accessor response_limit: Integer
|
|
323
|
+
attr_accessor deadline: Deadline?
|
|
324
|
+
attr_accessor lifecycle: Instrumentation::Handle?
|
|
325
|
+
attr_accessor cancellation: _Cancellation?
|
|
326
|
+
def []: (:url | "url" | 0 | -8) -> URI::Generic
|
|
327
|
+
| (:http_method | "http_method" | 1 | -7) -> String
|
|
328
|
+
| (:headers | "headers" | 2 | -6) -> headers
|
|
329
|
+
| (:body | "body" | 3 | -5) -> String
|
|
330
|
+
| (:response_limit | "response_limit" | 4 | -4) -> Integer
|
|
331
|
+
| (:deadline | "deadline" | 5 | -3) -> Deadline?
|
|
332
|
+
| (:lifecycle | "lifecycle" | 6 | -2) -> Instrumentation::Handle?
|
|
333
|
+
| (:cancellation | "cancellation" | 7 | -1) -> _Cancellation?
|
|
334
|
+
def []=: (:url | "url" | 0 | -8, URI::Generic) -> URI::Generic
|
|
335
|
+
| (:http_method | "http_method" | 1 | -7, String) -> String
|
|
336
|
+
| (:headers | "headers" | 2 | -6, headers) -> headers
|
|
337
|
+
| (:body | "body" | 3 | -5, String) -> String
|
|
338
|
+
| (:response_limit | "response_limit" | 4 | -4, Integer) -> Integer
|
|
339
|
+
| (:deadline | "deadline" | 5 | -3, Deadline?) -> Deadline?
|
|
340
|
+
| (:lifecycle | "lifecycle" | 6 | -2, Instrumentation::Handle?) -> Instrumentation::Handle?
|
|
341
|
+
| (:cancellation | "cancellation" | 7 | -1, _Cancellation?) -> _Cancellation?
|
|
342
|
+
def to_h: () -> Hash[Symbol, URI::Generic | String | headers | Integer | Deadline? | Instrumentation::Handle? | _Cancellation?]
|
|
343
|
+
def members: () -> Array[Symbol]
|
|
344
|
+
def size: () -> Integer
|
|
345
|
+
def length: () -> Integer
|
|
346
|
+
def to_a: () -> Array[URI::Generic | String | headers | Integer | Deadline? | Instrumentation::Handle? | _Cancellation?]
|
|
347
|
+
def values: () -> Array[URI::Generic | String | headers | Integer | Deadline? | Instrumentation::Handle? | _Cancellation?]
|
|
348
|
+
def deconstruct: () -> Array[URI::Generic | String | headers | Integer | Deadline? | Instrumentation::Handle? | _Cancellation?]
|
|
349
|
+
def each: () { (URI::Generic | String | headers | Integer | Deadline | Instrumentation::Handle | _Cancellation | nil) -> void } -> self
|
|
350
|
+
| () -> Enumerator[URI::Generic | String | headers | Integer | Deadline | Instrumentation::Handle | _Cancellation | nil, self]
|
|
351
|
+
def each_pair: () { ([Symbol, URI::Generic | String | headers | Integer | Deadline | Instrumentation::Handle | _Cancellation | nil]) -> void } -> self
|
|
352
|
+
| () -> Enumerator[[Symbol, URI::Generic | String | headers | Integer | Deadline | Instrumentation::Handle | _Cancellation | nil], self]
|
|
353
|
+
def deconstruct_keys: (Array[Symbol]?) -> Hash[Symbol, URI::Generic | String | headers | Integer | Deadline | Instrumentation::Handle | _Cancellation | nil]
|
|
354
|
+
def values_at: (*(Integer | Range[Integer])) -> Array[URI::Generic | String | headers | Integer | Deadline | Instrumentation::Handle | _Cancellation | nil | nil]
|
|
355
|
+
|
|
356
|
+
end
|
|
357
|
+
|
|
358
|
+
interface _PartialTransportResponse
|
|
359
|
+
def status: () -> Integer?
|
|
360
|
+
def status=: (Integer?) -> Integer?
|
|
361
|
+
def headers: () -> headers?
|
|
362
|
+
def headers=: (headers?) -> headers?
|
|
363
|
+
def body: () -> String?
|
|
364
|
+
def body=: (String?) -> String?
|
|
365
|
+
def []: (:status | "status" | 0 | -3) -> Integer?
|
|
366
|
+
| (:headers | "headers" | 1 | -2) -> headers?
|
|
367
|
+
| (:body | "body" | 2 | -1) -> String?
|
|
368
|
+
def []=: (:status | "status" | 0 | -3, Integer?) -> Integer?
|
|
369
|
+
| (:headers | "headers" | 1 | -2, headers?) -> headers?
|
|
370
|
+
| (:body | "body" | 2 | -1, String?) -> String?
|
|
371
|
+
def to_h: () -> Hash[Symbol, Integer? | headers? | String?]
|
|
372
|
+
def members: () -> Array[Symbol]
|
|
373
|
+
def size: () -> Integer
|
|
374
|
+
def length: () -> Integer
|
|
375
|
+
def to_a: () -> Array[Integer? | headers? | String?]
|
|
376
|
+
def values: () -> Array[Integer? | headers? | String?]
|
|
377
|
+
def deconstruct: () -> Array[Integer? | headers? | String?]
|
|
378
|
+
def each: () { (Integer | headers | String | nil) -> void } -> self
|
|
379
|
+
| () -> Enumerator[Integer | headers | String | nil, self]
|
|
380
|
+
def each_pair: () { ([Symbol, Integer | headers | String | nil]) -> void } -> self
|
|
381
|
+
| () -> Enumerator[[Symbol, Integer | headers | String | nil], self]
|
|
382
|
+
def deconstruct_keys: (Array[Symbol]?) -> Hash[Symbol, Integer | headers | String | nil]
|
|
383
|
+
def values_at: (*(Integer | Range[Integer])) -> Array[Integer | headers | String | nil | nil]
|
|
384
|
+
|
|
385
|
+
end
|
|
386
|
+
|
|
387
|
+
class TransportResponse
|
|
388
|
+
def self.new: (status: Integer, headers: headers, body: String) -> TransportResponse
|
|
389
|
+
| ({ status: Integer, headers: headers, body: String }) -> TransportResponse
|
|
390
|
+
| (?status: Integer?, ?headers: headers?, ?body: String?) -> _PartialTransportResponse
|
|
391
|
+
| ({ ?status: Integer?, ?headers: headers?, ?body: String? }) -> _PartialTransportResponse
|
|
392
|
+
def self.[]: (status: Integer, headers: headers, body: String) -> TransportResponse
|
|
393
|
+
| ({ status: Integer, headers: headers, body: String }) -> TransportResponse
|
|
394
|
+
| (?status: Integer?, ?headers: headers?, ?body: String?) -> _PartialTransportResponse
|
|
395
|
+
| ({ ?status: Integer?, ?headers: headers?, ?body: String? }) -> _PartialTransportResponse
|
|
396
|
+
attr_accessor status: Integer
|
|
397
|
+
attr_accessor headers: headers
|
|
398
|
+
attr_accessor body: String
|
|
399
|
+
def []: (:status | "status" | 0 | -3) -> Integer
|
|
400
|
+
| (:headers | "headers" | 1 | -2) -> headers
|
|
401
|
+
| (:body | "body" | 2 | -1) -> String
|
|
402
|
+
def []=: (:status | "status" | 0 | -3, Integer) -> Integer
|
|
403
|
+
| (:headers | "headers" | 1 | -2, headers) -> headers
|
|
404
|
+
| (:body | "body" | 2 | -1, String) -> String
|
|
405
|
+
def to_h: () -> Hash[Symbol, Integer | headers | String]
|
|
406
|
+
def members: () -> Array[Symbol]
|
|
407
|
+
def size: () -> Integer
|
|
408
|
+
def length: () -> Integer
|
|
409
|
+
def to_a: () -> Array[Integer | headers | String]
|
|
410
|
+
def values: () -> Array[Integer | headers | String]
|
|
411
|
+
def deconstruct: () -> Array[Integer | headers | String]
|
|
412
|
+
def each: () { (Integer | headers | String) -> void } -> self
|
|
413
|
+
| () -> Enumerator[Integer | headers | String, self]
|
|
414
|
+
def each_pair: () { ([Symbol, Integer | headers | String]) -> void } -> self
|
|
415
|
+
| () -> Enumerator[[Symbol, Integer | headers | String], self]
|
|
416
|
+
def deconstruct_keys: (Array[Symbol]?) -> Hash[Symbol, Integer | headers | String]
|
|
417
|
+
def values_at: (*(Integer | Range[Integer])) -> Array[Integer | headers | String | nil]
|
|
418
|
+
|
|
419
|
+
end
|
|
420
|
+
|
|
421
|
+
class Metadata
|
|
422
|
+
include Enumerable[[String, Array[String]]]
|
|
423
|
+
def initialize: (?metadata_input values) -> void
|
|
424
|
+
def self.reserved?: (String) -> bool
|
|
425
|
+
def self.encode_binary: (String) -> String
|
|
426
|
+
def self.decode_binary: (String) -> String
|
|
427
|
+
def []: (String key) -> Array[String]?
|
|
428
|
+
def []=: (String key, String | Array[String] entries) -> Array[String]
|
|
429
|
+
def add: (String key, String value) -> self
|
|
430
|
+
def add_binary: (String key, String bytes) -> self
|
|
431
|
+
def binary: (String key) -> Array[String]
|
|
432
|
+
def each: () { ([String, Array[String]]) -> void } -> headers
|
|
433
|
+
| () -> Enumerator[[String, Array[String]], headers]
|
|
434
|
+
def to_h: () -> headers
|
|
435
|
+
end
|
|
436
|
+
|
|
437
|
+
class Deadline
|
|
438
|
+
MAX_NATIVE_WAIT: Float
|
|
439
|
+
def initialize: (Numeric timeout, ?clock: ^() -> Numeric | _Clock) -> void
|
|
440
|
+
def remaining: () -> Numeric
|
|
441
|
+
def expired?: () -> bool
|
|
442
|
+
def native_timeout: () -> Numeric
|
|
443
|
+
def check!: () -> nil
|
|
444
|
+
def timeout_ms: () -> String
|
|
445
|
+
end
|
|
446
|
+
|
|
447
|
+
class Context
|
|
448
|
+
def initialize: (?request_metadata: metadata_input, ?deadline: Deadline?, ?lifecycle: Instrumentation::Handle?, ?cancellation: _Cancellation?) -> void
|
|
449
|
+
attr_reader request_metadata: Metadata
|
|
450
|
+
attr_reader response_metadata: Metadata
|
|
451
|
+
attr_reader response_trailers: Metadata
|
|
452
|
+
attr_reader deadline: Deadline?
|
|
453
|
+
def record_failure: (Exception error) -> nil
|
|
454
|
+
def cancelled?: () -> bool
|
|
455
|
+
def check!: () -> nil
|
|
456
|
+
def cancellation_reason: () -> cancellation_reason?
|
|
457
|
+
end
|
|
458
|
+
|
|
459
|
+
class CodecError < StandardError
|
|
460
|
+
end
|
|
461
|
+
|
|
462
|
+
class ErrorDetail
|
|
463
|
+
def initialize: (type: String, value: String) -> void
|
|
464
|
+
attr_reader type: String
|
|
465
|
+
attr_reader value: String
|
|
466
|
+
def decode: (binding: _Binding, type: Object) -> untyped
|
|
467
|
+
def to_h: () -> Hash[String, String]
|
|
468
|
+
end
|
|
469
|
+
|
|
470
|
+
class Error < StandardError
|
|
471
|
+
def initialize: (String | Symbol code, ?String message, ?details: Array[ErrorDetail], ?metadata: metadata_input, ?trailers: metadata_input) -> void
|
|
472
|
+
attr_reader code: String
|
|
473
|
+
attr_reader details: Array[ErrorDetail]
|
|
474
|
+
attr_reader metadata: Metadata
|
|
475
|
+
attr_reader trailers: Metadata
|
|
476
|
+
def http_status: () -> Integer
|
|
477
|
+
def to_h: () -> Hash[String, String | Array[Hash[String, String]]]
|
|
478
|
+
end
|
|
479
|
+
end
|
|
480
|
+
|
|
481
|
+
module ConnectRPC
|
|
482
|
+
|
|
483
|
+
class StreamStateError < StandardError
|
|
484
|
+
end
|
|
485
|
+
class StreamNotConsumedError < StreamStateError
|
|
486
|
+
end
|
|
487
|
+
|
|
488
|
+
class StreamDeclaration[Req, Resp]
|
|
489
|
+
def initialize: (service: String, name: String, request_type: Object, response_type: Object, ?idempotency: idempotency) -> void
|
|
490
|
+
attr_reader service: String
|
|
491
|
+
attr_reader name: String
|
|
492
|
+
attr_reader idempotency: idempotency
|
|
493
|
+
attr_reader path: String
|
|
494
|
+
attr_reader request_type: Object
|
|
495
|
+
attr_reader response_type: Object
|
|
496
|
+
end
|
|
497
|
+
class ServerStreamMethod[Req, Resp] < StreamDeclaration[Req, Resp]
|
|
498
|
+
def cardinality: () -> :server_stream
|
|
499
|
+
end
|
|
500
|
+
class ClientStreamMethod[Req, Resp] < StreamDeclaration[Req, Resp]
|
|
501
|
+
def cardinality: () -> :client_stream
|
|
502
|
+
end
|
|
503
|
+
class BidiStreamMethod[Req, Resp] < StreamDeclaration[Req, Resp]
|
|
504
|
+
def cardinality: () -> :bidi_stream
|
|
505
|
+
end
|
|
506
|
+
|
|
507
|
+
interface _StreamingTransport
|
|
508
|
+
def respond_to?: (Symbol, ?bool) -> bool
|
|
509
|
+
def streaming_capabilities: () -> Array[streaming_cardinality]
|
|
510
|
+
def open_stream: [T] (StreamRequest) { (_StreamExchange) -> T } -> T
|
|
511
|
+
end
|
|
512
|
+
interface _StreamExchange
|
|
513
|
+
def response_head: (?timeout: Numeric?) -> StreamHead
|
|
514
|
+
def read: (Integer, ?timeout: Numeric?) -> String?
|
|
515
|
+
def write: (String) -> nil
|
|
516
|
+
def close_send: () -> nil
|
|
517
|
+
def finish: (?timeout: Numeric?) -> nil
|
|
518
|
+
def abort: () -> nil
|
|
519
|
+
end
|
|
520
|
+
interface _StreamingInput
|
|
521
|
+
def read: (Integer, ?timeout: Numeric?) -> String?
|
|
522
|
+
end
|
|
523
|
+
interface _StreamingOutput
|
|
524
|
+
def write: (String, ?timeout: Numeric?) -> nil
|
|
525
|
+
def abort: () -> nil
|
|
526
|
+
end
|
|
527
|
+
interface _PublishStreamHead
|
|
528
|
+
def call: (StreamHead) -> void
|
|
529
|
+
end
|
|
530
|
+
|
|
531
|
+
class StreamingContext < Context
|
|
532
|
+
def send_headers: (?metadata: metadata_input) -> nil
|
|
533
|
+
end
|
|
534
|
+
class ResponseReader[Resp]
|
|
535
|
+
def receive: () -> Resp?
|
|
536
|
+
def each: () { (Resp) -> void } -> nil
|
|
537
|
+
def headers: () -> Metadata
|
|
538
|
+
def trailers: () -> Metadata?
|
|
539
|
+
def abandon: () -> nil
|
|
540
|
+
end
|
|
541
|
+
class RequestWriter[Req]
|
|
542
|
+
def send_message: (Req) -> nil
|
|
543
|
+
def close_send: () -> nil
|
|
544
|
+
def abandon: () -> nil
|
|
545
|
+
end
|
|
546
|
+
class ClientDuplex[Req, Resp] < ResponseReader[Resp]
|
|
547
|
+
def send_message: (Req) -> nil
|
|
548
|
+
def close_send: () -> nil
|
|
549
|
+
end
|
|
550
|
+
class RequestReader[Req] < ResponseReader[Req]
|
|
551
|
+
end
|
|
552
|
+
class ResponseWriter[Resp]
|
|
553
|
+
def send_message: (Resp) -> nil
|
|
554
|
+
def send_headers: (?metadata: metadata_input) -> nil
|
|
555
|
+
end
|
|
556
|
+
class ServerDuplex[Req, Resp] < RequestReader[Req]
|
|
557
|
+
def send_message: (Resp) -> nil
|
|
558
|
+
def send_headers: (?metadata: metadata_input) -> nil
|
|
559
|
+
end
|
|
560
|
+
|
|
561
|
+
interface _ServerStreamHandler[Req, Resp]
|
|
562
|
+
def call: (Req, ResponseWriter[Resp], StreamingContext) -> void
|
|
563
|
+
end
|
|
564
|
+
interface _ClientStreamHandler[Req, Resp]
|
|
565
|
+
def call: (RequestReader[Req], StreamingContext) -> Resp
|
|
566
|
+
end
|
|
567
|
+
interface _BidiStreamHandler[Req, Resp]
|
|
568
|
+
def call: (ServerDuplex[Req, Resp], StreamingContext) -> void
|
|
569
|
+
end
|
|
570
|
+
type registered_handler = _Handler[untyped, untyped] | ^(untyped, Context) -> untyped
|
|
571
|
+
| _ServerStreamHandler[untyped, untyped] | ^(untyped, ResponseWriter[untyped], StreamingContext) -> void
|
|
572
|
+
| _ClientStreamHandler[untyped, untyped] | ^(RequestReader[untyped], StreamingContext) -> untyped
|
|
573
|
+
| _BidiStreamHandler[untyped, untyped] | ^(ServerDuplex[untyped, untyped], StreamingContext) -> void
|
|
574
|
+
|
|
575
|
+
class Client
|
|
576
|
+
def server_stream: [Req, Resp] (ServerStreamMethod[Req, Resp], Req, ?metadata: metadata_input, ?timeout: Numeric?, ?cancellation: CancellationToken?) { (ResponseReader[Resp]) -> void } -> nil
|
|
577
|
+
def client_stream: [Req, Resp] (ClientStreamMethod[Req, Resp], ?metadata: metadata_input, ?timeout: Numeric?, ?cancellation: CancellationToken?) { (RequestWriter[Req]) -> void } -> Response[Resp]
|
|
578
|
+
def bidi_stream: [Req, Resp] (BidiStreamMethod[Req, Resp], ?metadata: metadata_input, ?timeout: Numeric?, ?cancellation: CancellationToken?) { (ClientDuplex[Req, Resp]) -> void } -> nil
|
|
579
|
+
end
|
|
580
|
+
class Server
|
|
581
|
+
def call_stream: (path: String, http_method: String, headers: headers, input: _StreamingInput, output: _StreamingOutput, publish: _PublishStreamHead | ^(StreamHead) -> void, ?lifecycle: Instrumentation::Handle?, ?cancellation: _Cancellation?, ?http2: bool, ?capabilities: Array[streaming_cardinality]?) -> TransportResponse?
|
|
582
|
+
end
|
|
583
|
+
interface _PartialStreamRequest
|
|
584
|
+
def url: () -> URI::Generic?
|
|
585
|
+
def url=: (URI::Generic?) -> URI::Generic?
|
|
586
|
+
def http_method: () -> String?
|
|
587
|
+
def http_method=: (String?) -> String?
|
|
588
|
+
def headers: () -> headers?
|
|
589
|
+
def headers=: (headers?) -> headers?
|
|
590
|
+
def deadline: () -> Deadline?
|
|
591
|
+
def deadline=: (Deadline?) -> Deadline?
|
|
592
|
+
def lifecycle: () -> Instrumentation::Handle?
|
|
593
|
+
def lifecycle=: (Instrumentation::Handle?) -> Instrumentation::Handle?
|
|
594
|
+
def cancellation: () -> _Cancellation?
|
|
595
|
+
def cancellation=: (_Cancellation?) -> _Cancellation?
|
|
596
|
+
def []: (:url | "url" | 0 | -6) -> URI::Generic?
|
|
597
|
+
| (:http_method | "http_method" | 1 | -5) -> String?
|
|
598
|
+
| (:headers | "headers" | 2 | -4) -> headers?
|
|
599
|
+
| (:deadline | "deadline" | 3 | -3) -> Deadline?
|
|
600
|
+
| (:lifecycle | "lifecycle" | 4 | -2) -> Instrumentation::Handle?
|
|
601
|
+
| (:cancellation | "cancellation" | 5 | -1) -> _Cancellation?
|
|
602
|
+
def []=: (:url | "url" | 0 | -6, URI::Generic?) -> URI::Generic?
|
|
603
|
+
| (:http_method | "http_method" | 1 | -5, String?) -> String?
|
|
604
|
+
| (:headers | "headers" | 2 | -4, headers?) -> headers?
|
|
605
|
+
| (:deadline | "deadline" | 3 | -3, Deadline?) -> Deadline?
|
|
606
|
+
| (:lifecycle | "lifecycle" | 4 | -2, Instrumentation::Handle?) -> Instrumentation::Handle?
|
|
607
|
+
| (:cancellation | "cancellation" | 5 | -1, _Cancellation?) -> _Cancellation?
|
|
608
|
+
def to_h: () -> Hash[Symbol, URI::Generic | String | headers | Deadline? | Instrumentation::Handle? | _Cancellation? | nil]
|
|
609
|
+
def members: () -> Array[Symbol]
|
|
610
|
+
def size: () -> Integer
|
|
611
|
+
def length: () -> Integer
|
|
612
|
+
def to_a: () -> Array[URI::Generic | String | headers | Deadline? | Instrumentation::Handle? | _Cancellation? | nil]
|
|
613
|
+
def values: () -> Array[URI::Generic | String | headers | Deadline? | Instrumentation::Handle? | _Cancellation? | nil]
|
|
614
|
+
def deconstruct: () -> Array[URI::Generic | String | headers | Deadline? | Instrumentation::Handle? | _Cancellation? | nil]
|
|
615
|
+
def each: () { (URI::Generic | String | headers | Deadline? | Instrumentation::Handle? | _Cancellation? | nil) -> void } -> self
|
|
616
|
+
| () -> Enumerator[URI::Generic | String | headers | Deadline? | Instrumentation::Handle? | _Cancellation? | nil, self]
|
|
617
|
+
def each_pair: () { ([Symbol, URI::Generic | String | headers | Deadline? | Instrumentation::Handle? | _Cancellation? | nil]) -> void } -> self
|
|
618
|
+
| () -> Enumerator[[Symbol, URI::Generic | String | headers | Deadline? | Instrumentation::Handle? | _Cancellation? | nil], self]
|
|
619
|
+
def deconstruct_keys: (Array[Symbol]?) -> Hash[Symbol, URI::Generic | String | headers | Deadline? | Instrumentation::Handle? | _Cancellation? | nil]
|
|
620
|
+
def values_at: (*(Integer | Range[Integer])) -> Array[URI::Generic | String | headers | Deadline? | Instrumentation::Handle? | _Cancellation? | nil | nil]
|
|
621
|
+
end
|
|
622
|
+
class StreamRequest
|
|
623
|
+
def self.new: (url: URI::Generic, http_method: String, headers: headers, ?deadline: Deadline?, ?lifecycle: Instrumentation::Handle?, ?cancellation: _Cancellation?) -> StreamRequest
|
|
624
|
+
| ({ url: URI::Generic, http_method: String, headers: headers, ?deadline: Deadline?, ?lifecycle: Instrumentation::Handle?, ?cancellation: _Cancellation? }) -> StreamRequest
|
|
625
|
+
| (?url: URI::Generic?, ?http_method: String?, ?headers: headers?, ?deadline: Deadline?, ?lifecycle: Instrumentation::Handle?, ?cancellation: _Cancellation?) -> _PartialStreamRequest
|
|
626
|
+
| ({ ?url: URI::Generic?, ?http_method: String?, ?headers: headers?, ?deadline: Deadline?, ?lifecycle: Instrumentation::Handle?, ?cancellation: _Cancellation? }) -> _PartialStreamRequest
|
|
627
|
+
def self.[]: (url: URI::Generic, http_method: String, headers: headers, ?deadline: Deadline?, ?lifecycle: Instrumentation::Handle?, ?cancellation: _Cancellation?) -> StreamRequest
|
|
628
|
+
| ({ url: URI::Generic, http_method: String, headers: headers, ?deadline: Deadline?, ?lifecycle: Instrumentation::Handle?, ?cancellation: _Cancellation? }) -> StreamRequest
|
|
629
|
+
| (?url: URI::Generic?, ?http_method: String?, ?headers: headers?, ?deadline: Deadline?, ?lifecycle: Instrumentation::Handle?, ?cancellation: _Cancellation?) -> _PartialStreamRequest
|
|
630
|
+
| ({ ?url: URI::Generic?, ?http_method: String?, ?headers: headers?, ?deadline: Deadline?, ?lifecycle: Instrumentation::Handle?, ?cancellation: _Cancellation? }) -> _PartialStreamRequest
|
|
631
|
+
attr_accessor url: URI::Generic
|
|
632
|
+
attr_accessor http_method: String
|
|
633
|
+
attr_accessor headers: headers
|
|
634
|
+
attr_accessor deadline: Deadline?
|
|
635
|
+
attr_accessor lifecycle: Instrumentation::Handle?
|
|
636
|
+
attr_accessor cancellation: _Cancellation?
|
|
637
|
+
def []: (:url | "url" | 0 | -6) -> URI::Generic
|
|
638
|
+
| (:http_method | "http_method" | 1 | -5) -> String
|
|
639
|
+
| (:headers | "headers" | 2 | -4) -> headers
|
|
640
|
+
| (:deadline | "deadline" | 3 | -3) -> Deadline?
|
|
641
|
+
| (:lifecycle | "lifecycle" | 4 | -2) -> Instrumentation::Handle?
|
|
642
|
+
| (:cancellation | "cancellation" | 5 | -1) -> _Cancellation?
|
|
643
|
+
def []=: (:url | "url" | 0 | -6, URI::Generic) -> URI::Generic
|
|
644
|
+
| (:http_method | "http_method" | 1 | -5, String) -> String
|
|
645
|
+
| (:headers | "headers" | 2 | -4, headers) -> headers
|
|
646
|
+
| (:deadline | "deadline" | 3 | -3, Deadline?) -> Deadline?
|
|
647
|
+
| (:lifecycle | "lifecycle" | 4 | -2, Instrumentation::Handle?) -> Instrumentation::Handle?
|
|
648
|
+
| (:cancellation | "cancellation" | 5 | -1, _Cancellation?) -> _Cancellation?
|
|
649
|
+
def to_h: () -> Hash[Symbol, URI::Generic | String | headers | Deadline? | Instrumentation::Handle? | _Cancellation?]
|
|
650
|
+
def members: () -> Array[Symbol]
|
|
651
|
+
def size: () -> Integer
|
|
652
|
+
def length: () -> Integer
|
|
653
|
+
def to_a: () -> Array[URI::Generic | String | headers | Deadline? | Instrumentation::Handle? | _Cancellation?]
|
|
654
|
+
def values: () -> Array[URI::Generic | String | headers | Deadline? | Instrumentation::Handle? | _Cancellation?]
|
|
655
|
+
def deconstruct: () -> Array[URI::Generic | String | headers | Deadline? | Instrumentation::Handle? | _Cancellation?]
|
|
656
|
+
def each: () { (URI::Generic | String | headers | Deadline? | Instrumentation::Handle? | _Cancellation?) -> void } -> self
|
|
657
|
+
| () -> Enumerator[URI::Generic | String | headers | Deadline? | Instrumentation::Handle? | _Cancellation?, self]
|
|
658
|
+
def each_pair: () { ([Symbol, URI::Generic | String | headers | Deadline? | Instrumentation::Handle? | _Cancellation?]) -> void } -> self
|
|
659
|
+
| () -> Enumerator[[Symbol, URI::Generic | String | headers | Deadline? | Instrumentation::Handle? | _Cancellation?], self]
|
|
660
|
+
def deconstruct_keys: (Array[Symbol]?) -> Hash[Symbol, URI::Generic | String | headers | Deadline? | Instrumentation::Handle? | _Cancellation?]
|
|
661
|
+
def values_at: (*(Integer | Range[Integer])) -> Array[URI::Generic | String | headers | Deadline? | Instrumentation::Handle? | _Cancellation? | nil]
|
|
662
|
+
end
|
|
663
|
+
interface _PartialStreamHead
|
|
664
|
+
def status: () -> Integer?
|
|
665
|
+
def status=: (Integer?) -> Integer?
|
|
666
|
+
def headers: () -> headers?
|
|
667
|
+
def headers=: (headers?) -> headers?
|
|
668
|
+
def []: (:status | "status" | 0 | -2) -> Integer?
|
|
669
|
+
| (:headers | "headers" | 1 | -1) -> headers?
|
|
670
|
+
def []=: (:status | "status" | 0 | -2, Integer?) -> Integer?
|
|
671
|
+
| (:headers | "headers" | 1 | -1, headers?) -> headers?
|
|
672
|
+
def to_h: () -> Hash[Symbol, Integer | headers | nil]
|
|
673
|
+
def members: () -> Array[Symbol]
|
|
674
|
+
def size: () -> Integer
|
|
675
|
+
def length: () -> Integer
|
|
676
|
+
def to_a: () -> Array[Integer | headers | nil]
|
|
677
|
+
def values: () -> Array[Integer | headers | nil]
|
|
678
|
+
def deconstruct: () -> Array[Integer | headers | nil]
|
|
679
|
+
def each: () { (Integer | headers | nil) -> void } -> self
|
|
680
|
+
| () -> Enumerator[Integer | headers | nil, self]
|
|
681
|
+
def each_pair: () { ([Symbol, Integer | headers | nil]) -> void } -> self
|
|
682
|
+
| () -> Enumerator[[Symbol, Integer | headers | nil], self]
|
|
683
|
+
def deconstruct_keys: (Array[Symbol]?) -> Hash[Symbol, Integer | headers | nil]
|
|
684
|
+
def values_at: (*(Integer | Range[Integer])) -> Array[Integer | headers | nil | nil]
|
|
685
|
+
end
|
|
686
|
+
class StreamHead
|
|
687
|
+
def self.new: (status: Integer, headers: headers) -> StreamHead
|
|
688
|
+
| ({ status: Integer, headers: headers }) -> StreamHead
|
|
689
|
+
| (?status: Integer?, ?headers: headers?) -> _PartialStreamHead
|
|
690
|
+
| ({ ?status: Integer?, ?headers: headers? }) -> _PartialStreamHead
|
|
691
|
+
def self.[]: (status: Integer, headers: headers) -> StreamHead
|
|
692
|
+
| ({ status: Integer, headers: headers }) -> StreamHead
|
|
693
|
+
| (?status: Integer?, ?headers: headers?) -> _PartialStreamHead
|
|
694
|
+
| ({ ?status: Integer?, ?headers: headers? }) -> _PartialStreamHead
|
|
695
|
+
attr_accessor status: Integer
|
|
696
|
+
attr_accessor headers: headers
|
|
697
|
+
def []: (:status | "status" | 0 | -2) -> Integer
|
|
698
|
+
| (:headers | "headers" | 1 | -1) -> headers
|
|
699
|
+
def []=: (:status | "status" | 0 | -2, Integer) -> Integer
|
|
700
|
+
| (:headers | "headers" | 1 | -1, headers) -> headers
|
|
701
|
+
def to_h: () -> Hash[Symbol, Integer | headers]
|
|
702
|
+
def members: () -> Array[Symbol]
|
|
703
|
+
def size: () -> Integer
|
|
704
|
+
def length: () -> Integer
|
|
705
|
+
def to_a: () -> Array[Integer | headers]
|
|
706
|
+
def values: () -> Array[Integer | headers]
|
|
707
|
+
def deconstruct: () -> Array[Integer | headers]
|
|
708
|
+
def each: () { (Integer | headers) -> void } -> self
|
|
709
|
+
| () -> Enumerator[Integer | headers, self]
|
|
710
|
+
def each_pair: () { ([Symbol, Integer | headers]) -> void } -> self
|
|
711
|
+
| () -> Enumerator[[Symbol, Integer | headers], self]
|
|
712
|
+
def deconstruct_keys: (Array[Symbol]?) -> Hash[Symbol, Integer | headers]
|
|
713
|
+
def values_at: (*(Integer | Range[Integer])) -> Array[Integer | headers | nil]
|
|
714
|
+
end
|
|
715
|
+
end
|
|
716
|
+
|
|
717
|
+
module ConnectRPC
|
|
718
|
+
type grpc_cardinality = :unary | streaming_cardinality
|
|
719
|
+
interface _GRPCStatusCodec
|
|
720
|
+
def encode_status: (Error) -> String
|
|
721
|
+
def decode_status: (String, code: Integer) -> Error
|
|
722
|
+
end
|
|
723
|
+
interface _GRPCTransport
|
|
724
|
+
def grpc_capabilities: () -> Array[grpc_cardinality]
|
|
725
|
+
def open_grpc_stream: [T] (StreamRequest) { (_GRPCStreamExchange) -> T } -> T
|
|
726
|
+
end
|
|
727
|
+
interface _GRPCStreamExchange
|
|
728
|
+
def response_head: (?timeout: Numeric?) -> GRPCHead
|
|
729
|
+
def read: (Integer, ?timeout: Numeric?) -> String?
|
|
730
|
+
def write: (String) -> nil
|
|
731
|
+
def close_send: () -> nil
|
|
732
|
+
def response_trailers: () -> headers?
|
|
733
|
+
def finish: (?timeout: Numeric?) -> nil
|
|
734
|
+
def abort: () -> nil
|
|
735
|
+
end
|
|
736
|
+
interface _GRPCOutput
|
|
737
|
+
def write: (String, ?timeout: Numeric?) -> nil
|
|
738
|
+
def finish: (headers: headers) -> nil
|
|
739
|
+
def abort: () -> nil
|
|
740
|
+
end
|
|
741
|
+
interface _PublishGRPCHead
|
|
742
|
+
def call: (GRPCHead) -> void
|
|
743
|
+
end
|
|
744
|
+
class GRPCHead
|
|
745
|
+
def initialize: (status: Integer, headers: headers, end_stream: bool) -> void
|
|
746
|
+
attr_reader status: Integer
|
|
747
|
+
attr_reader headers: headers
|
|
748
|
+
attr_reader end_stream: bool
|
|
749
|
+
end
|
|
750
|
+
class Server
|
|
751
|
+
def call_grpc: (path: String, http_method: String, headers: headers, input: _StreamingInput, output: _GRPCOutput, publish: _PublishGRPCHead | ^(GRPCHead) -> void, ?lifecycle: Instrumentation::Handle?, ?cancellation: _Cancellation?, ?http2: bool) -> TransportResponse?
|
|
752
|
+
end
|
|
753
|
+
end
|
|
754
|
+
|
|
755
|
+
module ConnectRPC
|
|
756
|
+
class GRPCWebCORS
|
|
757
|
+
def initialize: (origins: Array[String], ?credentials: bool, ?request_headers: Array[String], ?expose_headers: Array[String]) -> void
|
|
758
|
+
attr_reader origins: Array[String]
|
|
759
|
+
attr_reader credentials: bool
|
|
760
|
+
attr_reader request_headers: Array[String]
|
|
761
|
+
attr_reader expose_headers: Array[String]
|
|
762
|
+
end
|
|
763
|
+
interface _GRPCWebOutput
|
|
764
|
+
def write: (String, ?timeout: Numeric?) -> nil
|
|
765
|
+
def finish: (terminal: String) -> nil
|
|
766
|
+
def abort: () -> nil
|
|
767
|
+
end
|
|
768
|
+
class Server
|
|
769
|
+
def call_grpc_web: (path: String, http_method: String, headers: headers, input: _StreamingInput, output: _GRPCWebOutput, publish: _PublishStreamHead | ^(StreamHead) -> void, ?capabilities: Array[grpc_web_cardinality], ?lifecycle: Instrumentation::Handle?, ?cancellation: _Cancellation?) -> TransportResponse?
|
|
770
|
+
def cors_response: (path: String, http_method: String, headers: headers, ?response: TransportResponse?) -> TransportResponse?
|
|
771
|
+
end
|
|
772
|
+
end
|