MXL : Media eXchange Layer
MXL
Loading...
Searching...
No Matches
AddressVector.hpp
Go to the documentation of this file.
1// SPDX-FileCopyrightText: 2025 Contributors to the Media eXchange Layer project.
2//
3// SPDX-License-Identifier: Apache-2.0
4
5#pragma once
6
7#include <memory>
8#include <rdma/fabric.h>
9#include <rdma/fi_domain.h>
10#include "Address.hpp"
11#include "Domain.hpp"
12
14{
15
19 {
20 public:
24 {
25 public:
28 static Attributes defaults() noexcept;
29
32 [[nodiscard]]
33 ::fi_av_attr toRaw() const noexcept;
34
35 public:
38 std::size_t count;
39
45 std::size_t epPerNode;
46 };
47
50 static std::shared_ptr<AddressVector> open(std::shared_ptr<Domain> domain, Attributes attr = Attributes::defaults());
51
53
54 // Copy constructor is deleted
55 AddressVector(AddressVector const&) = delete;
56 void operator=(AddressVector const&) = delete;
57
58 // Implements proper move semantics. An AddressVector in a moved-from state can no longer be used.
59 AddressVector(AddressVector&&) noexcept;
60 // Move-assigning an AddressVector to another, releases all resources from the moved-into AddressVector.
61 AddressVector& operator=(AddressVector&&);
62
66 ::fi_addr_t insert(RawFabricAddress const& addr);
67
70 void remove(::fi_addr_t addr) noexcept;
71
74 [[nodiscard]]
75 std::string addrToString(RawFabricAddress const& addr) const;
76
79 ::fid_av* raw() noexcept;
80
83 [[nodiscard]]
84 ::fid_av const* raw() const noexcept;
85
86 private:
87 AddressVector(fid_av* raw, std::shared_ptr<Domain> domain);
88
91 void close();
92
93 private:
94 fid_av* _raw;
95 std::shared_ptr<Domain> _domain;
96 };
97}
::fi_addr_t insert(RawFabricAddress const &addr)
Insert an address into the address vector. User of this API are responsible for keeping track of inse...
AddressVector(AddressVector const &)=delete
static std::shared_ptr< AddressVector > open(std::shared_ptr< Domain > domain, Attributes attr=Attributes::defaults())
Create an AddressVector.
std::shared_ptr< Domain > _domain
void remove(::fi_addr_t addr) noexcept
Remove an address of the address vector.
std::string addrToString(RawFabricAddress const &addr) const
Convert a libfabric endpoint address into a human-readable string.
void close()
Close the address vector and release all resources. Called from the destructor and the move assignmen...
::fid_av * raw() noexcept
Mutable accessor of the underlying fi_av instance.
void operator=(AddressVector const &)=delete
RAII Wrapper around a libfabric domain (fi_domain).
Definition Domain.hpp:24
Wrapper around a libfabric endpoint address.
Definition Address.hpp:20
Configuration attributes of the AddressVector.
::fi_av_attr toRaw() const noexcept
Convert to libfabric fi_av_attr object.
static Attributes defaults() noexcept
Get default attributes.