• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

STEllAR-GROUP / hpx / #882

31 Aug 2023 07:44PM UTC coverage: 41.798% (-44.7%) from 86.546%
#882

push

19442 of 46514 relevant lines covered (41.8%)

126375.38 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

37.32
/libs/full/components_base/src/agas_interface.cpp
1
//  Copyright (c) 2011 Bryce Adelstein-Lelbach
2
//  Copyright (c) 2007-2022 Hartmut Kaiser
3
//
4
//  SPDX-License-Identifier: BSL-1.0
5
//  Distributed under the Boost Software License, Version 1.0. (See accompanying
6
//  file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
7

8
#include <hpx/components_base/agas_interface.hpp>
9
#include <hpx/components_base/detail/agas_interface_functions.hpp>
10
#include <hpx/components_base/pinned_ptr.hpp>
11
#include <hpx/modules/async_base.hpp>
12
#include <hpx/modules/coroutines.hpp>
13
#include <hpx/modules/datastructures.hpp>
14
#include <hpx/modules/errors.hpp>
15
#include <hpx/modules/functional.hpp>
16
#include <hpx/modules/futures.hpp>
17
#include <hpx/naming_base/naming_base.hpp>
18
#include <hpx/parcelset_base/parcel_interface.hpp>
19

20
#include <cstddef>
21
#include <cstdint>
22
#include <map>
23
#include <string>
24
#include <system_error>
25
#include <utility>
26
#include <vector>
27

28
namespace hpx::agas {
29

30
    ///////////////////////////////////////////////////////////////////////////
31
    bool is_console()
32
    {
90✔
33
        return detail::is_console();
34
    }
90✔
35

36
    ///////////////////////////////////////////////////////////////////////////
37
    bool register_name(launch::sync_policy, std::string const& name,
38
        naming::gid_type const& gid, error_code& ec)
122✔
39
    {
40
        return detail::register_name(name, gid, ec);
41
    }
122✔
42

43
    bool register_name(launch::sync_policy, std::string const& name,
44
        hpx::id_type const& id, error_code& ec)
3✔
45
    {
46
        return detail::register_name_id(name, id, ec);
47
    }
3✔
48

49
    hpx::future<bool> register_name(
50
        std::string const& name, hpx::id_type const& id)
105✔
51
    {
52
        return detail::register_name_async(name, id);
53
    }
105✔
54

55
    ///////////////////////////////////////////////////////////////////////////
56
    hpx::id_type unregister_name(
57
        launch::sync_policy, std::string const& name, error_code& ec)
109✔
58
    {
59
        return detail::unregister_name(name, ec);
60
    }
109✔
61

62
    hpx::future<hpx::id_type> unregister_name(std::string const& name)
63
    {
60✔
64
        return detail::unregister_name_async(name);
65
    }
60✔
66

67
    ///////////////////////////////////////////////////////////////////////////
68
    hpx::future<hpx::id_type> resolve_name(std::string const& name)
69
    {
×
70
        return detail::resolve_name_async(name);
71
    }
×
72

73
    hpx::id_type resolve_name(
74
        launch::sync_policy, std::string const& name, error_code& ec)
×
75
    {
76
        return detail::resolve_name(name, ec);
77
    }
×
78

79
    ///////////////////////////////////////////////////////////////////////////
80
    hpx::future<std::uint32_t> get_num_localities(naming::component_type type)
81
    {
×
82
        return detail::get_num_localities_async(type);
83
    }
×
84

85
    std::uint32_t get_num_localities(
86
        launch::sync_policy, naming::component_type type, error_code& ec)
×
87
    {
88
        return detail::get_num_localities(type, ec);
89
    }
×
90

91
    hpx::future<std::vector<std::uint32_t>> get_num_threads()
92
    {
×
93
        return detail::get_num_threads_async();
94
    }
×
95

96
    std::vector<std::uint32_t> get_num_threads(
97
        launch::sync_policy, error_code& ec)
×
98
    {
99
        return detail::get_num_threads(ec);
100
    }
×
101

102
    hpx::future<std::uint32_t> get_num_overall_threads()
103
    {
×
104
        return detail::get_num_overall_threads_async();
105
    }
×
106

107
    std::uint32_t get_num_overall_threads(launch::sync_policy, error_code& ec)
108
    {
×
109
        return detail::get_num_overall_threads(ec);
110
    }
×
111

112
    std::string get_component_type_name(
113
        naming::component_type type, error_code& ec)
×
114
    {
115
        return detail::get_component_type_name(type, ec);
116
    }
×
117

118
    ///////////////////////////////////////////////////////////////////////////
119
    bool is_local_address_cached(naming::gid_type const& gid, error_code& ec)
120
    {
×
121
        return detail::is_local_address_cached(gid, ec);
122
    }
×
123

124
    bool is_local_address_cached(
125
        naming::gid_type const& gid, naming::address& addr, error_code& ec)
42,347✔
126
    {
127
        return detail::is_local_address_cached_addr(gid, addr, ec);
128
    }
42,347✔
129

130
    bool is_local_address_cached(naming::gid_type const& gid,
131
        naming::address& addr, std::pair<bool, components::pinned_ptr>& r,
×
132
        hpx::move_only_function<std::pair<bool, components::pinned_ptr>(
133
            naming::address const&)>&& f,
134
        error_code& ec)
135
    {
136
        return detail::is_local_address_cached_addr_pinned_ptr(
137
            gid, addr, r, HPX_MOVE(f), ec);
×
138
    }
×
139

140
    void update_cache_entry(naming::gid_type const& gid,
141
        naming::address const& addr, std::uint64_t count, std::uint64_t offset,
×
142
        error_code& ec)
143
    {
144
        return detail::update_cache_entry(gid, addr, count, offset, ec);
145
    }
×
146

147
    bool is_local_lva_encoded_address(naming::gid_type const& gid)
148
    {
×
149
        return detail::is_local_lva_encoded_address(gid);
150
    }
×
151

152
    ///////////////////////////////////////////////////////////////////////////
153
    hpx::future_or_value<naming::address> resolve_async(hpx::id_type const& id)
154
    {
×
155
        return detail::resolve_async(id);
156
    }
×
157

158
    hpx::future<naming::address> resolve(hpx::id_type const& id)
159
    {
×
160
        auto result = detail::resolve_async(id);
161
        if (result.has_value())
×
162
        {
×
163
            return hpx::make_ready_future(HPX_MOVE(result).get_value());
164
        }
165

166
        auto f = HPX_MOVE(result).get_future();
167
        return f;
168
    }
169

×
170
    naming::address resolve(
171
        launch::sync_policy, hpx::id_type const& id, error_code& ec)
172
    {
×
173
        return detail::resolve(id, ec);
174
    }
175

×
176
    bool resolve_local(
177
        naming::gid_type const& gid, naming::address& addr, error_code& ec)
178
    {
×
179
        return detail::resolve_local(gid, addr, ec);
180
    }
181

×
182
    bool resolve_cached(naming::gid_type const& gid, naming::address& addr)
183
    {
×
184
        return detail::resolve_cached(gid, addr);
185
    }
186

×
187
    hpx::future<bool> bind(naming::gid_type const& gid,
188
        naming::address const& addr, std::uint32_t locality_id)
189
    {
×
190
        return detail::bind_async(gid, addr, locality_id);
191
    }
192

×
193
    bool bind(launch::sync_policy, naming::gid_type const& gid,
194
        naming::address const& addr, std::uint32_t locality_id, error_code& ec)
195
    {
×
196
        return detail::bind(gid, addr, locality_id, ec);
197
    }
198

×
199
    hpx::future<bool> bind(naming::gid_type const& gid,
200
        naming::address const& addr, naming::gid_type const& locality_)
201
    {
×
202
        return detail::bind_async_locality(gid, addr, locality_);
203
    }
204

×
205
    bool bind(launch::sync_policy, naming::gid_type const& gid,
206
        naming::address const& addr, naming::gid_type const& locality_,
207
        error_code& ec)
208
    {
×
209
        return detail::bind_locality(gid, addr, locality_, ec);
210
    }
211

×
212
    hpx::future<naming::address> unbind(
213
        naming::gid_type const& id, std::uint64_t t)
214
    {
×
215
        return detail::unbind_async(id, t);
216
    }
217

1,055✔
218
    naming::address unbind(launch::sync_policy, naming::gid_type const& id,
219
        std::uint64_t type, error_code& ec)
220
    {
1,055✔
221
        return detail::unbind(id, type, ec);
222
    }
223

224
    ///////////////////////////////////////////////////////////////////////////
122✔
225
    bool bind_gid_local(naming::gid_type const& gid,
226
        naming::address const& addr, error_code& ec)
227
    {
122✔
228
        return detail::bind_gid_local(gid, addr, ec);
229
    }
230

61✔
231
    void unbind_gid_local(naming::gid_type const& gid, error_code& ec)
232
    {
61✔
233
        return detail::unbind_gid_local(gid, ec);
234
    }
235

×
236
    bool bind_range_local(naming::gid_type const& gid, std::size_t count,
237
        naming::address const& addr, std::size_t offset, error_code& ec)
238
    {
×
239
        return detail::bind_range_local(gid, count, addr, offset, ec);
240
    }
241

9✔
242
    void unbind_range_local(
243
        naming::gid_type const& gid, std::size_t count, error_code& ec)
244
    {
9✔
245
        return detail::unbind_range_local(gid, count, ec);
246
    }
247

248
    ///////////////////////////////////////////////////////////////////////////
686,051✔
249
    void garbage_collect_non_blocking(error_code& ec)
250
    {
686,051✔
251
        detail::garbage_collect_non_blocking(ec);
686,051✔
252
    }
253

32✔
254
    void garbage_collect(error_code& ec)
255
    {
32✔
256
        detail::garbage_collect(ec);
32✔
257
    }
258

259
    /// \brief Invoke an asynchronous garbage collection step on the given target
260
    ///        locality.
×
261
    void garbage_collect_non_blocking(hpx::id_type const& id, error_code& ec)
262
    {
×
263
        detail::garbage_collect_non_blocking_id(id, ec);
×
264
    }
265

266
    /// \brief Invoke a synchronous garbage collection step on the given target
267
    ///        locality.
×
268
    void garbage_collect(hpx::id_type const& id, error_code& ec)
269
    {
×
270
        detail::garbage_collect_id(id, ec);
×
271
    }
272

273
    /// \brief Return an id_type referring to the console locality.
×
274
    hpx::id_type get_console_locality(error_code& ec)
275
    {
×
276
        return detail::get_console_locality(ec);
277
    }
278

129,193✔
279
    std::uint32_t get_locality_id(error_code& ec)
280
    {
129,193✔
281
        return detail::get_locality_id(ec);
282
    }
283

39✔
284
    std::vector<std::uint32_t> get_all_locality_ids(
285
        naming::component_type type, error_code& ec)
286
    {
39✔
287
        return detail::get_all_locality_ids(type, ec);
288
    }
289

290
    ///////////////////////////////////////////////////////////////////////////
291
#if defined(HPX_HAVE_NETWORKING)
408✔
292
    parcelset::endpoints_type const& resolve_locality(
293
        naming::gid_type const& gid, error_code& ec)
294
    {
408✔
295
        return detail::resolve_locality(gid, ec);
296
    }
297

×
298
    void remove_resolved_locality(naming::gid_type const& gid)
299
    {
×
300
        return detail::remove_resolved_locality(gid);
301
    }
302
#endif
303

304
    ///////////////////////////////////////////////////////////////////////////
×
305
    naming::gid_type get_next_id(std::size_t count, error_code& ec)
306
    {
×
307
        return detail::get_next_id(count, ec);
308
    }
309

310
    ///////////////////////////////////////////////////////////////////////////
1,141✔
311
    void decref(
312
        naming::gid_type const& gid, std::int64_t credits, error_code& ec)
313
    {
1,141✔
314
        detail::decref(gid, credits, ec);
1,141✔
315
    }
316

317
    ///////////////////////////////////////////////////////////////////////////
×
318
    hpx::future_or_value<std::int64_t> incref(naming::gid_type const& gid,
319
        std::int64_t credits, hpx::id_type const& keep_alive)
320
    {
×
321
        return detail::incref_async(gid, credits, keep_alive);
322
    }
323

32✔
324
    std::int64_t incref(launch::sync_policy, naming::gid_type const& gid,
325
        std::int64_t credits, hpx::id_type const& keep_alive, error_code& ec)
326
    {
32✔
327
        auto result = detail::incref_async(gid, credits, keep_alive);
32✔
328
        if (result.has_value())
329
        {
32✔
330
            return HPX_MOVE(result).get_value();
331
        }
×
332
        return result.get_future().get(ec);
333
    }
334

335
    ///////////////////////////////////////////////////////////////////////////
32✔
336
    std::int64_t replenish_credits(naming::gid_type& gid)
337
    {
32✔
338
        return detail::replenish_credits(gid);
339
    }
340

341
    ///////////////////////////////////////////////////////////////////////////
×
342
    hpx::future_or_value<id_type> get_colocation_id(hpx::id_type const& id)
343
    {
×
344
        return detail::get_colocation_id_async(id);
345
    }
346

×
347
    hpx::id_type get_colocation_id(
348
        launch::sync_policy, hpx::id_type const& id, error_code& ec)
349
    {
×
350
        return detail::get_colocation_id(id, ec);
351
    }
352

353
    ///////////////////////////////////////////////////////////////////////////
8✔
354
    hpx::future<hpx::id_type> on_symbol_namespace_event(
355
        std::string const& name, bool call_for_past_events)
356
    {
8✔
357
        return detail::on_symbol_namespace_event(name, call_for_past_events);
358
    }
359

360
    ///////////////////////////////////////////////////////////////////////////
×
361
    hpx::future<std::pair<hpx::id_type, naming::address>> begin_migration(
362
        hpx::id_type const& id)
363
    {
×
364
        return detail::begin_migration(id);
365
    }
366

×
367
    bool end_migration(hpx::id_type const& id)
368
    {
×
369
        return detail::end_migration(id);
370
    }
371

×
372
    hpx::future<void> mark_as_migrated(naming::gid_type const& gid,
373
        hpx::move_only_function<std::pair<bool, hpx::future<void>>()>&& f,
374
        bool expect_to_be_marked_as_migrating)
375
    {
376
        return detail::mark_as_migrated(
×
377
            gid, HPX_MOVE(f), expect_to_be_marked_as_migrating);
378
    }
379

×
380
    std::pair<bool, components::pinned_ptr> was_object_migrated(
381
        naming::gid_type const& gid,
382
        hpx::move_only_function<components::pinned_ptr()>&& f)
383
    {
×
384
        return detail::was_object_migrated(gid, HPX_MOVE(f));
385
    }
386

×
387
    void unmark_as_migrated(
388
        naming::gid_type const& gid, hpx::move_only_function<void()>&& f)
389
    {
×
390
        return detail::unmark_as_migrated(gid, HPX_MOVE(f));
391
    }
392

×
393
    hpx::future<std::map<std::string, hpx::id_type>> find_symbols(
394
        std::string const& pattern)
395
    {
×
396
        return detail::find_symbols_async(pattern);
397
    }
398

×
399
    std::map<std::string, hpx::id_type> find_symbols(
400
        hpx::launch::sync_policy, std::string const& pattern)
401
    {
×
402
        return detail::find_symbols(pattern);
403
    }
404

405
    ///////////////////////////////////////////////////////////////////////////
859✔
406
    naming::component_type register_factory(
407
        std::uint32_t prefix, std::string const& name, error_code& ec)
408
    {
859✔
409
        return detail::register_factory(prefix, name, ec);
410
    }
411

737✔
412
    naming::component_type get_component_id(
413
        std::string const& name, error_code& ec)
414
    {
737✔
415
        return detail::get_component_id(name, ec);
416
    }
417

418
    ///////////////////////////////////////////////////////////////////////////
×
419
    void destroy_component(
420
        naming::gid_type const& gid, naming::address const& addr)
421
    {
×
422
        return detail::destroy_component(gid, addr);
423
    }
424

425
    ///////////////////////////////////////////////////////////////////////////
426
#if defined(HPX_HAVE_NETWORKING)
×
427
    void route(parcelset::parcel&& p,
428
        hpx::function<void(std::error_code const&, parcelset::parcel const&)>&&
429
            f,
430
        threads::thread_priority local_priority)
431
    {
×
432
        return detail::route(HPX_MOVE(p), HPX_MOVE(f), local_priority);
433
    }
434
#endif
435

436
    ///////////////////////////////////////////////////////////////////////////
×
437
    naming::address_type get_primary_ns_lva()
438
    {
×
439
        return detail::get_primary_ns_lva();
440
    }
441

15✔
442
    naming::address_type get_symbol_ns_lva()
443
    {
15✔
444
        return detail::get_symbol_ns_lva();
445
    }
446

33✔
447
    naming::address_type get_runtime_support_lva()
448
    {
33✔
449
        return detail::get_runtime_support_lva();
450
    }
451
}    // namespace hpx::agas
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc