Classes | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | List of all members
grpc_event_engine::experimental::PosixOracleEndpoint Class Reference

#include <oracle_event_engine_posix.h>

Inheritance diagram for grpc_event_engine::experimental::PosixOracleEndpoint:
Inheritance graph
[legend]

Classes

class  ReadOperation
 
class  WriteOperation
 

Public Member Functions

EventEngine::ResolvedAddressGetLocalAddress () const override
 
EventEngine::ResolvedAddressGetPeerAddress () const override
 
 PosixOracleEndpoint (int socket_fd)
 
void Read (std::function< void(absl::Status)> on_read, SliceBuffer *buffer, const ReadArgs *args) override
 
void Shutdown ()
 
void Write (std::function< void(absl::Status)> on_writable, SliceBuffer *data, const WriteArgs *args) override
 
 ~PosixOracleEndpoint () override
 
- Public Member Functions inherited from grpc_event_engine::experimental::EventEngine::Endpoint
virtual ~Endpoint ()=default
 

Static Public Member Functions

static std::unique_ptr< PosixOracleEndpointCreate (int socket_fd)
 

Private Member Functions

grpc_core::Thread read_ops_ ABSL_GUARDED_BY (mu_)
 
grpc_core::Thread write_ops_ ABSL_GUARDED_BY (mu_)
 
void ProcessReadOperations ()
 
void ProcessWriteOperations ()
 

Private Attributes

bool is_shutdown_ = false
 
absl::Mutex mu_
 
Promise< ReadOperationread_ops_channel_
 
int socket_fd_
 
Promise< WriteOperationwrite_ops_channel_
 

Detailed Description

Definition at line 40 of file oracle_event_engine_posix.h.

Constructor & Destructor Documentation

◆ PosixOracleEndpoint()

grpc_event_engine::experimental::PosixOracleEndpoint::PosixOracleEndpoint ( int  socket_fd)
explicit

Definition at line 190 of file oracle_event_engine_posix.cc.

◆ ~PosixOracleEndpoint()

grpc_event_engine::experimental::PosixOracleEndpoint::~PosixOracleEndpoint ( )
override

Definition at line 224 of file oracle_event_engine_posix.cc.

Member Function Documentation

◆ ABSL_GUARDED_BY() [1/2]

grpc_core::Thread read_ops_ grpc_event_engine::experimental::PosixOracleEndpoint::ABSL_GUARDED_BY ( mu_  )
private

◆ ABSL_GUARDED_BY() [2/2]

grpc_core::Thread write_ops_ grpc_event_engine::experimental::PosixOracleEndpoint::ABSL_GUARDED_BY ( mu_  )
private

◆ Create()

std::unique_ptr< PosixOracleEndpoint > grpc_event_engine::experimental::PosixOracleEndpoint::Create ( int  socket_fd)
static

Definition at line 219 of file oracle_event_engine_posix.cc.

◆ GetLocalAddress()

EventEngine::ResolvedAddress& grpc_event_engine::experimental::PosixOracleEndpoint::GetLocalAddress ( ) const
inlineoverridevirtual

◆ GetPeerAddress()

EventEngine::ResolvedAddress& grpc_event_engine::experimental::PosixOracleEndpoint::GetPeerAddress ( ) const
inlineoverridevirtual

Returns an address in the format described in DNSResolver. The returned values are expected to remain valid for the life of the Endpoint.

Implements grpc_event_engine::experimental::EventEngine::Endpoint.

Definition at line 50 of file oracle_event_engine_posix.h.

◆ ProcessReadOperations()

void grpc_event_engine::experimental::PosixOracleEndpoint::ProcessReadOperations ( )
private

Definition at line 245 of file oracle_event_engine_posix.cc.

◆ ProcessWriteOperations()

void grpc_event_engine::experimental::PosixOracleEndpoint::ProcessWriteOperations ( )
private

Definition at line 266 of file oracle_event_engine_posix.cc.

◆ Read()

void grpc_event_engine::experimental::PosixOracleEndpoint::Read ( std::function< void(absl::Status)>  on_read,
SliceBuffer buffer,
const ReadArgs args 
)
overridevirtual

Reads 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.

There can be at most one outstanding read per Endpoint at any given time. An outstanding read is one in which the on_read callback has not yet been executed for some previous call to Read. If an attempt is made to call Read while a previous read is still outstanding, the EventEngine must abort.

For failed read operations, implementations should pass the appropriate statuses to on_read. For example, callbacks might expect to receive CANCELLED on endpoint shutdown.

Implements grpc_event_engine::experimental::EventEngine::Endpoint.

Definition at line 229 of file oracle_event_engine_posix.cc.

◆ Shutdown()

void grpc_event_engine::experimental::PosixOracleEndpoint::Shutdown ( )

Definition at line 208 of file oracle_event_engine_posix.cc.

◆ Write()

void grpc_event_engine::experimental::PosixOracleEndpoint::Write ( std::function< void(absl::Status)>  on_writable,
SliceBuffer data,
const WriteArgs args 
)
overridevirtual

Writes 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. All bytes in data must have been written before calling on_writable unless an error has occurred.

There can be at most one outstanding write per Endpoint at any given time. An outstanding write is one in which the on_writable callback has not yet been executed for some previous call to Write. If an attempt is made to call Write while a previous write is still outstanding, the EventEngine must abort.

For failed write operations, implementations should pass the appropriate statuses to on_writable. For example, callbacks might expect to receive CANCELLED on endpoint shutdown.

Implements grpc_event_engine::experimental::EventEngine::Endpoint.

Definition at line 239 of file oracle_event_engine_posix.cc.

Member Data Documentation

◆ is_shutdown_

bool grpc_event_engine::experimental::PosixOracleEndpoint::is_shutdown_ = false
private

Definition at line 110 of file oracle_event_engine_posix.h.

◆ mu_

absl::Mutex grpc_event_engine::experimental::PosixOracleEndpoint::mu_
mutableprivate

Definition at line 109 of file oracle_event_engine_posix.h.

◆ read_ops_channel_

Promise<ReadOperation> grpc_event_engine::experimental::PosixOracleEndpoint::read_ops_channel_
private

Definition at line 112 of file oracle_event_engine_posix.h.

◆ socket_fd_

int grpc_event_engine::experimental::PosixOracleEndpoint::socket_fd_
private

Definition at line 111 of file oracle_event_engine_posix.h.

◆ write_ops_channel_

Promise<WriteOperation> grpc_event_engine::experimental::PosixOracleEndpoint::write_ops_channel_
private

Definition at line 113 of file oracle_event_engine_posix.h.


The documentation for this class was generated from the following files:


grpc
Author(s):
autogenerated on Fri May 16 2025 03:03:40