connectrpc-async 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 +542 -0
- data/lib/connectrpc/async/application.rb +173 -0
- data/lib/connectrpc/async/completion_join.rb +249 -0
- data/lib/connectrpc/async/connection.rb +711 -0
- data/lib/connectrpc/async/connection_manager.rb +358 -0
- data/lib/connectrpc/async/connection_policy.rb +60 -0
- data/lib/connectrpc/async/host.rb +171 -0
- data/lib/connectrpc/async/http1_connection.rb +144 -0
- data/lib/connectrpc/async/http1_exchange.rb +27 -0
- data/lib/connectrpc/async/http1_stream.rb +76 -0
- data/lib/connectrpc/async/http1_transport.rb +642 -0
- data/lib/connectrpc/async/ingress.rb +100 -0
- data/lib/connectrpc/async/internal.rb +270 -0
- data/lib/connectrpc/async/server_session.rb +457 -0
- data/lib/connectrpc/async/stream_exchange.rb +324 -0
- data/lib/connectrpc/async/tls.rb +124 -0
- data/lib/connectrpc/async/tls_configuration.rb +309 -0
- data/lib/connectrpc/async/transport.rb +488 -0
- data/lib/connectrpc/async/version.rb +7 -0
- data/lib/connectrpc/async.rb +39 -0
- data/sig/connectrpc-async.rbs +165 -0
- data/sig/manifest.yaml +4 -0
- metadata +202 -0
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
module ConnectRPC
|
|
2
|
+
module Async
|
|
3
|
+
VERSION: String
|
|
4
|
+
type tls = { certificate_chain: Array[String], private_key: String, client_ca: Array[String]? }
|
|
5
|
+
type tls_snapshot = { version: String, certificate_chain: Array[String], private_key: String, client_ca: Array[String]? }
|
|
6
|
+
type tls_category = :invalid | :source | :version_conflict | :timeout | :closed
|
|
7
|
+
type tls_status = { state: :new | :starting | :running | :closing | :closed, generation: Integer?, category: tls_category?, source_check_age: Float?, publication_age: Float? }
|
|
8
|
+
type tls_event = { category: tls_category, status: tls_status }
|
|
9
|
+
interface _TLSProvider
|
|
10
|
+
def call: () -> tls_snapshot
|
|
11
|
+
end
|
|
12
|
+
interface _TLSErrorHandler
|
|
13
|
+
def call: (tls_event) -> void
|
|
14
|
+
end
|
|
15
|
+
interface _Callback
|
|
16
|
+
def call: () -> void
|
|
17
|
+
end
|
|
18
|
+
interface _Headers
|
|
19
|
+
def header: () -> Enumerator[[String, String], Array[[String, String]]]
|
|
20
|
+
end
|
|
21
|
+
interface _Body
|
|
22
|
+
def read: () -> String?
|
|
23
|
+
def length: () -> Integer?
|
|
24
|
+
def close: (?Exception?) -> void
|
|
25
|
+
end
|
|
26
|
+
interface _Request
|
|
27
|
+
def path: () -> String
|
|
28
|
+
def method: () -> String
|
|
29
|
+
def headers: () -> _Headers
|
|
30
|
+
def body: () -> _Body?
|
|
31
|
+
end
|
|
32
|
+
interface _Response
|
|
33
|
+
def status: () -> Integer
|
|
34
|
+
def headers: () -> _Headers
|
|
35
|
+
def body: () -> _Body?
|
|
36
|
+
def body=: (_Body?) -> _Body?
|
|
37
|
+
end
|
|
38
|
+
interface _Application
|
|
39
|
+
def call: (_Request, ?lifecycle: Instrumentation::Handle?) -> _Response?
|
|
40
|
+
end
|
|
41
|
+
interface _LifecycleFactory
|
|
42
|
+
def call: (_Request) -> Instrumentation::Handle?
|
|
43
|
+
end
|
|
44
|
+
# A scheduled task is opaque apart from its supported wait/stop operations.
|
|
45
|
+
interface _Task
|
|
46
|
+
def wait: () -> top
|
|
47
|
+
def stop: () -> void
|
|
48
|
+
end
|
|
49
|
+
interface _Socket
|
|
50
|
+
def close: () -> void
|
|
51
|
+
def closed?: () -> bool
|
|
52
|
+
def remote_address: () -> Addrinfo
|
|
53
|
+
end
|
|
54
|
+
interface _Accepted
|
|
55
|
+
def serve: () -> void
|
|
56
|
+
def close: () -> void
|
|
57
|
+
def wait_closed: () -> nil
|
|
58
|
+
def timeout=: (Numeric?) -> Numeric?
|
|
59
|
+
def remote_address: () -> Addrinfo
|
|
60
|
+
end
|
|
61
|
+
class Application
|
|
62
|
+
def initialize: (server: Server, ?fallback: (_Application | ^(_Request) -> _Response?)?) -> void
|
|
63
|
+
def start_call: (_Request) -> Instrumentation::Handle?
|
|
64
|
+
def call: (_Request, ?lifecycle: Instrumentation::Handle?) -> _Response?
|
|
65
|
+
end
|
|
66
|
+
class TLSConfiguration
|
|
67
|
+
class Error < ArgumentError
|
|
68
|
+
def initialize: (tls_category) -> void
|
|
69
|
+
attr_reader category: tls_category
|
|
70
|
+
end
|
|
71
|
+
def initialize: (?tls: tls?, ?tls_provider: (_TLSProvider | ^() -> tls_snapshot)?, ?refresh_interval: Numeric, ?refresh_jitter: Numeric, ?refresh_timeout: Numeric, ?on_error: (_TLSErrorHandler | ^(tls_event) -> void)?, ?alpn_protocols: Array[String]) -> void
|
|
72
|
+
attr_reader generation: Integer?
|
|
73
|
+
def status: () -> tls_status
|
|
74
|
+
def start: () -> self
|
|
75
|
+
def refresh: () -> Integer
|
|
76
|
+
def reload: (certificate_chain: Array[String], private_key: String, client_ca: Array[String]?) -> Integer
|
|
77
|
+
def close: () -> self
|
|
78
|
+
end
|
|
79
|
+
class Host
|
|
80
|
+
def initialize: (server: Server, ?host: String, ?port: Integer, ?tls: tls?, ?tls_provider: (_TLSProvider | ^() -> tls_snapshot)?, ?max_connections: Integer, ?max_requests: Integer, ?handshake_timeout: Numeric, ?idle_timeout: Numeric?, ?refresh_interval: Numeric, ?refresh_jitter: Numeric, ?refresh_timeout: Numeric, ?on_tls_error: (_TLSErrorHandler | ^(tls_event) -> void)?) -> void
|
|
81
|
+
attr_reader port: Integer?
|
|
82
|
+
attr_reader addresses: Array[Addrinfo]
|
|
83
|
+
def start: () -> self
|
|
84
|
+
def wait: () -> nil
|
|
85
|
+
def close: (?grace: Numeric) -> bool?
|
|
86
|
+
def reload_tls: (certificate_chain: Array[String], private_key: String, client_ca: Array[String]?) -> Integer
|
|
87
|
+
def refresh_tls: () -> Integer
|
|
88
|
+
def drain_tls: (?grace: Numeric) -> bool
|
|
89
|
+
def tls_generation: () -> Integer?
|
|
90
|
+
def tls_status: () -> tls_status
|
|
91
|
+
def peer_certificate: () -> OpenSSL::X509::Certificate?
|
|
92
|
+
end
|
|
93
|
+
type connection_state = :idle | :connecting | :ready | :transient_failure | :closing | :closed
|
|
94
|
+
type connection_outcome = :ready | :refused | :timeout | :tls | :protocol | :closed | :other
|
|
95
|
+
class Backoff
|
|
96
|
+
def initialize: (?base: Numeric, ?multiplier: Numeric, ?jitter: Numeric, ?max: Numeric) -> void
|
|
97
|
+
attr_reader base: Numeric
|
|
98
|
+
attr_reader multiplier: Numeric
|
|
99
|
+
attr_reader jitter: Numeric
|
|
100
|
+
attr_reader max: Numeric
|
|
101
|
+
def ==: (untyped other) -> bool
|
|
102
|
+
def eql?: (untyped other) -> bool
|
|
103
|
+
def hash: () -> Integer
|
|
104
|
+
end
|
|
105
|
+
class ConnectionPolicy
|
|
106
|
+
def initialize: (?backoff: Backoff?, ?wait_for_ready: bool, ?max_pending_bytes: Integer?) -> void
|
|
107
|
+
attr_reader backoff: Backoff?
|
|
108
|
+
attr_reader wait_for_ready: bool
|
|
109
|
+
attr_reader max_pending_bytes: Integer?
|
|
110
|
+
def ==: (untyped other) -> bool
|
|
111
|
+
def eql?: (untyped other) -> bool
|
|
112
|
+
def hash: () -> Integer
|
|
113
|
+
end
|
|
114
|
+
# Frozen observation values, delivered on the owner reactor.
|
|
115
|
+
class ConnectionEvent
|
|
116
|
+
attr_reader type: :state_changed | :attempt_finished | :admission_rejected
|
|
117
|
+
attr_reader state: connection_state
|
|
118
|
+
attr_reader previous_state: connection_state?
|
|
119
|
+
attr_reader outcome: connection_outcome?
|
|
120
|
+
attr_reader duration: Float?
|
|
121
|
+
attr_reader active: Integer
|
|
122
|
+
attr_reader draining: Integer
|
|
123
|
+
attr_reader pending_calls: Integer
|
|
124
|
+
attr_reader pending_bytes: Integer
|
|
125
|
+
end
|
|
126
|
+
interface _ConnectionObserver
|
|
127
|
+
def call: (ConnectionEvent) -> void
|
|
128
|
+
end
|
|
129
|
+
class Transport
|
|
130
|
+
def initialize: (origin: String, ?ca_file: String?, ?certificate_chain: Array[String]?, ?private_key: String?, ?connection_limit: Integer, ?max_requests: Integer, ?connect_timeout: Numeric, ?connection_policy: ConnectionPolicy, ?connection_observer: (_ConnectionObserver | ^(ConnectionEvent) -> void)?) -> void
|
|
131
|
+
def connection_state: () -> connection_state
|
|
132
|
+
def grpc_capabilities: () -> Array[grpc_cardinality]
|
|
133
|
+
def open_grpc_stream: [T] (StreamRequest) { (_GRPCStreamExchange) -> T } -> T
|
|
134
|
+
def streaming_capabilities: () -> Array[streaming_cardinality]
|
|
135
|
+
def open_stream: [T] (StreamRequest) { (_StreamExchange) -> T } -> T
|
|
136
|
+
def call: (TransportRequest) -> TransportResponse
|
|
137
|
+
def close: (?grace: Numeric) -> bool
|
|
138
|
+
end
|
|
139
|
+
class HTTP1Transport
|
|
140
|
+
def initialize: (origin: String, ?ca_file: String?, ?certificate_chain: Array[String]?, ?private_key: String?, ?connection_limit: Integer, ?max_requests: Integer, ?connect_timeout: Numeric) -> void
|
|
141
|
+
def streaming_capabilities: () -> Array[:server_stream | :client_stream]
|
|
142
|
+
def open_stream: [T] (StreamRequest) { (_StreamExchange) -> T } -> T
|
|
143
|
+
def call: (TransportRequest) -> TransportResponse
|
|
144
|
+
def close: (?grace: Numeric) -> bool
|
|
145
|
+
end
|
|
146
|
+
class ServerSession
|
|
147
|
+
# http1 is a backend resource-construction boundary, deliberately opaque.
|
|
148
|
+
interface _HTTP1Factory
|
|
149
|
+
def call: (Object, progress: Object, generation: Integer?) -> Object
|
|
150
|
+
end
|
|
151
|
+
def initialize: (application: _Application | ^(_Request, ?lifecycle: Instrumentation::Handle?) -> _Response?, ?tls: tls?, ?tls_provider: (_TLSProvider | ^() -> tls_snapshot)?, ?max_connections: Integer, ?max_requests: Integer, ?handshake_timeout: Numeric, ?idle_timeout: Numeric?, ?refresh_interval: Numeric, ?refresh_jitter: Numeric, ?refresh_timeout: Numeric, ?on_tls_error: (_TLSErrorHandler | ^(tls_event) -> void)?, ?alpn_protocols: Array[String], ?http1: _HTTP1Factory?, ?stop_accepting: (_Callback | ^() -> void)?, ?on_request_rejected: (_Callback | ^() -> void)?, ?lifecycle_factory: (_LifecycleFactory | ^(_Request) -> Instrumentation::Handle?)?) -> void
|
|
152
|
+
def start: () -> self
|
|
153
|
+
def close: (?grace: Numeric) -> bool?
|
|
154
|
+
def abort: () -> self
|
|
155
|
+
def accept: (_Socket) -> _Accepted?
|
|
156
|
+
def schedule: () { (_Task) -> top } -> _Task
|
|
157
|
+
def reload_tls: (certificate_chain: Array[String], private_key: String, client_ca: Array[String]?) -> Integer
|
|
158
|
+
def refresh_tls: () -> Integer
|
|
159
|
+
def drain_tls: (?grace: Numeric) -> bool
|
|
160
|
+
def tls_generation: () -> Integer?
|
|
161
|
+
def tls_status: () -> tls_status
|
|
162
|
+
def peer_certificate: () -> OpenSSL::X509::Certificate?
|
|
163
|
+
end
|
|
164
|
+
end
|
|
165
|
+
end
|
data/sig/manifest.yaml
ADDED
metadata
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: connectrpc-async
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.1.0
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- jimeh
|
|
8
|
+
bindir: bin
|
|
9
|
+
cert_chain: []
|
|
10
|
+
date: 2026-11-15 00:00:00.000000000 Z
|
|
11
|
+
dependencies:
|
|
12
|
+
- !ruby/object:Gem::Dependency
|
|
13
|
+
name: connectrpc
|
|
14
|
+
requirement: !ruby/object:Gem::Requirement
|
|
15
|
+
requirements:
|
|
16
|
+
- - "~>"
|
|
17
|
+
- !ruby/object:Gem::Version
|
|
18
|
+
version: 0.1.0
|
|
19
|
+
type: :runtime
|
|
20
|
+
prerelease: false
|
|
21
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
22
|
+
requirements:
|
|
23
|
+
- - "~>"
|
|
24
|
+
- !ruby/object:Gem::Version
|
|
25
|
+
version: 0.1.0
|
|
26
|
+
- !ruby/object:Gem::Dependency
|
|
27
|
+
name: async-http
|
|
28
|
+
requirement: !ruby/object:Gem::Requirement
|
|
29
|
+
requirements:
|
|
30
|
+
- - "~>"
|
|
31
|
+
- !ruby/object:Gem::Version
|
|
32
|
+
version: 0.105.0
|
|
33
|
+
type: :runtime
|
|
34
|
+
prerelease: false
|
|
35
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
36
|
+
requirements:
|
|
37
|
+
- - "~>"
|
|
38
|
+
- !ruby/object:Gem::Version
|
|
39
|
+
version: 0.105.0
|
|
40
|
+
- !ruby/object:Gem::Dependency
|
|
41
|
+
name: async
|
|
42
|
+
requirement: !ruby/object:Gem::Requirement
|
|
43
|
+
requirements:
|
|
44
|
+
- - "~>"
|
|
45
|
+
- !ruby/object:Gem::Version
|
|
46
|
+
version: 2.46.0
|
|
47
|
+
type: :runtime
|
|
48
|
+
prerelease: false
|
|
49
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
50
|
+
requirements:
|
|
51
|
+
- - "~>"
|
|
52
|
+
- !ruby/object:Gem::Version
|
|
53
|
+
version: 2.46.0
|
|
54
|
+
- !ruby/object:Gem::Dependency
|
|
55
|
+
name: async-pool
|
|
56
|
+
requirement: !ruby/object:Gem::Requirement
|
|
57
|
+
requirements:
|
|
58
|
+
- - "~>"
|
|
59
|
+
- !ruby/object:Gem::Version
|
|
60
|
+
version: 0.12.0
|
|
61
|
+
type: :runtime
|
|
62
|
+
prerelease: false
|
|
63
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
64
|
+
requirements:
|
|
65
|
+
- - "~>"
|
|
66
|
+
- !ruby/object:Gem::Version
|
|
67
|
+
version: 0.12.0
|
|
68
|
+
- !ruby/object:Gem::Dependency
|
|
69
|
+
name: protocol-http2
|
|
70
|
+
requirement: !ruby/object:Gem::Requirement
|
|
71
|
+
requirements:
|
|
72
|
+
- - "~>"
|
|
73
|
+
- !ruby/object:Gem::Version
|
|
74
|
+
version: 0.29.2
|
|
75
|
+
type: :runtime
|
|
76
|
+
prerelease: false
|
|
77
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
78
|
+
requirements:
|
|
79
|
+
- - "~>"
|
|
80
|
+
- !ruby/object:Gem::Version
|
|
81
|
+
version: 0.29.2
|
|
82
|
+
- !ruby/object:Gem::Dependency
|
|
83
|
+
name: protocol-http1
|
|
84
|
+
requirement: !ruby/object:Gem::Requirement
|
|
85
|
+
requirements:
|
|
86
|
+
- - "~>"
|
|
87
|
+
- !ruby/object:Gem::Version
|
|
88
|
+
version: 0.41.1
|
|
89
|
+
type: :runtime
|
|
90
|
+
prerelease: false
|
|
91
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
92
|
+
requirements:
|
|
93
|
+
- - "~>"
|
|
94
|
+
- !ruby/object:Gem::Version
|
|
95
|
+
version: 0.41.1
|
|
96
|
+
- !ruby/object:Gem::Dependency
|
|
97
|
+
name: protocol-http
|
|
98
|
+
requirement: !ruby/object:Gem::Requirement
|
|
99
|
+
requirements:
|
|
100
|
+
- - "~>"
|
|
101
|
+
- !ruby/object:Gem::Version
|
|
102
|
+
version: 0.72.1
|
|
103
|
+
type: :runtime
|
|
104
|
+
prerelease: false
|
|
105
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
106
|
+
requirements:
|
|
107
|
+
- - "~>"
|
|
108
|
+
- !ruby/object:Gem::Version
|
|
109
|
+
version: 0.72.1
|
|
110
|
+
- !ruby/object:Gem::Dependency
|
|
111
|
+
name: io-endpoint
|
|
112
|
+
requirement: !ruby/object:Gem::Requirement
|
|
113
|
+
requirements:
|
|
114
|
+
- - "~>"
|
|
115
|
+
- !ruby/object:Gem::Version
|
|
116
|
+
version: 0.19.0
|
|
117
|
+
type: :runtime
|
|
118
|
+
prerelease: false
|
|
119
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
120
|
+
requirements:
|
|
121
|
+
- - "~>"
|
|
122
|
+
- !ruby/object:Gem::Version
|
|
123
|
+
version: 0.19.0
|
|
124
|
+
- !ruby/object:Gem::Dependency
|
|
125
|
+
name: io-stream
|
|
126
|
+
requirement: !ruby/object:Gem::Requirement
|
|
127
|
+
requirements:
|
|
128
|
+
- - "~>"
|
|
129
|
+
- !ruby/object:Gem::Version
|
|
130
|
+
version: 0.14.0
|
|
131
|
+
type: :runtime
|
|
132
|
+
prerelease: false
|
|
133
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
134
|
+
requirements:
|
|
135
|
+
- - "~>"
|
|
136
|
+
- !ruby/object:Gem::Version
|
|
137
|
+
version: 0.14.0
|
|
138
|
+
- !ruby/object:Gem::Dependency
|
|
139
|
+
name: openssl
|
|
140
|
+
requirement: !ruby/object:Gem::Requirement
|
|
141
|
+
requirements:
|
|
142
|
+
- - "~>"
|
|
143
|
+
- !ruby/object:Gem::Version
|
|
144
|
+
version: 4.0.2
|
|
145
|
+
type: :runtime
|
|
146
|
+
prerelease: false
|
|
147
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
148
|
+
requirements:
|
|
149
|
+
- - "~>"
|
|
150
|
+
- !ruby/object:Gem::Version
|
|
151
|
+
version: 4.0.2
|
|
152
|
+
executables: []
|
|
153
|
+
extensions: []
|
|
154
|
+
extra_rdoc_files: []
|
|
155
|
+
files:
|
|
156
|
+
- LICENSE
|
|
157
|
+
- README.md
|
|
158
|
+
- lib/connectrpc/async.rb
|
|
159
|
+
- lib/connectrpc/async/application.rb
|
|
160
|
+
- lib/connectrpc/async/completion_join.rb
|
|
161
|
+
- lib/connectrpc/async/connection.rb
|
|
162
|
+
- lib/connectrpc/async/connection_manager.rb
|
|
163
|
+
- lib/connectrpc/async/connection_policy.rb
|
|
164
|
+
- lib/connectrpc/async/host.rb
|
|
165
|
+
- lib/connectrpc/async/http1_connection.rb
|
|
166
|
+
- lib/connectrpc/async/http1_exchange.rb
|
|
167
|
+
- lib/connectrpc/async/http1_stream.rb
|
|
168
|
+
- lib/connectrpc/async/http1_transport.rb
|
|
169
|
+
- lib/connectrpc/async/ingress.rb
|
|
170
|
+
- lib/connectrpc/async/internal.rb
|
|
171
|
+
- lib/connectrpc/async/server_session.rb
|
|
172
|
+
- lib/connectrpc/async/stream_exchange.rb
|
|
173
|
+
- lib/connectrpc/async/tls.rb
|
|
174
|
+
- lib/connectrpc/async/tls_configuration.rb
|
|
175
|
+
- lib/connectrpc/async/transport.rb
|
|
176
|
+
- lib/connectrpc/async/version.rb
|
|
177
|
+
- sig/connectrpc-async.rbs
|
|
178
|
+
- sig/manifest.yaml
|
|
179
|
+
homepage: https://github.com/jimeh/connectrpc-ruby
|
|
180
|
+
licenses:
|
|
181
|
+
- MIT
|
|
182
|
+
metadata:
|
|
183
|
+
allowed_push_host: https://rubygems.org
|
|
184
|
+
rubygems_mfa_required: 'true'
|
|
185
|
+
rdoc_options: []
|
|
186
|
+
require_paths:
|
|
187
|
+
- lib
|
|
188
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
189
|
+
requirements:
|
|
190
|
+
- - ">="
|
|
191
|
+
- !ruby/object:Gem::Version
|
|
192
|
+
version: '3.4'
|
|
193
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
194
|
+
requirements:
|
|
195
|
+
- - ">="
|
|
196
|
+
- !ruby/object:Gem::Version
|
|
197
|
+
version: '0'
|
|
198
|
+
requirements: []
|
|
199
|
+
rubygems_version: 3.6.9
|
|
200
|
+
specification_version: 4
|
|
201
|
+
summary: Optional Async host and HTTP/1.1 and HTTP/2 ConnectRPC transports
|
|
202
|
+
test_files: []
|