GRPC C++  1.62.0
Data Structures | Public Types | Public Member Functions
grpc_event_engine::experimental::EventEngine::DNSResolver Class Referenceabstract

Provides asynchronous resolution. More...

#include <event_engine.h>

Data Structures

struct  ResolverOptions
 Optional configuration for DNSResolvers. More...
 
struct  SRVRecord
 DNS SRV record type. More...
 

Public Types

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

Public Member Functions

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

Detailed Description

Provides asynchronous resolution.

This object has a destruction-is-cancellation semantic. Implementations should make sure that all pending requests are cancelled when the object is destroyed and all pending callbacks will be called shortly. If cancellation races with request completion, implementations may choose to either cancel or satisfy the request.

Member Typedef Documentation

◆ LookupHostnameCallback

using grpc_event_engine::experimental::EventEngine::DNSResolver::LookupHostnameCallback = absl::AnyInvocable<void(absl::StatusOr<std::vector<ResolvedAddress> >)>

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

◆ LookupSRVCallback

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

Called with a collection of SRV records.

◆ LookupTXTCallback

using grpc_event_engine::experimental::EventEngine::DNSResolver::LookupTXTCallback = absl::AnyInvocable<void(absl::StatusOr<std::vector<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 void grpc_event_engine::experimental::EventEngine::DNSResolver::LookupHostname ( LookupHostnameCallback  on_resolve,
absl::string_view  name,
absl::string_view  default_port 
)
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 or cancelled, 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 CANCELLED or NOT_FOUND.

◆ LookupSRV()

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

Asynchronously perform an SRV record lookup.

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

◆ LookupTXT()

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

Asynchronously perform a TXT record lookup.

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


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