Skip to content

Commit 9c67559

Browse files
authored
Native source sync at revision @c92e41c
1 parent c92e41c commit 9c67559

File tree

645 files changed

+18600
-28280
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

645 files changed

+18600
-28280
lines changed

gRPC-C++.podspec

+72-66
Large diffs are not rendered by default.

gRPC-Core.podspec

+94-84
Large diffs are not rendered by default.

gRPC-ProtoRPC.podspec

+5-5
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121

2222
Pod::Spec.new do |s|
2323
s.name = 'gRPC-ProtoRPC'
24-
version = '1.72.0-dev'
24+
version = '1.73.0-dev'
2525
s.version = version
2626
s.summary = 'RPC library for Protocol Buffers, based on gRPC'
2727
s.homepage = 'https://grpc.io'
@@ -33,8 +33,8 @@ Pod::Spec.new do |s|
3333
:tag => "v#{version}",
3434
}
3535

36-
s.ios.deployment_target = '11.0'
37-
s.osx.deployment_target = '10.14'
36+
s.ios.deployment_target = '15.0'
37+
s.osx.deployment_target = '11.0'
3838
s.tvos.deployment_target = '13.0'
3939
s.watchos.deployment_target = '6.0'
4040
s.visionos.deployment_target = '1.0'
@@ -55,7 +55,7 @@ Pod::Spec.new do |s|
5555
ss.header_mappings_dir = "src/objective-c/ProtoRPC"
5656
ss.dependency "#{s.name}/Legacy-Header", version
5757
ss.dependency 'gRPC/Interface', version
58-
ss.dependency 'Protobuf', '~> 3.0'
58+
ss.dependency 'Protobuf', '~> 4.0'
5959

6060
ss.source_files = "src/objective-c/ProtoRPC/ProtoMethod.{h,m}",
6161
"src/objective-c/ProtoRPC/ProtoRPC.{h,m}",
@@ -68,7 +68,7 @@ Pod::Spec.new do |s|
6868
ss.dependency "#{s.name}/Legacy-Header", version
6969
ss.dependency 'gRPC/GRPCCore', version
7070
ss.dependency 'gRPC-RxLibrary', version
71-
ss.dependency 'Protobuf', '~> 3.0'
71+
ss.dependency 'Protobuf', '~> 4.0'
7272

7373
ss.source_files = "src/objective-c/ProtoRPC/ProtoRPCLegacy.m",
7474
"src/objective-c/ProtoRPC/ProtoServiceLegacy.m"

gRPC-RxLibrary.podspec

+3-3
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121

2222
Pod::Spec.new do |s|
2323
s.name = 'gRPC-RxLibrary'
24-
version = '1.72.0-dev'
24+
version = '1.73.0-dev'
2525
s.version = version
2626
s.summary = 'Reactive Extensions library for iOS/OSX.'
2727
s.homepage = 'https://grpc.io'
@@ -33,8 +33,8 @@ Pod::Spec.new do |s|
3333
:tag => "v#{version}",
3434
}
3535

36-
s.ios.deployment_target = '11.0'
37-
s.osx.deployment_target = '10.14'
36+
s.ios.deployment_target = '15.0'
37+
s.osx.deployment_target = '11.0'
3838
s.tvos.deployment_target = '13.0'
3939
s.watchos.deployment_target = '6.0'
4040
s.visionos.deployment_target = '1.0'

gRPC.podspec

+13-32
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121
Pod::Spec.new do |s|
2222
s.name = 'gRPC'
23-
version = '1.72.0-dev'
23+
version = '1.73.0-dev'
2424
s.version = version
2525
s.summary = 'gRPC client library for iOS/OSX'
2626
s.homepage = 'https://grpc.io'
@@ -45,8 +45,8 @@ Pod::Spec.new do |s|
4545
'CLANG_CXX_LANGUAGE_STANDARD' => 'c++17',
4646
}
4747

48-
s.ios.deployment_target = '11.0'
49-
s.osx.deployment_target = '10.14'
48+
s.ios.deployment_target = '15.0'
49+
s.osx.deployment_target = '11.0'
5050
s.tvos.deployment_target = '13.0'
5151
s.watchos.deployment_target = '6.0'
5252
s.visionos.deployment_target = '1.0'
@@ -64,24 +64,22 @@ Pod::Spec.new do |s|
6464

6565
ss.public_header_files = "src/objective-c/GRPCClient/GRPCCall+ChannelArg.h",
6666
"src/objective-c/GRPCClient/GRPCCall+ChannelCredentials.h",
67-
"src/objective-c/GRPCClient/GRPCCall+Cronet.h",
6867
"src/objective-c/GRPCClient/GRPCCall+OAuth2.h",
6968
"src/objective-c/GRPCClient/GRPCCall+Tests.h",
7069
"src/objective-c/GRPCClient/GRPCCallLegacy.h",
7170
"src/objective-c/GRPCClient/GRPCTypes.h"
7271

7372
ss.source_files = "src/objective-c/GRPCClient/GRPCCall+ChannelArg.h",
7473
"src/objective-c/GRPCClient/GRPCCall+ChannelCredentials.h",
75-
"src/objective-c/GRPCClient/GRPCCall+Cronet.h",
7674
"src/objective-c/GRPCClient/GRPCCall+OAuth2.h",
7775
"src/objective-c/GRPCClient/GRPCCall+Tests.h",
7876
"src/objective-c/GRPCClient/GRPCCallLegacy.h",
7977
"src/objective-c/GRPCClient/GRPCTypes.h",
8078
"src/objective-c/GRPCClient/GRPCTypes.mm"
8179
ss.dependency "gRPC-RxLibrary/Interface", version
8280
ss.dependency "#{s.name}/Privacy", version
83-
s.ios.deployment_target = '11.0'
84-
s.osx.deployment_target = '10.14'
81+
s.ios.deployment_target = '15.0'
82+
s.osx.deployment_target = '11.0'
8583
s.tvos.deployment_target = '13.0'
8684
s.watchos.deployment_target = '6.0'
8785
s.visionos.deployment_target = '1.0'
@@ -116,8 +114,8 @@ Pod::Spec.new do |s|
116114

117115
ss.dependency "#{s.name}/Interface-Legacy", version
118116
ss.dependency "#{s.name}/Privacy", version
119-
s.ios.deployment_target = '11.0'
120-
s.osx.deployment_target = '10.14'
117+
s.ios.deployment_target = '15.0'
118+
s.osx.deployment_target = '11.0'
121119
s.tvos.deployment_target = '13.0'
122120
s.watchos.deployment_target = '6.0'
123121
s.visionos.deployment_target = '1.0'
@@ -127,7 +125,6 @@ Pod::Spec.new do |s|
127125
ss.header_mappings_dir = 'src/objective-c/GRPCClient'
128126

129127
ss.public_header_files = 'src/objective-c/GRPCClient/GRPCCall+ChannelCredentials.h',
130-
'src/objective-c/GRPCClient/GRPCCall+Cronet.h',
131128
'src/objective-c/GRPCClient/GRPCCall+OAuth2.h',
132129
'src/objective-c/GRPCClient/GRPCCall+Tests.h',
133130
'src/objective-c/GRPCClient/GRPCCall+ChannelArg.h'
@@ -137,8 +134,6 @@ Pod::Spec.new do |s|
137134
'src/objective-c/GRPCClient/GRPCCall+ChannelArg.mm',
138135
'src/objective-c/GRPCClient/GRPCCall+ChannelCredentials.h',
139136
'src/objective-c/GRPCClient/GRPCCall+ChannelCredentials.mm',
140-
'src/objective-c/GRPCClient/GRPCCall+Cronet.h',
141-
'src/objective-c/GRPCClient/GRPCCall+Cronet.mm',
142137
'src/objective-c/GRPCClient/GRPCCall+OAuth2.h',
143138
'src/objective-c/GRPCClient/GRPCCall+OAuth2.mm',
144139
'src/objective-c/GRPCClient/GRPCCall+Tests.h',
@@ -154,33 +149,19 @@ Pod::Spec.new do |s|
154149
ss.dependency 'gRPC-Core', version
155150
ss.dependency 'gRPC-RxLibrary', version
156151

157-
s.ios.deployment_target = '11.0'
158-
s.osx.deployment_target = '10.14'
152+
s.ios.deployment_target = '15.0'
153+
s.osx.deployment_target = '11.0'
159154
s.tvos.deployment_target = '13.0'
160155
s.watchos.deployment_target = '6.0'
161156
s.visionos.deployment_target = '1.0'
162157
end
163158

164-
s.subspec 'GRPCCoreCronet' do |ss|
165-
ss.header_mappings_dir = 'src/objective-c/GRPCClient'
166-
167-
ss.source_files = 'src/objective-c/GRPCClient/GRPCCall+Cronet.h',
168-
'src/objective-c/GRPCClient/GRPCCall+Cronet.mm',
169-
'src/objective-c/GRPCClient/private/GRPCCore/GRPCCoreCronet/*.{h,mm}'
170-
ss.dependency "#{s.name}/GRPCCore", version
171-
ss.dependency "#{s.name}/Privacy", version
172-
ss.dependency 'gRPC-Core/Cronet-Implementation', version
173-
ss.dependency 'CronetFramework'
174-
175-
ss.ios.deployment_target = '11.0'
176-
end
177-
178159
# CFStream is now default. Leaving this subspec only for compatibility purpose.
179160
s.subspec 'CFStream' do |ss|
180161
ss.dependency "#{s.name}/GRPCCore", version
181162

182-
s.ios.deployment_target = '11.0'
183-
s.osx.deployment_target = '10.14'
163+
s.ios.deployment_target = '15.0'
164+
s.osx.deployment_target = '11.0'
184165
s.tvos.deployment_target = '13.0'
185166
s.watchos.deployment_target = '6.0'
186167
s.visionos.deployment_target = '1.0'
@@ -192,8 +173,8 @@ Pod::Spec.new do |s|
192173
ss.source_files = 'src/objective-c/GRPCClient/internal_testing/*.{h,mm}'
193174
ss.header_mappings_dir = 'src/objective-c/GRPCClient'
194175

195-
s.ios.deployment_target = '11.0'
196-
s.osx.deployment_target = '10.14'
176+
s.ios.deployment_target = '15.0'
177+
s.osx.deployment_target = '11.0'
197178
s.tvos.deployment_target = '13.0'
198179
s.watchos.deployment_target = '6.0'
199180
s.visionos.deployment_target = '1.0'

include/grpc/event_engine/event_engine.h

+125-8
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,14 @@
1616

1717
#include <grpc/event_engine/endpoint_config.h>
1818
#include <grpc/event_engine/extensible.h>
19+
#include <grpc/event_engine/internal/write_event.h>
1920
#include <grpc/event_engine/memory_allocator.h>
2021
#include <grpc/event_engine/port.h>
2122
#include <grpc/event_engine/slice_buffer.h>
2223
#include <grpc/support/port_platform.h>
2324

25+
#include <bitset>
26+
#include <initializer_list>
2427
#include <vector>
2528

2629
#include "absl/functional/any_invocable.h"
@@ -180,13 +183,26 @@ class EventEngine : public std::enable_shared_from_this<EventEngine>,
180183
/// EventEngine Endpoint Read API call.
181184
///
182185
/// Passed as argument to an Endpoint \a Read
183-
struct ReadArgs {
186+
class ReadArgs final {
187+
public:
188+
ReadArgs() = default;
189+
ReadArgs(const ReadArgs&) = delete;
190+
ReadArgs& operator=(const ReadArgs&) = delete;
191+
ReadArgs(ReadArgs&&) = default;
192+
ReadArgs& operator=(ReadArgs&&) = default;
193+
184194
// A suggestion to the endpoint implementation to read at-least the
185195
// specified number of bytes over the network connection before marking
186196
// the endpoint read operation as complete. gRPC may use this argument
187197
// to minimize the number of endpoint read API calls over the lifetime
188198
// of a connection.
189-
int64_t read_hint_bytes;
199+
void set_read_hint_bytes(int64_t read_hint_bytes) {
200+
read_hint_bytes_ = read_hint_bytes;
201+
}
202+
int64_t read_hint_bytes() const { return read_hint_bytes_; }
203+
204+
private:
205+
int64_t read_hint_bytes_ = 1;
190206
};
191207
/// Reads data from the Endpoint.
192208
///
@@ -212,20 +228,110 @@ class EventEngine : public std::enable_shared_from_this<EventEngine>,
212228
/// statuses to \a on_read. For example, callbacks might expect to receive
213229
/// CANCELLED on endpoint shutdown.
214230
virtual bool Read(absl::AnyInvocable<void(absl::Status)> on_read,
215-
SliceBuffer* buffer, const ReadArgs* args) = 0;
231+
SliceBuffer* buffer, ReadArgs args) = 0;
232+
//// The set of write events that can be reported by an Endpoint.
233+
using WriteEvent = ::grpc_event_engine::experimental::internal::WriteEvent;
234+
/// An output WriteMetric consists of a key and a value.
235+
/// The space of keys can be queried from the endpoint via the
236+
/// \a AllWriteMetrics, \a GetMetricName and \a GetMetricKey APIs.
237+
/// The value is an int64_t that is implementation-defined. Check with the
238+
/// endpoint implementation documentation for the semantics of each metric.
239+
struct WriteMetric {
240+
size_t key;
241+
int64_t value;
242+
};
243+
using WriteEventCallback = absl::AnyInvocable<void(
244+
WriteEvent, absl::Time, std::vector<WriteMetric>) const>;
245+
// A bitmask of the events that the caller is interested in.
246+
// Each bit corresponds to an entry in WriteEvent.
247+
using WriteEventSet = std::bitset<static_cast<int>(WriteEvent::kCount)>;
248+
// A sink to receive write events.
249+
// The requested metrics are the keys of the metrics that the caller is
250+
// interested in. The on_event callback will be called on each event
251+
// requested.
252+
class WriteEventSink final {
253+
public:
254+
WriteEventSink(absl::Span<const size_t> requested_metrics,
255+
std::initializer_list<WriteEvent> requested_events,
256+
WriteEventCallback on_event)
257+
: requested_metrics_(requested_metrics),
258+
on_event_(std::move(on_event)) {
259+
for (auto event : requested_events) {
260+
requested_events_mask_.set(static_cast<int>(event));
261+
}
262+
}
263+
264+
absl::Span<const size_t> requested_metrics() const {
265+
return requested_metrics_;
266+
}
267+
268+
bool requested_event(WriteEvent event) const {
269+
return requested_events_mask_.test(static_cast<int>(event));
270+
}
271+
272+
WriteEventSet requested_events_mask() const {
273+
return requested_events_mask_;
274+
}
275+
276+
WriteEventCallback TakeEventCallback() { return std::move(on_event_); }
277+
278+
private:
279+
absl::Span<const size_t> requested_metrics_;
280+
WriteEventSet requested_events_mask_;
281+
// The callback to be called on each event.
282+
WriteEventCallback on_event_;
283+
};
216284
/// A struct representing optional arguments that may be provided to an
217285
/// EventEngine Endpoint Write API call.
218286
///
219287
/// Passed as argument to an Endpoint \a Write
220-
struct WriteArgs {
288+
class WriteArgs final {
289+
public:
290+
WriteArgs() = default;
291+
WriteArgs(const WriteArgs&) = delete;
292+
WriteArgs& operator=(const WriteArgs&) = delete;
293+
WriteArgs(WriteArgs&&) = default;
294+
WriteArgs& operator=(WriteArgs&&) = default;
295+
296+
// A sink to receive write events.
297+
std::optional<WriteEventSink> TakeMetricsSink() {
298+
auto sink = std::move(metrics_sink_);
299+
metrics_sink_.reset();
300+
return sink;
301+
}
302+
303+
bool has_metrics_sink() const { return metrics_sink_.has_value(); }
304+
305+
void set_metrics_sink(WriteEventSink sink) {
306+
metrics_sink_ = std::move(sink);
307+
}
308+
221309
// Represents private information that may be passed by gRPC for
222310
// select endpoints expected to be used only within google.
223-
void* google_specific = nullptr;
311+
// TODO(ctiller): Remove this method once all callers are migrated to
312+
// metrics sink.
313+
void* GetDeprecatedAndDiscouragedGoogleSpecificPointer() {
314+
return google_specific_;
315+
}
316+
317+
void SetDeprecatedAndDiscouragedGoogleSpecificPointer(void* pointer) {
318+
google_specific_ = pointer;
319+
}
320+
224321
// A suggestion to the endpoint implementation to group data to be written
225322
// into frames of the specified max_frame_size. gRPC may use this
226323
// argument to dynamically control the max sizes of frames sent to a
227324
// receiver in response to high receiver memory pressure.
228-
int64_t max_frame_size;
325+
int64_t max_frame_size() const { return max_frame_size_; }
326+
327+
void set_max_frame_size(int64_t max_frame_size) {
328+
max_frame_size_ = max_frame_size;
329+
}
330+
331+
private:
332+
std::optional<WriteEventSink> metrics_sink_;
333+
void* google_specific_ = nullptr;
334+
int64_t max_frame_size_ = 1024 * 1024;
229335
};
230336
/// Writes data out on the connection.
231337
///
@@ -248,11 +354,22 @@ class EventEngine : public std::enable_shared_from_this<EventEngine>,
248354
/// statuses to \a on_writable. For example, callbacks might expect to
249355
/// receive CANCELLED on endpoint shutdown.
250356
virtual bool Write(absl::AnyInvocable<void(absl::Status)> on_writable,
251-
SliceBuffer* data, const WriteArgs* args) = 0;
357+
SliceBuffer* data, WriteArgs args) = 0;
252358
/// Returns an address in the format described in DNSResolver. The returned
253359
/// values are expected to remain valid for the life of the Endpoint.
254360
virtual const ResolvedAddress& GetPeerAddress() const = 0;
255361
virtual const ResolvedAddress& GetLocalAddress() const = 0;
362+
/// Returns the list of write metrics that the endpoint supports.
363+
/// The keys are used to identify the metrics in the GetMetricName and
364+
/// GetMetricKey APIs. The current value of the metric can be queried by
365+
/// adding a WriteEventSink to the WriteArgs of a Write call.
366+
virtual std::vector<size_t> AllWriteMetrics() = 0;
367+
/// Returns the name of the write metric with the given key.
368+
/// If the key is not found, returns std::nullopt.
369+
virtual std::optional<absl::string_view> GetMetricName(size_t key) = 0;
370+
/// Returns the key of the write metric with the given name.
371+
/// If the name is not found, returns std::nullopt.
372+
virtual std::optional<size_t> GetMetricKey(absl::string_view name) = 0;
256373
};
257374

258375
/// Called when a new connection is established.
@@ -334,7 +451,7 @@ class EventEngine : public std::enable_shared_from_this<EventEngine>,
334451
/// when the object is destroyed and all pending callbacks will be called
335452
/// shortly. If cancellation races with request completion, implementations
336453
/// may choose to either cancel or satisfy the request.
337-
class DNSResolver {
454+
class DNSResolver : public Extensible {
338455
public:
339456
/// Optional configuration for DNSResolvers.
340457
struct ResolverOptions {

0 commit comments

Comments
 (0)