33 catch (std::exception
const& e)
35 MXL_ERROR(
"Failed to shut down the initiator: {}", e.what());
56 switch (info.view().endpointType())
71 _inner->addTarget(targetInfo);
81 _inner->removeTarget(targetInfo);
91 _inner->transferGrain(grainIndex, startSlice, endSlice);
95 std::uint64_t payloadOffset, std::uint16_t startSlice, std::uint16_t endSlice)
102 _inner->transferGrainToTarget(targetId, localIndex, remoteIndex, payloadOffset, startSlice, endSlice);
122 return _inner->makeProgress();
132 return _inner->makeProgressBlocking(timeout);
std::uintptr_t Id
An id type that can be used to reference this endpoint from completions and events.
static Exception invalidState(fmt::format_string< T... > fmt, T &&... args)
Make an MXL_ERR_INVALID_STATE exception.
A wrapper around Initiator implementations.
Initiator::MakeProgressResult makeProgressBlocking(std::chrono::steady_clock::duration)
Attempts to progress execution, including connection management and data operations.
void addTarget(TargetInfo const &targetInfo)
Add a target to the initiator.
~InitiatorWrapper()
Shut down the underlying initiator before it is destroyed.
void setup(mxlFabricsInitiatorConfig const &config, InitiatorSetupOptions const &options={})
Set up the initiator with the specified configuration.
static InitiatorWrapper * fromAPI(mxlFabricsInitiator api) noexcept
Convert an mxlFabricsInitiator API object to its underlying InitiatorWrapper.
void transferGrain(std::uint64_t grainIndex, std::uint16_t startSlice, std::uint16_t endSlice)
Transfer a grain to all targets.
void removeTarget(TargetInfo const &targetInfo)
Remove a target from the initiator.
mxlFabricsInitiator toAPI() noexcept
Convert this InitiatorWrapper to its API representation.
void transferGrainToTarget(Endpoint::Id targetId, std::uint64_t localIndex, std::uint64_t remoteIndex, std::uint64_t payloadOffset, std::uint16_t startSlice, std::uint16_t endSlice)
Transfer a grain to a specific target.
Initiator::MakeProgressResult makeProgress()
Attempts to progress execution, including connection management and data operations.
void destroyInner() noexcept
Shut down and destroy the underlying initiator. Errors are logged, because this runs in the destructo...
std::unique_ptr< Initiator > _inner
void transferSamples(std::uint64_t headIndex, std::size_t count)
Transfer samples to all targets.
std::variant< Ready, NotReady, Interrupted > MakeProgressResult
static std::unique_ptr< RCInitiator > setup(mxlFabricsInitiatorConfig const &config, FabricInfoView info, InitiatorSetupOptions const &options={})
Set up a fresh initiator without any targets assigned to it.
static std::unique_ptr< RDMInitiator > setup(mxlFabricsInitiatorConfig const &config, FabricInfoView info, InitiatorSetupOptions const &options={})
Set up a new RDMInitiator.
struct mxlFabricsInitiator_t * mxlFabricsInitiator
struct mxlFabricsInitiatorConfig_t mxlFabricsInitiatorConfig
std::pair< FabricInfo, ProviderConfig > selectSourceInterface(::mxlFabricsInterfaceConfig const &interfaceConfig, bool isTarget)
std::size_t count(uuids::uuid id) const noexcept
Returns the number of writers registered for flow id 'id'.
mxlFabricsInterfaceConfig interface
Provider-independent tuning options for initiator setup.
TargetInfo contains all the information required by an initiator to operate transfers to the given ta...