Event engine endpoint read and write API changes (#29450)

* Event engine endpoint read and write API changes

* updating api change

* set google_specific  to nullptr by default

* Event-Engine --> EventEngine

* life-time --> lifetime

* removing default args to make sanity checks pass
reviewable/pr29621/r3
Vignesh Babu 3 years ago committed by GitHub
parent 0a21ecdff6
commit 941e21b3b3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 30
      include/grpc/event_engine/event_engine.h

@ -138,6 +138,18 @@ class EventEngine {
/// Shuts down all connections and invokes all pending read or write
/// callbacks with an error status.
virtual ~Endpoint() = default;
/// A struct representing optional arguments that may be provided to an
/// EventEngine Endpoint Read API call.
///
/// Passed as argument to an Endpoint \a Read
struct ReadArgs {
// A suggestion to the endpoint implementation to read at-least the
// specified number of bytes over the network connection before marking
// the endpoint read operation as complete. gRPC may use this argument
// to minimize the number of endpoint read API calls over the lifetime
// of a connection.
int64_t read_hint_bytes;
};
/// Reads data from the Endpoint.
///
/// When data is available on the connection, that data is moved into the
@ -156,7 +168,21 @@ class EventEngine {
/// statuses to \a on_read. For example, callbacks might expect to receive
/// CANCELLED on endpoint shutdown.
virtual void Read(std::function<void(absl::Status)> on_read,
SliceBuffer* buffer) = 0;
SliceBuffer* buffer, const ReadArgs* args) = 0;
/// A struct representing optional arguments that may be provided to an
/// EventEngine Endpoint Write API call.
///
/// Passed as argument to an Endpoint \a Write
struct WriteArgs {
// Represents private information that may be passed by gRPC for
// select endpoints expected to be used only within google.
void* google_specific = nullptr;
// A suggestion to the endpoint implementation to group data to be written
// into frames of the specified max_frame_size. gRPC may use this
// argument to dynamically control the max sizes of frames sent to a
// receiver in response to high receiver memory pressure.
int64_t max_frame_size;
};
/// Writes data out on the connection.
///
/// \a on_writable is called when the connection is ready for more data. The
@ -176,7 +202,7 @@ class EventEngine {
/// statuses to \a on_writable. For example, callbacks might expect to
/// receive CANCELLED on endpoint shutdown.
virtual void Write(std::function<void(absl::Status)> on_writable,
SliceBuffer* data) = 0;
SliceBuffer* data, const WriteArgs* args) = 0;
/// Returns an address in the format described in DNSResolver. The returned
/// values are expected to remain valid for the life of the Endpoint.
virtual const ResolvedAddress& GetPeerAddress() const = 0;

Loading…
Cancel
Save