Loading...
Searching...
No Matches
remote_key.h
1
5#pragma once
6#include <memory>
7#include <string>
8#include <utility>
9#include <vector>
10
11#include <ucp/api/ucp.h>
12
13#include <ucxx/component.h>
14#include <ucxx/endpoint.h>
15#include <ucxx/memory_handle.h>
16#include <ucxx/remote_key_builder.h>
17
18namespace ucxx {
19
20class RemoteKey;
21
29
39class RemoteKey : public Component {
40 private:
41 ucp_rkey_h _remoteKey{nullptr};
42 void* _packedRemoteKey{
43 nullptr};
44 size_t _packedRemoteKeySize{0};
45 std::vector<char> _packedRemoteKeyVector{};
46 uint64_t _memoryBaseAddress{0};
47 size_t _memorySize{0};
48
64 explicit RemoteKey(std::shared_ptr<MemoryHandle> memoryHandle);
65
84 RemoteKey(std::shared_ptr<Endpoint> endpoint, SerializedRemoteKey serializedRemoteKey);
85
101 void deserialize(const SerializedRemoteKey& serializedHeader);
102
103 public:
104 // Allow internal construction without exposing factory functions.
105 friend class detail::ConstructorFactory;
106
107 ~RemoteKey();
108
124 [[nodiscard]] ucp_rkey_h getHandle();
125
139 [[nodiscard]] size_t getSize() const;
140
155 [[nodiscard]] uint64_t getBaseAddress();
156
170 [[nodiscard]] SerializedRemoteKey serialize() const;
171};
172
173} // namespace ucxx
A UCXX component class to prevent early destruction of parent object.
Definition component.h:21
Component holding a UCP rkey (remote key).
Definition remote_key.h:39
ucp_rkey_h getHandle()
Get the underlying ucp_rkey_h handle.
size_t getSize() const
Get the size of the memory allocation.
uint64_t getBaseAddress()
Get the base address of the memory allocation.
SerializedRemoteKey serialize() const
Serialize the remote key.
Definition address.h:16
const std::string SerializedRemoteKey
Serialized form of a remote key.
Definition typedefs.h:304
size_t SerializedRemoteKeyHash
Type for hashing serialized remote keys.
Definition remote_key.h:28