GRPC C++
1.39.1
|
An Endpoint represents one end of a connection between a gRPC client and server. More...
#include <event_engine.h>
Public Member Functions | |
virtual | ~Endpoint ()=default |
The Endpoint destructor is responsible for shutting down all connections and invoking all pending read or write callbacks with an error status. More... | |
virtual void | Read (Callback on_read, SliceBuffer *buffer, absl::Time deadline)=0 |
Read data from the Endpoint. More... | |
virtual void | Write (Callback on_writable, SliceBuffer *data, absl::Time deadline)=0 |
Write data out on the connection. More... | |
virtual const ResolvedAddress * | GetPeerAddress () const =0 |
These methods return an address in the format described in DNSResolver. More... | |
virtual const ResolvedAddress * | GetLocalAddress () const =0 |
An Endpoint represents one end of a connection between a gRPC client and server.
Endpoints are created when connections are established, and Endpoint operations are gRPC's primary means of communication.
Endpoints must use the provided SliceAllocator for all data buffer memory allocations. gRPC allows applications to set memory constraints per Channel or Server, and the implementation depends on all dynamic memory allocation being handled by the quota system.
|
virtualdefault |
The Endpoint destructor is responsible for shutting down all connections and invoking all pending read or write callbacks with an error status.
|
pure virtual |
|
pure virtual |
These methods return an address in the format described in DNSResolver.
The returned values are owned by the Endpoint and are expected to remain valid for the life of the Endpoint.
|
pure virtual |
Read data from the Endpoint.
When data is available on the connection, that data is moved into the buffer, and the on_read callback is called. The caller must ensure that the callback has access to the buffer when executed later. 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.
For failed read operations, implementations should pass the appropriate statuses to on_read. For example, callbacks might expect to receive DEADLINE_EXCEEDED when the deadline is exceeded, and CANCELLED on endpoint shutdown.
|
pure virtual |
Write data out on the connection.
on_writable is called when the connection is ready for more data. The Slices within the data buffer may be mutated at will by the Endpoint until on_writable is called. The data SliceBuffer will remain valid after calling Write, but its state is otherwise undefined.
For failed write operations, implementations should pass the appropriate statuses to on_writable. For example, callbacks might expect to receive DEADLINE_EXCEEDED when the deadline is exceeded, and CANCELLED on endpoint shutdown.