xgboost
Namespaces | Classes | Enumerations | Functions
xgboost::collective Namespace Reference

Namespaces

 detail
 

Classes

struct  Result
 An error type that's easier to handle than throwing dmlc exception. We can record and propagate the system error code. More...
 
class  SockAddrV6
 
class  SockAddrV4
 
class  SockAddress
 Address for TCP socket, can be either IPv4 or IPv6. More...
 
class  TCPSocket
 TCP socket for simple communication. More...
 

Enumerations

enum class  SockDomain : std::int32_t { kV4 = AF_INET , kV6 = AF_INET6 }
 

Functions

Result operator+ (Result &&lhs, Result &&rhs)
 
auto Success () noexcept(true)
 Return success. More...
 
auto Fail (std::string msg, char const *file=__builtin_FILE(), std::int32_t line=__builtin_LINE())
 Return failure. More...
 
auto Fail (std::string msg, std::error_code errc, char const *file=__builtin_FILE(), std::int32_t line=__builtin_LINE())
 Return failure with errno. More...
 
auto Fail (std::string msg, Result &&prev, char const *file=__builtin_FILE(), std::int32_t line=__builtin_LINE())
 Return failure with a previous error. More...
 
auto Fail (std::string msg, std::error_code errc, Result &&prev, char const *file=__builtin_FILE(), std::int32_t line=__builtin_LINE())
 Return failure with a previous error and a new errno. More...
 
template<typename Fn >
std::enable_if_t< std::is_invocable_v< Fn >, Resultoperator<< (Result &&r, Fn &&fn)
 
void SafeColl (Result const &rc)
 
SockAddress MakeSockAddress (StringView host, in_port_t port)
 Parse host address and return a SockAddress instance. Supports IPv4 and IPv6 host. More...
 
Result Connect (xgboost::StringView host, std::int32_t port, std::int32_t retry, std::chrono::seconds timeout, xgboost::collective::TCPSocket *out_conn)
 Connect to remote address, returns the error code if failed. More...
 
Result GetHostName (std::string *p_out)
 Get the local host name. More...
 
template<typename H >
Result INetNToP (H const &host, std::string *p_out)
 inet_ntop More...
 

Detailed Description

Copyright 2023-2024, XGBoost Contributors

Enumeration Type Documentation

◆ SockDomain

enum xgboost::collective::SockDomain : std::int32_t
strong
Enumerator
kV4 
kV6 

Function Documentation

◆ Connect()

Result xgboost::collective::Connect ( xgboost::StringView  host,
std::int32_t  port,
std::int32_t  retry,
std::chrono::seconds  timeout,
xgboost::collective::TCPSocket out_conn 
)

Connect to remote address, returns the error code if failed.

Parameters
hostHost IP address.
portConnection port.
retryNumber of retries to attempt.
timeoutTimeout of each connection attempt.
out_connOutput socket if the connection is successful. Value is invalid and undefined if the connection failed.
Returns
Connection status.

◆ Fail() [1/4]

auto xgboost::collective::Fail ( std::string  msg,
char const *  file = __builtin_FILE(),
std::int32_t  line = __builtin_LINE() 
)
inline

Return failure.

◆ Fail() [2/4]

auto xgboost::collective::Fail ( std::string  msg,
Result &&  prev,
char const *  file = __builtin_FILE(),
std::int32_t  line = __builtin_LINE() 
)
inline

Return failure with a previous error.

◆ Fail() [3/4]

auto xgboost::collective::Fail ( std::string  msg,
std::error_code  errc,
char const *  file = __builtin_FILE(),
std::int32_t  line = __builtin_LINE() 
)
inline

Return failure with errno.

◆ Fail() [4/4]

auto xgboost::collective::Fail ( std::string  msg,
std::error_code  errc,
Result &&  prev,
char const *  file = __builtin_FILE(),
std::int32_t  line = __builtin_LINE() 
)
inline

Return failure with a previous error and a new errno.

◆ GetHostName()

Result xgboost::collective::GetHostName ( std::string *  p_out)

Get the local host name.

◆ INetNToP()

template<typename H >
Result xgboost::collective::INetNToP ( H const &  host,
std::string *  p_out 
)

inet_ntop

◆ MakeSockAddress()

SockAddress xgboost::collective::MakeSockAddress ( StringView  host,
in_port_t  port 
)

Parse host address and return a SockAddress instance. Supports IPv4 and IPv6 host.

◆ operator+()

Result xgboost::collective::operator+ ( Result &&  lhs,
Result &&  rhs 
)
inline

◆ operator<<()

template<typename Fn >
std::enable_if_t<std::is_invocable_v<Fn>, Result> xgboost::collective::operator<< ( Result &&  r,
Fn &&  fn 
)

◆ SafeColl()

void xgboost::collective::SafeColl ( Result const &  rc)

◆ Success()

auto xgboost::collective::Success ( )
inlinenoexcept

Return success.