Skip to content

Commit

Permalink
Native source sync at revision @7108818
Browse files Browse the repository at this point in the history
  • Loading branch information
dennycd authored and HannahShiSFB committed Jun 15, 2024
1 parent 7108818 commit cf716d7
Show file tree
Hide file tree
Showing 668 changed files with 41,117 additions and 17,098 deletions.
152 changes: 83 additions & 69 deletions gRPC-C++.podspec

Large diffs are not rendered by default.

255 changes: 130 additions & 125 deletions gRPC-Core.podspec

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion gRPC-ProtoRPC.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

Pod::Spec.new do |s|
s.name = 'gRPC-ProtoRPC'
version = '1.65.0-dev'
version = '1.66.0-dev'
s.version = version
s.summary = 'RPC library for Protocol Buffers, based on gRPC'
s.homepage = 'https://grpc.io'
Expand Down
2 changes: 1 addition & 1 deletion gRPC-RxLibrary.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

Pod::Spec.new do |s|
s.name = 'gRPC-RxLibrary'
version = '1.65.0-dev'
version = '1.66.0-dev'
s.version = version
s.summary = 'Reactive Extensions library for iOS/OSX.'
s.homepage = 'https://grpc.io'
Expand Down
2 changes: 1 addition & 1 deletion gRPC.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

Pod::Spec.new do |s|
s.name = 'gRPC'
version = '1.65.0-dev'
version = '1.66.0-dev'
s.version = version
s.summary = 'gRPC client library for iOS/OSX'
s.homepage = 'https://grpc.io'
Expand Down
19 changes: 13 additions & 6 deletions include/grpc/event_engine/event_engine.h
Original file line number Diff line number Diff line change
Expand Up @@ -132,19 +132,13 @@ class EventEngine : public std::enable_shared_from_this<EventEngine>,
struct TaskHandle {
intptr_t keys[2];
static const GRPC_DLL TaskHandle kInvalid;
friend bool operator==(const TaskHandle& lhs, const TaskHandle& rhs);
friend bool operator!=(const TaskHandle& lhs, const TaskHandle& rhs);
};
/// A handle to a cancellable connection attempt.
///
/// Returned by \a Connect, and can be passed to \a CancelConnect.
struct ConnectionHandle {
intptr_t keys[2];
static const GRPC_DLL ConnectionHandle kInvalid;
friend bool operator==(const ConnectionHandle& lhs,
const ConnectionHandle& rhs);
friend bool operator!=(const ConnectionHandle& lhs,
const ConnectionHandle& rhs);
};
/// Thin wrapper around a platform-specific sockaddr type. A sockaddr struct
/// exists on all platforms that gRPC supports.
Expand Down Expand Up @@ -496,6 +490,19 @@ void EventEngineFactoryReset();
/// Create an EventEngine using the default factory.
std::unique_ptr<EventEngine> CreateEventEngine();

bool operator==(const EventEngine::TaskHandle& lhs,
const EventEngine::TaskHandle& rhs);
bool operator!=(const EventEngine::TaskHandle& lhs,
const EventEngine::TaskHandle& rhs);
std::ostream& operator<<(std::ostream& out,
const EventEngine::TaskHandle& handle);
bool operator==(const EventEngine::ConnectionHandle& lhs,
const EventEngine::ConnectionHandle& rhs);
bool operator!=(const EventEngine::ConnectionHandle& lhs,
const EventEngine::ConnectionHandle& rhs);
std::ostream& operator<<(std::ostream& out,
const EventEngine::ConnectionHandle& handle);

} // namespace experimental
} // namespace grpc_event_engine

Expand Down
37 changes: 37 additions & 0 deletions include/grpc/grpc_cronet.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/*
*
* Copyright 2016 gRPC authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/

#ifndef GRPC_GRPC_CRONET_H
#define GRPC_GRPC_CRONET_H

#include <grpc/grpc.h>
#include <grpc/support/port_platform.h>

#ifdef __cplusplus
extern "C" {
#endif

GRPCAPI grpc_channel* grpc_cronet_secure_channel_create(
void* engine, const char* target, const grpc_channel_args* args,
void* reserved);

#ifdef __cplusplus
}
#endif

#endif /* GRPC_GRPC_CRONET_H */
10 changes: 7 additions & 3 deletions include/grpc/impl/channel_arg_names.h
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,11 @@
"grpc.server_max_unrequested_time_in_server"
/** Channel arg to override the http2 :scheme header */
#define GRPC_ARG_HTTP2_SCHEME "grpc.http2_scheme"
/** How many pings can the client send before needing to send a
data/header frame? (0 indicates that an infinite number of
pings can be sent without sending a data frame or header frame) */
/** How many pings can the client send before needing to send a data/header
frame? (0 indicates that an infinite number of pings can be sent without
sending a data frame or header frame).
If experiment "max_pings_wo_data_throttle" is enabled, instead of pings being
completely blocked, they are throttled. */
#define GRPC_ARG_HTTP2_MAX_PINGS_WITHOUT_DATA \
"grpc.http2.max_pings_without_data"
/** How many misbehaving pings the server can bear before sending goaway and
Expand Down Expand Up @@ -396,6 +398,8 @@
* If unspecified, it is unlimited */
#define GRPC_ARG_MAX_ALLOWED_INCOMING_CONNECTIONS \
"grpc.max_allowed_incoming_connections"
/** Configure per-channel or per-server stats plugins. */
#define GRPC_ARG_EXPERIMENTAL_STATS_PLUGINS "grpc.experimental.stats_plugins"
/** \} */

#endif /* GRPC_IMPL_CHANNEL_ARG_NAMES_H */
1 change: 1 addition & 0 deletions include/grpc/module.modulemap
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ header "byte_buffer.h"
header "impl/propagation_bits.h"
header "impl/slice_type.h"
header "load_reporting.h"
header "passive_listener.h"
header "slice.h"
header "slice_buffer.h"
header "status.h"
Expand Down
62 changes: 62 additions & 0 deletions include/grpc/passive_listener.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
// Copyright 2024 The gRPC Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#ifndef GRPC_PASSIVE_LISTENER_H
#define GRPC_PASSIVE_LISTENER_H

#include <memory>

#include <grpc/event_engine/event_engine.h>
#include <grpc/grpc.h>
// #include <grpc/support/port_platform.h>

namespace grpc_core {
class Server;

namespace experimental {
class PassiveListenerImpl;

/// -- EXPERIMENTAL API --
/// Interface for used for Server Endpoint injection.
class PassiveListener {
public:
virtual ~PassiveListener() = default;
/// -- EXPERIMENTAL API --
///
/// Takes an Endpoint for an established connection, and treats it as if the
/// connection had been accepted by the server.
///
/// The server must be started before endpoints can be accepted.
virtual absl::Status AcceptConnectedEndpoint(
std::unique_ptr<grpc_event_engine::experimental::EventEngine::Endpoint>
endpoint) = 0;

/// -- EXPERIMENTAL API --
///
/// Takes a connected file descriptor, and treats it as if the server had
/// accepted the connection itself.
///
/// Returns a failure status if the server's active EventEngine does not
/// support Endpoint creation from fds.
virtual absl::Status AcceptConnectedFd(int fd) = 0;
};

} // namespace experimental
} // namespace grpc_core

absl::Status grpc_server_add_passive_listener(
grpc_core::Server* server, grpc_server_credentials* credentials,
std::shared_ptr<grpc_core::experimental::PassiveListenerImpl>
passive_listener);

#endif /* GRPC_PASSIVE_LISTENER_H */
19 changes: 1 addition & 18 deletions include/grpc/support/log.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,29 +82,12 @@ struct gpr_log_func_args {
typedef struct gpr_log_func_args gpr_log_func_args;

typedef void (*gpr_log_func)(gpr_log_func_args* args);

GPRAPI void gpr_set_log_function(gpr_log_func func);

GPRAPI void gpr_assertion_failed(const char* filename, int line,
const char* message) GPR_ATTRIBUTE_NORETURN;

/** abort() the process if x is zero, having written a line to the log.
Intended for internal invariants. If the error can be recovered from,
without the possibility of corruption, or might best be reflected via
an exception in a higher-level language, consider returning error code. */
#define GPR_ASSERT(x) \
do { \
if (GPR_UNLIKELY(!(x))) { \
gpr_assertion_failed(__FILE__, __LINE__, #x); \
} \
} while (0)

#ifndef NDEBUG
#define GPR_DEBUG_ASSERT(x) GPR_ASSERT(x)
#else
#define GPR_DEBUG_ASSERT(x) GPR_ASSERT(true || (x))
#endif

#ifdef __cplusplus
}
#endif
Expand Down
3 changes: 3 additions & 0 deletions include/grpc/support/port_platform.h
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,9 @@
#define GPR_PLATFORM_STRING "ios"
#define GPR_CPU_IPHONE 1
#define GRPC_CFSTREAM 1
#ifndef GRPC_IOS_EVENT_ENGINE_CLIENT
#define GRPC_IOS_EVENT_ENGINE_CLIENT 1
#endif /* GRPC_IOS_EVENT_ENGINE_CLIENT */
/* the c-ares resolver isn't safe to enable on iOS */
#define GRPC_ARES 0
#else /* TARGET_OS_IPHONE */
Expand Down
4 changes: 2 additions & 2 deletions include/grpcpp/client_context.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
#include <memory>
#include <string>

#include "absl/log/check.h"
#include "absl/log/absl_check.h"

#include <grpc/impl/compression_types.h>
#include <grpc/impl/propagation_bits.h>
Expand Down Expand Up @@ -248,7 +248,7 @@ class ClientContext {
/// \return A multimap of initial metadata key-value pairs from the server.
const std::multimap<grpc::string_ref, grpc::string_ref>&
GetServerInitialMetadata() const {
CHECK(initial_metadata_received_);
ABSL_CHECK(initial_metadata_received_);
return *recv_initial_metadata_.map();
}

Expand Down
8 changes: 4 additions & 4 deletions include/grpcpp/completion_queue.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@

#include <list>

#include "absl/log/check.h"
#include "absl/log/absl_check.h"

#include <grpc/grpc.h>
#include <grpc/support/atm.h>
Expand Down Expand Up @@ -325,7 +325,7 @@ class CompletionQueue : private grpc::internal::GrpcLibrary {
bool ok = ev.success != 0;
void* ignored = tag;
if (tag->FinalizeResult(&ignored, &ok)) {
CHECK(ignored == tag);
ABSL_CHECK(ignored == tag);
return ok;
}
}
Expand All @@ -346,7 +346,7 @@ class CompletionQueue : private grpc::internal::GrpcLibrary {
bool ok = ev.success != 0;
void* ignored = tag;
// the tag must be swallowed if using TryPluck
CHECK(!tag->FinalizeResult(&ignored, &ok));
ABSL_CHECK(!tag->FinalizeResult(&ignored, &ok));
}

/// Performs a single polling pluck on \a tag. Calls tag->FinalizeResult if
Expand All @@ -363,7 +363,7 @@ class CompletionQueue : private grpc::internal::GrpcLibrary {

bool ok = ev.success != 0;
void* ignored = tag;
CHECK(!tag->FinalizeResult(&ignored, &ok));
ABSL_CHECK(!tag->FinalizeResult(&ignored, &ok));
}

/// Manage state of avalanching operations : completion queue tags that
Expand Down
54 changes: 1 addition & 53 deletions include/grpcpp/generic/async_generic_service.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,9 @@
#define GRPCPP_GENERIC_ASYNC_GENERIC_SERVICE_H

#include <grpc/support/port_platform.h>
#include <grpcpp/impl/server_callback_handlers.h>
#include <grpcpp/generic/callback_generic_service.h>
#include <grpcpp/support/async_stream.h>
#include <grpcpp/support/byte_buffer.h>
#include <grpcpp/support/server_callback.h>

struct grpc_server;

Expand Down Expand Up @@ -78,57 +77,6 @@ class AsyncGenericService final {
grpc::Server* server_;
};

/// \a ServerGenericBidiReactor is the reactor class for bidi streaming RPCs
/// invoked on a CallbackGenericService. It is just a ServerBidi reactor with
/// ByteBuffer arguments.
using ServerGenericBidiReactor = ServerBidiReactor<ByteBuffer, ByteBuffer>;

class GenericCallbackServerContext final : public grpc::CallbackServerContext {
public:
const std::string& method() const { return method_; }
const std::string& host() const { return host_; }

private:
friend class grpc::Server;

std::string method_;
std::string host_;
};

/// \a CallbackGenericService is the base class for generic services implemented
/// using the callback API and registered through the ServerBuilder using
/// RegisterCallbackGenericService.
class CallbackGenericService {
public:
CallbackGenericService() {}
virtual ~CallbackGenericService() {}

/// The "method handler" for the generic API. This function should be
/// overridden to provide a ServerGenericBidiReactor that implements the
/// application-level interface for this RPC. Unimplemented by default.
virtual ServerGenericBidiReactor* CreateReactor(
GenericCallbackServerContext* /*ctx*/) {
class Reactor : public ServerGenericBidiReactor {
public:
Reactor() { this->Finish(Status(StatusCode::UNIMPLEMENTED, "")); }
void OnDone() override { delete this; }
};
return new Reactor;
}

private:
friend class grpc::Server;

internal::CallbackBidiHandler<ByteBuffer, ByteBuffer>* Handler() {
return new internal::CallbackBidiHandler<ByteBuffer, ByteBuffer>(
[this](grpc::CallbackServerContext* ctx) {
return CreateReactor(static_cast<GenericCallbackServerContext*>(ctx));
});
}

grpc::Server* server_{nullptr};
};

} // namespace grpc

#endif // GRPCPP_GENERIC_ASYNC_GENERIC_SERVICE_H
Loading

0 comments on commit cf716d7

Please sign in to comment.