Type to represent a completion entry from a CompletionQueue.
More...
#include <Completion.hpp>
|
| using | Token = std::uintptr_t |
| | A token used to associate a completion entry with an endpoint.
|
|
| | Completion (Data entry) |
| | Completion (Error entry) |
| Data | data () const |
| | Accessor for the data variant. Calling this on an error entry will throw.
|
| Error | err () const |
| | Accessor for the error variant. Calling this on a data entry will throw.
|
| bool | isDataEntry () const noexcept |
| | Check whether this is a data entry.
|
| bool | isErrEntry () const noexcept |
| | check whether this is an error entry
|
| Token | token () const noexcept |
| | Get the token that was associated with the operation that has completed.
|
| std::optional< Data > | tryData () const noexcept |
| | Attempt to access the data variant. Returns std::nullopt if this is an error entry.
|
| std::optional< Error > | tryErr () const noexcept |
| | Attempt to access the error variant. Returns std::nullopt if this is a data entry.
|
|
| static Token | randomToken () |
| static constexpr Token | tokenFromContextValue (void *contextValue) noexcept |
| | Convert between completion tokens and context values that can be written to and read from raw libfabric queue entries.
|
| static constexpr void * | tokenToContextValue (Token token) noexcept |
| | Convert between completion tokens and context values that can be written to and read from raw libfabric queue entries.
|
Type to represent a completion entry from a CompletionQueue.
Definition at line 21 of file Completion.hpp.
◆ Inner
◆ Token
A token used to associate a completion entry with an endpoint.
Definition at line 26 of file Completion.hpp.
◆ Completion() [1/2]
| mxl::lib::fabrics::ofi::Completion::Completion |
( |
Data | entry | ) |
|
|
explicit |
◆ Completion() [2/2]
| mxl::lib::fabrics::ofi::Completion::Completion |
( |
Error | entry | ) |
|
|
explicit |
◆ data()
Accessor for the data variant. Calling this on an error entry will throw.
Definition at line 58 of file Completion.cpp.
59 {
61 {
63 }
64
66 }
Data data() const
Accessor for the data variant. Calling this on an error entry will throw.
static Exception invalidState(fmt::format_string< T... > fmt, T &&... args)
Make an MXL_ERR_INVALID_STATE exception.
◆ err()
Accessor for the error variant. Calling this on a data entry will throw.
Definition at line 90 of file Completion.cpp.
91 {
92 if (
auto error = std::get_if<Error>(&
_inner); error)
93 {
94 return *error;
95 }
96
98 }
◆ isDataEntry()
| bool mxl::lib::fabrics::ofi::Completion::isDataEntry |
( |
| ) |
const |
|
nodiscardnoexcept |
Check whether this is a data entry.
Definition at line 120 of file Completion.cpp.
121 {
122 return std::holds_alternative<Data>(
_inner);
123 }
◆ isErrEntry()
| bool mxl::lib::fabrics::ofi::Completion::isErrEntry |
( |
| ) |
const |
|
nodiscardnoexcept |
check whether this is an error entry
Definition at line 125 of file Completion.cpp.
126 {
127 return std::holds_alternative<Error>(
_inner);
128 }
◆ randomToken()
Definition at line 81 of file Completion.cpp.
82 {
83 std::uniform_int_distribution<Completion::Token> dist;
84 std::random_device rd;
85 std::mt19937 eng{rd()};
86
87 return dist(eng);
88 }
◆ token()
Get the token that was associated with the operation that has completed.
Definition at line 130 of file Completion.cpp.
131 {
132 return std::visit(
133 overloaded{
134 [](Completion::Data
const&
data) {
return data.token(); },
135 [](Completion::Error
const&
err) {
return err.token(); },
136 },
138 }
Error err() const
Accessor for the error variant. Calling this on a data entry will throw.
◆ tokenFromContextValue()
| constexpr Token mxl::lib::fabrics::ofi::Completion::tokenFromContextValue |
( |
void * | contextValue | ) |
|
|
inlinestaticnodiscardconstexprnoexcept |
Convert between completion tokens and context values that can be written to and read from raw libfabric queue entries.
Definition at line 109 of file Completion.hpp.
110 {
111 return std::bit_cast<Token>(contextValue);
112 }
◆ tokenToContextValue()
| constexpr void * mxl::lib::fabrics::ofi::Completion::tokenToContextValue |
( |
Token | token | ) |
|
|
inlinestaticnodiscardconstexprnoexcept |
Convert between completion tokens and context values that can be written to and read from raw libfabric queue entries.
Definition at line 101 of file Completion.hpp.
102 {
103 return std::bit_cast<void*>(
token);
104 }
Token token() const noexcept
Get the token that was associated with the operation that has completed.
◆ tryData()
| std::optional< Completion::Data > mxl::lib::fabrics::ofi::Completion::tryData |
( |
| ) |
const |
|
nodiscardnoexcept |
Attempt to access the data variant. Returns std::nullopt if this is an error entry.
Definition at line 100 of file Completion.cpp.
101 {
103 {
105 }
106
107 return std::nullopt;
108 }
◆ tryErr()
| std::optional< Completion::Error > mxl::lib::fabrics::ofi::Completion::tryErr |
( |
| ) |
const |
|
nodiscardnoexcept |
Attempt to access the error variant. Returns std::nullopt if this is a data entry.
Definition at line 110 of file Completion.cpp.
111 {
112 if (
auto error = std::get_if<Error>(&
_inner); error)
113 {
114 return {*error};
115 }
116
117 return std::nullopt;
118 }
◆ CompletionQueue
| friend class CompletionQueue |
|
friend |
◆ _inner
| Inner mxl::lib::fabrics::ofi::Completion::_inner |
|
private |
The documentation for this class was generated from the following files: