Program Listing for File Sender.hpp

Return to documentation for file (BackendLibfabric/Sender.hpp)

#ifndef NETIO3BACKEND_BACKENDLIBFABRIC_SENDER_HPP
#define NETIO3BACKEND_BACKENDLIBFABRIC_SENDER_HPP

#include <rdma/fi_domain.h>

#include <tracy/Tracy.hpp>

#include "ActiveEndpoint.hpp"
#include "netio3-backend/Netio3Backend.hpp"

namespace netio3::libfabric {
  class Sender
  {
  public:
    explicit Sender(ActiveEndpoint& endpoint) : m_endpoint(endpoint) {}

    [[nodiscard]] NetioStatus send_data(iovec data, fid_mr* mr, std::uint64_t key, fi_addr_t addr) const
    {
      ZoneScoped;
      return send_data(std::span{&data, 1}, std::span{&mr, 1}, key, addr);
    }

    [[nodiscard]] NetioStatus send_data(std::span<const iovec> data,
                                        std::span<fid_mr*> mrs,
                                        std::uint64_t key,
                                        fi_addr_t addr) const;

  private:
    std::reference_wrapper<ActiveEndpoint> m_endpoint;
  };
}  // namespace netio3::libfabric

#endif  // NETIO3BACKEND_BACKENDLIBFABRIC_SENDER_HPP