GRPC Core  18.0.0
Data Structures | Public Types | Public Member Functions
grpc_event_engine::experimental::EventEngine::DNSResolver Class Referenceabstract

The DNSResolver that provides asynchronous resolution. More...

#include <event_engine.h>

Data Structures

struct  LookupTaskHandle
 A task handle for DNS Resolution requests. More...
 
struct  SRVRecord
 A DNS SRV record type. More...
 

Public Types

using LookupHostnameCallback = std::function< void(absl::StatusOr< std::vector< ResolvedAddress > >)>
 Called with the collection of sockaddrs that were resolved from a given target address. More...
 
using LookupSRVCallback = std::function< void(absl::StatusOr< std::vector< SRVRecord > >)>
 Called with a collection of SRV records. More...
 
using LookupTXTCallback = std::function< void(absl::StatusOr< std::string >)>
 Called with the result of a TXT record lookup. More...
 

Public Member Functions

virtual ~DNSResolver ()=default
 
virtual LookupTaskHandle LookupHostname (LookupHostnameCallback on_resolve, absl::string_view address, absl::string_view default_port, absl::Time deadline)=0
 Asynchronously resolve an address. More...
 
virtual LookupTaskHandle LookupSRV (LookupSRVCallback on_resolve, absl::string_view name, absl::Time deadline)=0
 Asynchronously perform an SRV record lookup. More...
 
virtual LookupTaskHandle LookupTXT (LookupTXTCallback on_resolve, absl::string_view name, absl::Time deadline)=0
 Asynchronously perform a TXT record lookup. More...
 
virtual void TryCancelLookup (LookupTaskHandle handle)=0
 Cancel an asynchronous lookup operation. More...
 

Detailed Description

The DNSResolver that provides asynchronous resolution.

Member Typedef Documentation

◆ LookupHostnameCallback

Called with the collection of sockaddrs that were resolved from a given target address.

◆ LookupSRVCallback

using grpc_event_engine::experimental::EventEngine::DNSResolver::LookupSRVCallback = std::function<void(absl::StatusOr<std::vector<SRVRecord> >)>

Called with a collection of SRV records.

◆ LookupTXTCallback

using grpc_event_engine::experimental::EventEngine::DNSResolver::LookupTXTCallback = std::function<void(absl::StatusOr<std::string>)>

Called with the result of a TXT record lookup.

Constructor & Destructor Documentation

◆ ~DNSResolver()

virtual grpc_event_engine::experimental::EventEngine::DNSResolver::~DNSResolver ( )
virtualdefault

Member Function Documentation

◆ LookupHostname()

virtual LookupTaskHandle grpc_event_engine::experimental::EventEngine::DNSResolver::LookupHostname ( LookupHostnameCallback  on_resolve,
absl::string_view  address,
absl::string_view  default_port,
absl::Time  deadline 
)
pure virtual

Asynchronously resolve an address.

default_port may be a non-numeric named service port, and will only be used if address does not already contain a port component.

When the lookup is complete, the on_resolve callback will be invoked with a status indicating the success or failure of the lookup. Implementations should pass the appropriate statuses to the callback. For example, callbacks might expect to receive DEADLINE_EXCEEDED when the deadline is exceeded or CANCELLED if the lookup was cancelled.

◆ LookupSRV()

virtual LookupTaskHandle grpc_event_engine::experimental::EventEngine::DNSResolver::LookupSRV ( LookupSRVCallback  on_resolve,
absl::string_view  name,
absl::Time  deadline 
)
pure virtual

Asynchronously perform an SRV record lookup.

on_resolve has the same meaning and expectations as LookupHostname's on_resolve callback.

◆ LookupTXT()

virtual LookupTaskHandle grpc_event_engine::experimental::EventEngine::DNSResolver::LookupTXT ( LookupTXTCallback  on_resolve,
absl::string_view  name,
absl::Time  deadline 
)
pure virtual

Asynchronously perform a TXT record lookup.

on_resolve has the same meaning and expectations as LookupHostname's on_resolve callback.

◆ TryCancelLookup()

virtual void grpc_event_engine::experimental::EventEngine::DNSResolver::TryCancelLookup ( LookupTaskHandle  handle)
pure virtual

Cancel an asynchronous lookup operation.


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