Skip to content

Commit 1b5f640

Browse files
committed
Sync c-core 1.74.0-pre1
1 parent 52d0c6c commit 1b5f640

File tree

312 files changed

+22495
-10433
lines changed

Some content is hidden

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

312 files changed

+22495
-10433
lines changed

gRPC-C++.podspec

Lines changed: 67 additions & 6 deletions
Large diffs are not rendered by default.

gRPC-Core.podspec

Lines changed: 93 additions & 7 deletions
Large diffs are not rendered by default.

gRPC-ProtoRPC.podspec

Lines changed: 1 addition & 1 deletion
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.73.1'
24+
version = '1.74.0-pre1'
2525
s.version = version
2626
s.summary = 'RPC library for Protocol Buffers, based on gRPC'
2727
s.homepage = 'https://grpc.io'

gRPC-RxLibrary.podspec

Lines changed: 1 addition & 1 deletion
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.73.1'
24+
version = '1.74.0-pre1'
2525
s.version = version
2626
s.summary = 'Reactive Extensions library for iOS/OSX.'
2727
s.homepage = 'https://grpc.io'

gRPC.podspec

Lines changed: 1 addition & 1 deletion
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.73.1'
23+
version = '1.74.0-pre1'
2424
s.version = version
2525
s.summary = 'gRPC client library for iOS/OSX'
2626
s.homepage = 'https://grpc.io'
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
/*
2+
*
3+
* Copyright 2025 gRPC authors.
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License");
6+
* you may not use this file except in compliance with the License.
7+
* You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*
17+
*/
18+
19+
#ifndef GRPC_CREATE_CHANNEL_FROM_ENDPOINT_H
20+
#define GRPC_CREATE_CHANNEL_FROM_ENDPOINT_H
21+
22+
#include <grpc/grpc.h>
23+
#include <grpc/impl/grpc_types.h>
24+
#include <grpc/support/port_platform.h>
25+
#include <stddef.h>
26+
27+
#ifdef __cplusplus
28+
#include <grpc/event_engine/event_engine.h>
29+
30+
#include <memory>
31+
namespace grpc_core::experimental {
32+
33+
/**
34+
* EXPERIMENTAL API - Subject to change
35+
*
36+
* This function creates a gRPC channel using a pre-established
37+
* endpoint from the EventEngine. This API supports both secure and insecure
38+
* channel credentials.
39+
*
40+
* \param endpoint A unique pointer to an EventEngine endpoint representing
41+
* an established connection.
42+
* \param creds The channel credentials used to secure the connection.
43+
* \param args Optional channel arguments to configure the channel behavior.
44+
*/
45+
grpc_channel* CreateChannelFromEndpoint(
46+
std::unique_ptr<grpc_event_engine::experimental::EventEngine::Endpoint>
47+
endpoint,
48+
grpc_channel_credentials* creds, const grpc_channel_args* args);
49+
50+
} // namespace grpc_core::experimental
51+
52+
#endif // __cplusplus
53+
54+
#endif /* GRPC_CREATE_CHANNEL_FROM_ENDPOINT_H */

include/grpc/credentials.h

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -206,21 +206,27 @@ GRPCAPI void grpc_call_credentials_release(grpc_call_credentials* creds);
206206
this could result in an oauth2 token leak. The security level of the
207207
resulting connection is GRPC_PRIVACY_AND_INTEGRITY.
208208
209-
If specified, the supplied call credentials object will be attached to the
210-
returned channel credentials object. The call_credentials object must remain
209+
If specified, the supplied call credentials objects will be attached to the
210+
returned channel credentials object. The call_credentials objects must remain
211211
valid throughout the lifetime of the returned grpc_channel_credentials
212-
object. It is expected that the call credentials object was generated
212+
object. It is expected that each call credentials object was generated
213213
according to the Application Default Credentials mechanism and asserts the
214214
identity of the default service account of the machine. Supplying any other
215215
sort of call credential will result in undefined behavior, up to and
216216
including the sudden and unexpected failure of RPCs.
217217
218218
If nullptr is supplied, the returned channel credentials object will use a
219-
call credentials object based on the Application Default Credentials
219+
default call credentials object based on the Application Default Credentials
220220
mechanism.
221+
222+
The caller may choose to create the default credential with a secondary alts
223+
credentials object to attach to the channel for ALTS connections. If an alts
224+
credentials object is specified, it will be used if the underlying channel
225+
type is ALTS.
221226
*/
222227
GRPCAPI grpc_channel_credentials* grpc_google_default_credentials_create(
223-
grpc_call_credentials* call_credentials);
228+
grpc_call_credentials* call_creds_for_tls,
229+
grpc_call_credentials* call_creds_for_alts);
224230

225231
/** Server certificate config object holds the server's public certificates and
226232
associated private keys, as well as any CA certificates needed for client

include/grpc/event_engine/event_engine.h

Lines changed: 74 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,17 @@
2323
#include <grpc/support/port_platform.h>
2424

2525
#include <bitset>
26+
#include <cstddef>
2627
#include <initializer_list>
28+
#include <memory>
29+
#include <optional>
30+
#include <utility>
2731
#include <vector>
2832

2933
#include "absl/functional/any_invocable.h"
3034
#include "absl/status/status.h"
3135
#include "absl/status/statusor.h"
36+
#include "absl/types/span.h"
3237

3338
// TODO(vigneshbabu): Define the Endpoint::Write metrics collection system
3439
// TODO(hork): remove all references to the factory methods.
@@ -240,28 +245,40 @@ class EventEngine : public std::enable_shared_from_this<EventEngine>,
240245
size_t key;
241246
int64_t value;
242247
};
248+
// It is the responsibility of the caller of WriteEventCallback to make sure
249+
// that the corresponding endpoint is still valid. HINT: Do NOT offload
250+
// callbacks onto the EventEngine or other threads.
243251
using WriteEventCallback = absl::AnyInvocable<void(
244252
WriteEvent, absl::Time, std::vector<WriteMetric>) const>;
245253
// A bitmask of the events that the caller is interested in.
246254
// Each bit corresponds to an entry in WriteEvent.
247255
using WriteEventSet = std::bitset<static_cast<int>(WriteEvent::kCount)>;
256+
257+
// A set of metrics that the caller is interested in.
258+
class MetricsSet {
259+
public:
260+
virtual ~MetricsSet() = default;
261+
262+
virtual bool IsSet(size_t key) const = 0;
263+
};
264+
248265
// A sink to receive write events.
249266
// The requested metrics are the keys of the metrics that the caller is
250267
// interested in. The on_event callback will be called on each event
251268
// requested.
252269
class WriteEventSink final {
253270
public:
254-
WriteEventSink(absl::Span<const size_t> requested_metrics,
271+
WriteEventSink(std::shared_ptr<MetricsSet> requested_metrics,
255272
std::initializer_list<WriteEvent> requested_events,
256273
WriteEventCallback on_event)
257-
: requested_metrics_(requested_metrics),
274+
: requested_metrics_(std::move(requested_metrics)),
258275
on_event_(std::move(on_event)) {
259276
for (auto event : requested_events) {
260277
requested_events_mask_.set(static_cast<int>(event));
261278
}
262279
}
263280

264-
absl::Span<const size_t> requested_metrics() const {
281+
const std::shared_ptr<MetricsSet>& requested_metrics() const {
265282
return requested_metrics_;
266283
}
267284

@@ -273,10 +290,12 @@ class EventEngine : public std::enable_shared_from_this<EventEngine>,
273290
return requested_events_mask_;
274291
}
275292

293+
/// Takes the callback. Ownership is transferred. It is illegal to destroy
294+
/// the endpoint before this callback is invoked.
276295
WriteEventCallback TakeEventCallback() { return std::move(on_event_); }
277296

278297
private:
279-
absl::Span<const size_t> requested_metrics_;
298+
std::shared_ptr<MetricsSet> requested_metrics_;
280299
WriteEventSet requested_events_mask_;
281300
// The callback to be called on each event.
282301
WriteEventCallback on_event_;
@@ -288,10 +307,28 @@ class EventEngine : public std::enable_shared_from_this<EventEngine>,
288307
class WriteArgs final {
289308
public:
290309
WriteArgs() = default;
310+
311+
~WriteArgs();
312+
291313
WriteArgs(const WriteArgs&) = delete;
292314
WriteArgs& operator=(const WriteArgs&) = delete;
293-
WriteArgs(WriteArgs&&) = default;
294-
WriteArgs& operator=(WriteArgs&&) = default;
315+
316+
WriteArgs(WriteArgs&& other) noexcept
317+
: metrics_sink_(std::move(other.metrics_sink_)),
318+
google_specific_(other.google_specific_),
319+
max_frame_size_(other.max_frame_size_) {
320+
other.google_specific_ = nullptr;
321+
}
322+
323+
WriteArgs& operator=(WriteArgs&& other) noexcept {
324+
if (this != &other) {
325+
metrics_sink_ = std::move(other.metrics_sink_);
326+
google_specific_ = other.google_specific_;
327+
other.google_specific_ = nullptr; // Nullify source
328+
max_frame_size_ = other.max_frame_size_;
329+
}
330+
return *this;
331+
}
295332

296333
// A sink to receive write events.
297334
std::optional<WriteEventSink> TakeMetricsSink() {
@@ -314,6 +351,10 @@ class EventEngine : public std::enable_shared_from_this<EventEngine>,
314351
return google_specific_;
315352
}
316353

354+
void* TakeDeprecatedAndDiscouragedGoogleSpecificPointer() {
355+
return std::exchange(google_specific_, nullptr);
356+
}
357+
317358
void SetDeprecatedAndDiscouragedGoogleSpecificPointer(void* pointer) {
318359
google_specific_ = pointer;
319360
}
@@ -333,6 +374,31 @@ class EventEngine : public std::enable_shared_from_this<EventEngine>,
333374
void* google_specific_ = nullptr;
334375
int64_t max_frame_size_ = 1024 * 1024;
335376
};
377+
378+
class TelemetryInfo {
379+
public:
380+
virtual ~TelemetryInfo() = default;
381+
382+
/// Returns the list of write metrics that the endpoint supports.
383+
/// The keys are used to identify the metrics in the GetMetricName and
384+
/// GetMetricKey APIs. The current value of the metric can be queried by
385+
/// adding a WriteEventSink to the WriteArgs of a Write call.
386+
virtual std::vector<size_t> AllWriteMetrics() const = 0;
387+
/// Returns the name of the write metric with the given key.
388+
/// If the key is not found, returns std::nullopt.
389+
virtual std::optional<absl::string_view> GetMetricName(
390+
size_t key) const = 0;
391+
/// Returns the key of the write metric with the given name.
392+
/// If the name is not found, returns std::nullopt.
393+
virtual std::optional<size_t> GetMetricKey(
394+
absl::string_view name) const = 0;
395+
/// Returns a MetricsSet with all the keys from \a keys set.
396+
virtual std::shared_ptr<MetricsSet> GetMetricsSet(
397+
absl::Span<const size_t> keys) const = 0;
398+
/// Returns a MetricsSet with all supported keys set.
399+
virtual std::shared_ptr<MetricsSet> GetFullMetricsSet() const = 0;
400+
};
401+
336402
/// Writes data out on the connection.
337403
///
338404
/// If the write succeeds immediately, it returns true and the
@@ -359,17 +425,8 @@ class EventEngine : public std::enable_shared_from_this<EventEngine>,
359425
/// values are expected to remain valid for the life of the Endpoint.
360426
virtual const ResolvedAddress& GetPeerAddress() const = 0;
361427
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;
428+
429+
virtual std::shared_ptr<TelemetryInfo> GetTelemetryInfo() const = 0;
373430
};
374431

375432
/// Called when a new connection is established.

include/grpc/grpc_posix.h

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,25 @@ GRPCAPI void grpc_server_add_channel_from_fd(grpc_server* server, int fd,
5656

5757
#ifdef __cplusplus
5858
}
59-
#endif
59+
60+
namespace grpc_core::experimental {
61+
62+
/**
63+
* EXPERIMENTAL API - Subject to change
64+
*
65+
* This function creates a gRPC channel using a raw file descriptor
66+
* that represents an open socket. This API supports both secure and insecure
67+
* channel credentials.
68+
*
69+
* \param fd The file descriptor representing the connection.
70+
* \param creds The channel credentials used to secure the connection.
71+
* \param args Optional channel arguments to configure the channel behavior.
72+
*/
73+
grpc_channel* CreateChannelFromFd(int fd, grpc_channel_credentials* creds,
74+
const grpc_channel_args* args);
75+
76+
} // namespace grpc_core::experimental
77+
78+
#endif // __cplusplus
6079

6180
#endif /* GRPC_GRPC_POSIX_H */

include/grpc/impl/channel_arg_names.h

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -123,10 +123,8 @@
123123
/** Channel arg to override the http2 :scheme header. String valued. */
124124
#define GRPC_ARG_HTTP2_SCHEME "grpc.http2_scheme"
125125
/** How many pings can the client send before needing to send a data/header
126-
frame? (0 indicates that an infinite number of pings can be sent without
127-
sending a data frame or header frame).
128-
If experiment "max_pings_wo_data_throttle" is enabled, instead of pings being
129-
completely blocked, they are throttled.
126+
frame, without being throttled? (0 indicates that an infinite number of pings
127+
can be sent without sending a data frame or header frame).
130128
* Integer valued. Defaults to 2. */
131129
#define GRPC_ARG_HTTP2_MAX_PINGS_WITHOUT_DATA \
132130
"grpc.http2.max_pings_without_data"

0 commit comments

Comments
 (0)