修改pods

This commit is contained in:
2025-09-20 17:13:38 +08:00
parent 7787b3ee30
commit 28ff2b0264
5251 changed files with 345029 additions and 285168 deletions

View File

@@ -14,6 +14,11 @@
#ifndef GRPC_EVENT_ENGINE_EVENT_ENGINE_H
#define GRPC_EVENT_ENGINE_EVENT_ENGINE_H
#include <grpc/event_engine/endpoint_config.h>
#include <grpc/event_engine/extensible.h>
#include <grpc/event_engine/memory_allocator.h>
#include <grpc/event_engine/port.h>
#include <grpc/event_engine/slice_buffer.h>
#include <grpc/support/port_platform.h>
#include <vector>
@@ -22,12 +27,6 @@
#include "absl/status/status.h"
#include "absl/status/statusor.h"
#include <grpc/event_engine/endpoint_config.h>
#include <grpc/event_engine/extensible.h>
#include <grpc/event_engine/memory_allocator.h>
#include <grpc/event_engine/port.h>
#include <grpc/event_engine/slice_buffer.h>
// TODO(vigneshbabu): Define the Endpoint::Write metrics collection system
namespace grpc_event_engine {
namespace experimental {
@@ -133,8 +132,6 @@ 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.
///
@@ -142,10 +139,6 @@ class EventEngine : public std::enable_shared_from_this<EventEngine>,
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.
@@ -201,9 +194,12 @@ class EventEngine : public std::enable_shared_from_this<EventEngine>,
/// on_read callback is not executed. Otherwise it returns false and the \a
/// on_read callback executes asynchronously when the read completes. The
/// caller must ensure that the callback has access to the buffer when it
/// executes. Ownership of the buffer is not transferred. Valid slices *may*
/// be placed into the buffer even if the callback is invoked with a non-OK
/// Status.
/// executes. Ownership of the buffer is not transferred. Either an error is
/// passed to the callback (like socket closed), or valid data is available
/// in the buffer, but never both at the same time. Implementations that
/// receive valid data must not throw that data away - that is, if valid
/// data is received on the underlying endpoint, a callback will be made
/// with that data available and an ok status.
///
/// There can be at most one outstanding read per Endpoint at any given
/// time. An outstanding read is one in which the \a on_read callback has
@@ -444,6 +440,9 @@ class EventEngine : public std::enable_shared_from_this<EventEngine>,
///
/// Implementations must not execute the closure in the calling thread before
/// \a RunAfter returns.
///
/// Implementations may return a \a kInvalid handle if the callback can be
/// immediately executed, and is therefore not cancellable.
virtual TaskHandle RunAfter(Duration when, Closure* closure) = 0;
/// Synonymous with scheduling an alarm to run after duration \a when.
///
@@ -494,6 +493,33 @@ 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 detail {
std::string FormatHandleString(uint64_t key1, uint64_t key2);
}
template <typename Sink>
void AbslStringify(Sink& out, const EventEngine::ConnectionHandle& handle) {
out.Append(detail::FormatHandleString(handle.keys[0], handle.keys[1]));
}
template <typename Sink>
void AbslStringify(Sink& out, const EventEngine::TaskHandle& handle) {
out.Append(detail::FormatHandleString(handle.keys[0], handle.keys[1]));
}
} // namespace experimental
} // namespace grpc_event_engine

View File

@@ -60,6 +60,9 @@ class Extensible {
/// if (endpoint != nullptr) endpoint->Process();
///
virtual void* QueryExtension(absl::string_view /*id*/) { return nullptr; }
protected:
~Extensible() = default;
};
} // namespace experimental

View File

@@ -14,6 +14,8 @@
#ifndef GRPC_EVENT_ENGINE_INTERNAL_MEMORY_ALLOCATOR_IMPL_H
#define GRPC_EVENT_ENGINE_INTERNAL_MEMORY_ALLOCATOR_IMPL_H
#include <grpc/event_engine/memory_request.h>
#include <grpc/slice.h>
#include <grpc/support/port_platform.h>
#include <algorithm>
@@ -21,9 +23,6 @@
#include <type_traits>
#include <vector>
#include <grpc/event_engine/memory_request.h>
#include <grpc/slice.h>
namespace grpc_event_engine {
namespace experimental {

View File

@@ -24,7 +24,7 @@ namespace internal {
// with `SliceCast`. Both ways need to be declared (i.e. if
// SliceCastable<A,B> exists, you should declare
// SliceCastable<B,A> too).
// The type has no members, it's just the existance of the specialization that
// The type has no members, it's just the existence of the specialization that
// unlocks SliceCast usage for a type pair.
template <typename Result, typename T>
struct SliceCastable;

View File

@@ -14,8 +14,9 @@
#ifndef GRPC_EVENT_ENGINE_MEMORY_ALLOCATOR_H
#define GRPC_EVENT_ENGINE_MEMORY_ALLOCATOR_H
#include <grpc/event_engine/internal/memory_allocator_impl.h>
#include <grpc/slice.h>
#include <grpc/support/port_platform.h>
#include <stdlib.h> // for abort()
#include <algorithm>
@@ -23,9 +24,6 @@
#include <type_traits>
#include <vector>
#include <grpc/event_engine/internal/memory_allocator_impl.h>
#include <grpc/slice.h>
namespace grpc_event_engine {
namespace experimental {

View File

@@ -15,7 +15,6 @@
#define GRPC_EVENT_ENGINE_MEMORY_REQUEST_H
#include <grpc/support/port_platform.h>
#include <stddef.h>
#include "absl/strings/string_view.h"
@@ -46,6 +45,24 @@ class MemoryRequest {
size_t min() const { return min_; }
size_t max() const { return max_; }
bool operator==(const MemoryRequest& other) const {
return min_ == other.min_ && max_ == other.max_;
}
bool operator!=(const MemoryRequest& other) const {
return !(*this == other);
}
template <typename Sink>
friend void AbslStringify(Sink& s, const MemoryRequest& r) {
if (r.min_ == r.max_) {
s.Append(r.min_);
} else {
s.Append(r.min_);
s.Append("..");
s.Append(r.max_);
}
}
private:
size_t min_;
size_t max_;

View File

@@ -15,8 +15,9 @@
#ifndef GRPC_EVENT_ENGINE_SLICE_H
#define GRPC_EVENT_ENGINE_SLICE_H
#include <grpc/event_engine/internal/slice_cast.h>
#include <grpc/slice.h>
#include <grpc/support/port_platform.h>
#include <string.h>
#include <cstdint>
@@ -25,10 +26,6 @@
#include "absl/strings/string_view.h"
#include <grpc/event_engine/internal/slice_cast.h>
#include <grpc/slice.h>
#include <grpc/support/log.h>
// This public slice definition largely based of the internal grpc_core::Slice
// implementation. Changes to this implementation might warrant changes to the
// internal grpc_core::Slice type as well.

View File

@@ -15,8 +15,12 @@
#ifndef GRPC_EVENT_ENGINE_SLICE_BUFFER_H
#define GRPC_EVENT_ENGINE_SLICE_BUFFER_H
#include <grpc/event_engine/internal/slice_cast.h>
#include <grpc/event_engine/slice.h>
#include <grpc/impl/codegen/slice.h>
#include <grpc/slice.h>
#include <grpc/slice_buffer.h>
#include <grpc/support/port_platform.h>
#include <string.h>
#include <cstdint>
@@ -25,13 +29,6 @@
#include "absl/strings/string_view.h"
#include "absl/utility/utility.h"
#include <grpc/event_engine/internal/slice_cast.h>
#include <grpc/event_engine/slice.h>
#include <grpc/impl/codegen/slice.h>
#include <grpc/slice.h>
#include <grpc/slice_buffer.h>
#include <grpc/support/log.h>
namespace grpc_event_engine {
namespace experimental {