11#include <rdma/fabric.h>
12#include <rdma/fi_errno.h>
25 .addr = std::bit_cast<std::uint64_t>(&
data),
26 .len =
sizeof(std::uint64_t),
47 catch (std::exception
const& e)
49 MXL_ERROR(
"Failed to shut down the target: {}", e.what());
82 return _inner->readBlocking(timeout);
85 template<
typename TargetT>
88 auto [inner, targetInfo] = TargetT::setup(config, info, options);
90 return std::move(targetInfo);
98 switch (info->ep_attr->type)
static Exception invalidState(fmt::format_string< T... > fmt, T &&... args)
Make an MXL_ERR_INVALID_STATE exception.
Non-owning view of a FabricInfo. Returned when iterating over a FabricInfoList.
A wrapper around Target implementations.
std::optional< Target::ReadResult > read()
~TargetWrapper()
Shut down the underlying target before it is destroyed.
std::unique_ptr< Target > _inner
std::optional< Target::ReadResult > readBlocking(std::chrono::steady_clock::duration timeout)
void destroyInner() noexcept
Shut down and destroy the underlying target. Errors are logged, because this runs in the destructor.
mxlFabricsTarget toAPI() noexcept
Convert this TargetWrapper to its API representation.
static TargetWrapper * fromAPI(mxlFabricsTarget api) noexcept
Convert an mxlFabricsTarget API object to its underlying TargetWrapper.
std::unique_ptr< TargetInfo > setup(mxlFabricsTargetConfig const &config, TargetSetupOptions const &options={})
Set up the target with the specified configuration.
struct mxlFabricsTargetConfig_t mxlFabricsTargetConfig
struct mxlFabricsTarget_t * mxlFabricsTarget
std::pair< FabricInfo, ProviderConfig > selectSourceInterface(::mxlFabricsInterfaceConfig const &interfaceConfig, bool isTarget)
mxlFabricsInterfaceConfig interface
Represent a source memory region used for for data transfer.
Provider-independent tuning options for target setup.