Line data Source code
1 : /*
2 : Copyright 2018-2024, Barcelona Supercomputing Center (BSC), Spain
3 : Copyright 2015-2024, Johannes Gutenberg Universitaet Mainz, Germany
4 :
5 : This software was partially supported by the
6 : EC H2020 funded project NEXTGenIO (Project ID: 671951, www.nextgenio.eu).
7 :
8 : This software was partially supported by the
9 : ADA-FS project under the SPPEXA project funded by the DFG.
10 :
11 : This file is part of GekkoFS' POSIX interface.
12 :
13 : GekkoFS' POSIX interface is free software: you can redistribute it and/or
14 : modify it under the terms of the GNU Lesser General Public License as
15 : published by the Free Software Foundation, either version 3 of the License,
16 : or (at your option) any later version.
17 :
18 : GekkoFS' POSIX interface is distributed in the hope that it will be useful,
19 : but WITHOUT ANY WARRANTY; without even the implied warranty of
20 : MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 : GNU Lesser General Public License for more details.
22 :
23 : You should have received a copy of the GNU Lesser General Public License
24 : along with GekkoFS' POSIX interface. If not, see
25 : <https://www.gnu.org/licenses/>.
26 :
27 : SPDX-License-Identifier: LGPL-3.0-or-later
28 : */
29 :
30 : #ifndef GKFS_RPCS_TYPES_HPP
31 : #define GKFS_RPCS_TYPES_HPP
32 :
33 : // C includes
34 : #include <mercury.h>
35 : #include <mercury_proc_string.h>
36 : #include <mercury_macros.h>
37 :
38 : // C++ includes
39 : #include <string>
40 :
41 : // hermes includes
42 : #include <hermes.hpp>
43 :
44 : #ifndef HG_GEN_PROC_NAME
45 : #define HG_GEN_PROC_NAME(struct_type_name) hg_proc_##struct_type_name
46 : #endif
47 :
48 :
49 : #include <common/common_defs.hpp>
50 : #include <common/rpc/rpc_types.hpp>
51 :
52 : namespace hermes::detail {
53 :
54 : struct hg_void_t {};
55 :
56 : static HG_INLINE hg_return_t
57 248 : hg_proc_void_t(hg_proc_t proc, void* data) {
58 248 : (void) proc;
59 248 : (void) data;
60 :
61 248 : return HG_SUCCESS;
62 : }
63 :
64 : } // namespace hermes::detail
65 :
66 : namespace gkfs::rpc {
67 :
68 : //==============================================================================
69 : // definitions for fs_config
70 : struct fs_config {
71 :
72 : // forward declarations of public input/output types for this RPC
73 : class input;
74 :
75 : class output;
76 :
77 : // traits used so that the engine knows what to do with the RPC
78 : using self_type = fs_config;
79 : using handle_type = hermes::rpc_handle<self_type>;
80 : using input_type = input;
81 : using output_type = output;
82 : using mercury_input_type = hermes::detail::hg_void_t;
83 : using mercury_output_type = rpc_config_out_t;
84 :
85 : // RPC public identifier
86 : // (N.B: we reuse the same IDs assigned by Margo so that the daemon
87 : // understands Hermes RPCs)
88 : constexpr static const uint64_t public_id = 3033006080;
89 :
90 : // RPC internal Mercury identifier
91 : constexpr static const hg_id_t mercury_id = public_id;
92 :
93 : // RPC name
94 : constexpr static const auto name = gkfs::rpc::tag::fs_config;
95 :
96 : // requires response?
97 : constexpr static const auto requires_response = true;
98 :
99 : // Mercury callback to serialize input arguments
100 : constexpr static const auto mercury_in_proc_cb =
101 : hermes::detail::hg_proc_void_t;
102 :
103 : // Mercury callback to serialize output arguments
104 : constexpr static const auto mercury_out_proc_cb =
105 : HG_GEN_PROC_NAME(rpc_config_out_t);
106 :
107 : class input {
108 :
109 : template <typename ExecutionContext>
110 : friend hg_return_t
111 : hermes::detail::post_to_mercury(ExecutionContext*);
112 :
113 : public:
114 248 : input() {}
115 :
116 : input(input&& rhs) = default;
117 :
118 : input(const input& other) = default;
119 :
120 : input&
121 : operator=(input&& rhs) = default;
122 :
123 : input&
124 : operator=(const input& other) = default;
125 :
126 0 : explicit input(const hermes::detail::hg_void_t& other) {}
127 :
128 248 : explicit operator hermes::detail::hg_void_t() {
129 248 : return {};
130 : }
131 : };
132 :
133 1240 : class output {
134 :
135 : template <typename ExecutionContext>
136 : friend hg_return_t
137 : hermes::detail::post_to_mercury(ExecutionContext*);
138 :
139 : public:
140 248 : output()
141 248 : : m_mountdir(), m_rootdir(), m_atime_state(), m_mtime_state(),
142 : m_ctime_state(), m_link_cnt_state(), m_blocks_state(), m_uid(),
143 248 : m_gid() {}
144 :
145 : output(const std::string& mountdir, const std::string& rootdir,
146 : bool atime_state, bool mtime_state, bool ctime_state,
147 : bool link_cnt_state, bool blocks_state, uint32_t uid,
148 : uint32_t gid)
149 : : m_mountdir(mountdir), m_rootdir(rootdir),
150 : m_atime_state(atime_state), m_mtime_state(mtime_state),
151 : m_ctime_state(ctime_state), m_link_cnt_state(link_cnt_state),
152 : m_blocks_state(blocks_state), m_uid(uid), m_gid(gid) {}
153 :
154 1488 : output(output&& rhs) = default;
155 :
156 : output(const output& other) = default;
157 :
158 : output&
159 : operator=(output&& rhs) = default;
160 :
161 : output&
162 248 : operator=(const output& other) = default;
163 :
164 248 : explicit output(const rpc_config_out_t& out) {
165 :
166 248 : if(out.mountdir != nullptr) {
167 248 : m_mountdir = out.mountdir;
168 : }
169 :
170 248 : if(out.rootdir != nullptr) {
171 248 : m_rootdir = out.rootdir;
172 : }
173 :
174 248 : m_atime_state = out.atime_state;
175 248 : m_mtime_state = out.mtime_state;
176 248 : m_ctime_state = out.ctime_state;
177 248 : m_link_cnt_state = out.link_cnt_state;
178 248 : m_blocks_state = out.blocks_state;
179 248 : m_uid = out.uid;
180 248 : m_gid = out.gid;
181 248 : }
182 :
183 : std::string
184 496 : mountdir() const {
185 496 : return m_mountdir;
186 : }
187 :
188 : std::string
189 248 : rootdir() const {
190 248 : return m_rootdir;
191 : }
192 :
193 : bool
194 248 : atime_state() const {
195 248 : return m_atime_state;
196 : }
197 :
198 : bool
199 248 : mtime_state() const {
200 248 : return m_mtime_state;
201 : }
202 :
203 : bool
204 248 : ctime_state() const {
205 248 : return m_ctime_state;
206 : }
207 :
208 : bool
209 248 : link_cnt_state() const {
210 248 : return m_link_cnt_state;
211 : }
212 :
213 : bool
214 248 : blocks_state() const {
215 248 : return m_blocks_state;
216 : }
217 :
218 : uint32_t
219 248 : uid() const {
220 248 : return m_uid;
221 : }
222 :
223 : uint32_t
224 248 : gid() const {
225 248 : return m_gid;
226 : }
227 :
228 : private:
229 : std::string m_mountdir;
230 : std::string m_rootdir;
231 : bool m_atime_state;
232 : bool m_mtime_state;
233 : bool m_ctime_state;
234 : bool m_link_cnt_state;
235 : bool m_blocks_state;
236 : uint32_t m_uid;
237 : uint32_t m_gid;
238 : };
239 : };
240 :
241 :
242 : //==============================================================================
243 : // definitions for create
244 : struct create {
245 :
246 : // forward declarations of public input/output types for this RPC
247 : class input;
248 :
249 : class output;
250 :
251 : // traits used so that the engine knows what to do with the RPC
252 : using self_type = create;
253 : using handle_type = hermes::rpc_handle<self_type>;
254 : using input_type = input;
255 : using output_type = output;
256 : using mercury_input_type = rpc_mk_node_in_t;
257 : using mercury_output_type = rpc_err_out_t;
258 :
259 : // RPC public identifier
260 : // (N.B: we reuse the same IDs assigned by Margo so that the daemon
261 : // understands Hermes RPCs)
262 : constexpr static const uint64_t public_id = 796590080;
263 :
264 : // RPC internal Mercury identifier
265 : constexpr static const hg_id_t mercury_id = public_id;
266 :
267 : // RPC name
268 : constexpr static const auto name = gkfs::rpc::tag::create;
269 :
270 : // requires response?
271 : constexpr static const auto requires_response = true;
272 :
273 : // Mercury callback to serialize input arguments
274 : constexpr static const auto mercury_in_proc_cb =
275 : HG_GEN_PROC_NAME(rpc_mk_node_in_t);
276 :
277 : // Mercury callback to serialize output arguments
278 : constexpr static const auto mercury_out_proc_cb =
279 : HG_GEN_PROC_NAME(rpc_err_out_t);
280 :
281 1067 : class input {
282 :
283 : template <typename ExecutionContext>
284 : friend hg_return_t
285 : hermes::detail::post_to_mercury(ExecutionContext*);
286 :
287 : public:
288 1067 : input(const std::string& path, uint32_t mode)
289 1067 : : m_path(path), m_mode(mode) {}
290 :
291 2134 : input(input&& rhs) = default;
292 :
293 : input(const input& other) = default;
294 :
295 : input&
296 : operator=(input&& rhs) = default;
297 :
298 : input&
299 : operator=(const input& other) = default;
300 :
301 : std::string
302 : path() const {
303 : return m_path;
304 : }
305 :
306 : uint32_t
307 : mode() const {
308 : return m_mode;
309 : }
310 :
311 0 : explicit input(const rpc_mk_node_in_t& other)
312 0 : : m_path(other.path), m_mode(other.mode) {}
313 :
314 1067 : explicit operator rpc_mk_node_in_t() {
315 1067 : return {m_path.c_str(), m_mode};
316 : }
317 :
318 : private:
319 : std::string m_path;
320 : uint32_t m_mode;
321 : };
322 :
323 : class output {
324 :
325 : template <typename ExecutionContext>
326 : friend hg_return_t
327 : hermes::detail::post_to_mercury(ExecutionContext*);
328 :
329 : public:
330 : output() : m_err() {}
331 :
332 : output(int32_t err) : m_err(err) {}
333 :
334 : output(output&& rhs) = default;
335 :
336 : output(const output& other) = default;
337 :
338 : output&
339 : operator=(output&& rhs) = default;
340 :
341 : output&
342 : operator=(const output& other) = default;
343 :
344 1067 : explicit output(const rpc_err_out_t& out) {
345 1067 : m_err = out.err;
346 : }
347 :
348 : int32_t
349 2127 : err() const {
350 2124 : return m_err;
351 : }
352 :
353 : private:
354 : int32_t m_err;
355 : };
356 : };
357 :
358 : //==============================================================================
359 : // definitions for stat
360 : struct stat {
361 :
362 : // forward declarations of public input/output types for this RPC
363 : class input;
364 :
365 : class output;
366 :
367 : // traits used so that the engine knows what to do with the RPC
368 : using self_type = stat;
369 : using handle_type = hermes::rpc_handle<self_type>;
370 : using input_type = input;
371 : using output_type = output;
372 : using mercury_input_type = rpc_path_only_in_t;
373 : using mercury_output_type = rpc_stat_out_t;
374 :
375 : // RPC public identifier
376 : // (N.B: we reuse the same IDs assigned by Margo so that the daemon
377 : // understands Hermes RPCs)
378 : constexpr static const uint64_t public_id = 1396244480;
379 :
380 : // RPC internal Mercury identifier
381 : constexpr static const hg_id_t mercury_id = public_id;
382 :
383 : // RPC name
384 : constexpr static const auto name = gkfs::rpc::tag::stat;
385 :
386 : // requires response?
387 : constexpr static const auto requires_response = true;
388 :
389 : // Mercury callback to serialize input arguments
390 : constexpr static const auto mercury_in_proc_cb =
391 : HG_GEN_PROC_NAME(rpc_path_only_in_t);
392 :
393 : // Mercury callback to serialize output arguments
394 : constexpr static const auto mercury_out_proc_cb =
395 : HG_GEN_PROC_NAME(rpc_stat_out_t);
396 :
397 1359 : class input {
398 :
399 : template <typename ExecutionContext>
400 : friend hg_return_t
401 : hermes::detail::post_to_mercury(ExecutionContext*);
402 :
403 : public:
404 1359 : input(const std::string& path) : m_path(path) {}
405 :
406 2718 : input(input&& rhs) = default;
407 :
408 : input(const input& other) = default;
409 :
410 : input&
411 : operator=(input&& rhs) = default;
412 :
413 : input&
414 : operator=(const input& other) = default;
415 :
416 : std::string
417 : path() const {
418 : return m_path;
419 : }
420 :
421 0 : explicit input(const rpc_path_only_in_t& other) : m_path(other.path) {}
422 :
423 1359 : explicit operator rpc_path_only_in_t() {
424 1359 : return {m_path.c_str()};
425 : }
426 :
427 : private:
428 : std::string m_path;
429 : };
430 :
431 6795 : class output {
432 :
433 : template <typename ExecutionContext>
434 : friend hg_return_t
435 : hermes::detail::post_to_mercury(ExecutionContext*);
436 :
437 : public:
438 : output() : m_err(), m_db_val() {}
439 :
440 : output(int32_t err, const std::string& db_val)
441 : : m_err(err), m_db_val(db_val) {}
442 :
443 6795 : output(output&& rhs) = default;
444 :
445 1359 : output(const output& other) = default;
446 :
447 : output&
448 : operator=(output&& rhs) = default;
449 :
450 : output&
451 : operator=(const output& other) = default;
452 :
453 1359 : explicit output(const rpc_stat_out_t& out) {
454 1359 : m_err = out.err;
455 :
456 1359 : if(out.db_val != nullptr) {
457 1335 : m_db_val = out.db_val;
458 : }
459 1359 : }
460 :
461 : int32_t
462 2742 : err() const {
463 2718 : return m_err;
464 : }
465 :
466 : std::string
467 1335 : db_val() const {
468 1335 : return m_db_val;
469 : }
470 :
471 : private:
472 : int32_t m_err;
473 : std::string m_db_val;
474 : };
475 : };
476 :
477 : //==============================================================================
478 : // definitions for remove metadata
479 : struct remove_metadata {
480 :
481 : // forward declarations of public input/output types for this RPC
482 : class input;
483 :
484 : class output;
485 :
486 : // traits used so that the engine knows what to do with the RPC
487 : using self_type = remove_metadata;
488 : using handle_type = hermes::rpc_handle<self_type>;
489 : using input_type = input;
490 : using output_type = output;
491 : using mercury_input_type = rpc_rm_node_in_t;
492 : using mercury_output_type = rpc_rm_metadata_out_t;
493 :
494 : // RPC public identifier
495 : // (N.B: we reuse the same IDs assigned by Margo so that the daemon
496 : // understands Hermes RPCs)
497 : constexpr static const uint64_t public_id = 2087845888;
498 :
499 : // RPC internal Mercury identifier
500 : constexpr static const hg_id_t mercury_id = public_id;
501 :
502 : // RPC name
503 : constexpr static const auto name = gkfs::rpc::tag::remove_metadata;
504 :
505 : // requires response?
506 : constexpr static const auto requires_response = true;
507 :
508 : // Mercury callback to serialize input arguments
509 : constexpr static const auto mercury_in_proc_cb =
510 : HG_GEN_PROC_NAME(rpc_rm_node_in_t);
511 :
512 : // Mercury callback to serialize output arguments
513 : constexpr static const auto mercury_out_proc_cb =
514 : HG_GEN_PROC_NAME(rpc_rm_metadata_out_t);
515 :
516 8 : class input {
517 :
518 : template <typename ExecutionContext>
519 : friend hg_return_t
520 : hermes::detail::post_to_mercury(ExecutionContext*);
521 :
522 : public:
523 8 : input(const std::string& path) : m_path(path) {}
524 :
525 16 : input(input&& rhs) = default;
526 :
527 : input(const input& other) = default;
528 :
529 : input&
530 : operator=(input&& rhs) = default;
531 :
532 : input&
533 : operator=(const input& other) = default;
534 :
535 : std::string
536 : path() const {
537 : return m_path;
538 : }
539 :
540 0 : explicit input(const rpc_rm_node_in_t& other) : m_path(other.path) {}
541 :
542 8 : explicit operator rpc_rm_node_in_t() {
543 8 : return {m_path.c_str()};
544 : }
545 :
546 : private:
547 : std::string m_path;
548 : };
549 :
550 : class output {
551 :
552 : template <typename ExecutionContext>
553 : friend hg_return_t
554 : hermes::detail::post_to_mercury(ExecutionContext*);
555 :
556 : public:
557 : output() : m_err(), m_size(), m_mode() {}
558 :
559 : output(int32_t err, int64_t size, uint32_t mode)
560 : : m_err(err), m_size(size), m_mode(mode) {}
561 :
562 : output(output&& rhs) = default;
563 :
564 : output(const output& other) = default;
565 :
566 : output&
567 : operator=(output&& rhs) = default;
568 :
569 : output&
570 : operator=(const output& other) = default;
571 :
572 8 : explicit output(const rpc_rm_metadata_out_t& out) {
573 8 : m_err = out.err;
574 8 : m_size = out.size;
575 8 : m_mode = out.mode;
576 : }
577 :
578 : int32_t
579 16 : err() const {
580 16 : return m_err;
581 : }
582 :
583 : int64_t
584 8 : size() const {
585 8 : return m_size;
586 : }
587 :
588 : uint32_t
589 8 : mode() const {
590 8 : return m_mode;
591 : };
592 :
593 :
594 : private:
595 : int32_t m_err;
596 : int64_t m_size;
597 : uint32_t m_mode;
598 : };
599 : };
600 :
601 : //==============================================================================
602 : // definitions for decr_size
603 : struct decr_size {
604 :
605 : // forward declarations of public input/output types for this RPC
606 : class input;
607 :
608 : class output;
609 :
610 : // traits used so that the engine knows what to do with the RPC
611 : using self_type = decr_size;
612 : using handle_type = hermes::rpc_handle<self_type>;
613 : using input_type = input;
614 : using output_type = output;
615 : using mercury_input_type = rpc_trunc_in_t;
616 : using mercury_output_type = rpc_err_out_t;
617 :
618 : // RPC public identifier
619 : // (N.B: we reuse the same IDs assigned by Margo so that the daemon
620 : // understands Hermes RPCs)
621 : constexpr static const uint64_t public_id = 1291649024;
622 :
623 : // RPC internal Mercury identifier
624 : constexpr static const hg_id_t mercury_id = public_id;
625 :
626 : // RPC name
627 : constexpr static const auto name = gkfs::rpc::tag::decr_size;
628 :
629 : // requires response?
630 : constexpr static const auto requires_response = true;
631 :
632 : // Mercury callback to serialize input arguments
633 : constexpr static const auto mercury_in_proc_cb =
634 : HG_GEN_PROC_NAME(rpc_trunc_in_t);
635 :
636 : // Mercury callback to serialize output arguments
637 : constexpr static const auto mercury_out_proc_cb =
638 : HG_GEN_PROC_NAME(rpc_err_out_t);
639 :
640 3 : class input {
641 :
642 : template <typename ExecutionContext>
643 : friend hg_return_t
644 : hermes::detail::post_to_mercury(ExecutionContext*);
645 :
646 : public:
647 3 : input(const std::string& path, uint64_t length)
648 3 : : m_path(path), m_length(length) {}
649 :
650 6 : input(input&& rhs) = default;
651 :
652 : input(const input& other) = default;
653 :
654 : input&
655 : operator=(input&& rhs) = default;
656 :
657 : input&
658 : operator=(const input& other) = default;
659 :
660 : std::string
661 : path() const {
662 : return m_path;
663 : }
664 :
665 : uint64_t
666 : length() const {
667 : return m_length;
668 : }
669 :
670 0 : explicit input(const rpc_trunc_in_t& other)
671 0 : : m_path(other.path), m_length(other.length) {}
672 :
673 3 : explicit operator rpc_trunc_in_t() {
674 3 : return {m_path.c_str(), m_length};
675 : }
676 :
677 : private:
678 : std::string m_path;
679 : uint64_t m_length;
680 : };
681 :
682 : class output {
683 :
684 : template <typename ExecutionContext>
685 : friend hg_return_t
686 : hermes::detail::post_to_mercury(ExecutionContext*);
687 :
688 : public:
689 : output() : m_err() {}
690 :
691 : output(int32_t err) : m_err(err) {}
692 :
693 : output(output&& rhs) = default;
694 :
695 : output(const output& other) = default;
696 :
697 : output&
698 : operator=(output&& rhs) = default;
699 :
700 : output&
701 : operator=(const output& other) = default;
702 :
703 3 : explicit output(const rpc_err_out_t& out) {
704 3 : m_err = out.err;
705 : }
706 :
707 : int32_t
708 6 : err() const {
709 6 : return m_err;
710 : }
711 :
712 : private:
713 : int32_t m_err;
714 : };
715 : };
716 :
717 : //==============================================================================
718 : // definitions for update_metadentry
719 : struct update_metadentry {
720 :
721 : // forward declarations of public input/output types for this RPC
722 : class input;
723 :
724 : class output;
725 :
726 : // traits used so that the engine knows what to do with the RPC
727 : using self_type = update_metadentry;
728 : using handle_type = hermes::rpc_handle<self_type>;
729 : using input_type = input;
730 : using output_type = output;
731 : using mercury_input_type = rpc_update_metadentry_in_t;
732 : using mercury_output_type = rpc_err_out_t;
733 :
734 : // RPC public identifier
735 : // (N.B: we reuse the same IDs assigned by Margo so that the daemon
736 : // understands Hermes RPCs)
737 : constexpr static const uint64_t public_id = 99483648;
738 :
739 : // RPC internal Mercury identifier
740 : constexpr static const hg_id_t mercury_id = public_id;
741 :
742 : // RPC name
743 : constexpr static const auto name = gkfs::rpc::tag::update_metadentry;
744 :
745 : // requires response?
746 : constexpr static const auto requires_response = true;
747 :
748 : // Mercury callback to serialize input arguments
749 : constexpr static const auto mercury_in_proc_cb =
750 : HG_GEN_PROC_NAME(rpc_update_metadentry_in_t);
751 :
752 : // Mercury callback to serialize output arguments
753 : constexpr static const auto mercury_out_proc_cb =
754 : HG_GEN_PROC_NAME(rpc_err_out_t);
755 :
756 11 : class input {
757 :
758 : template <typename ExecutionContext>
759 : friend hg_return_t
760 : hermes::detail::post_to_mercury(ExecutionContext*);
761 :
762 : public:
763 11 : input(const std::string& path, uint64_t nlink, uint32_t mode,
764 : uint32_t uid, uint32_t gid, int64_t size, int64_t blocks,
765 : int64_t atime, int64_t mtime, int64_t ctime, bool nlink_flag,
766 : bool mode_flag, bool size_flag, bool block_flag, bool atime_flag,
767 : bool mtime_flag, bool ctime_flag)
768 11 : : m_path(path), m_nlink(nlink), m_mode(mode), m_uid(uid),
769 : m_gid(gid), m_size(size), m_blocks(blocks), m_atime(atime),
770 : m_mtime(mtime), m_ctime(ctime), m_nlink_flag(nlink_flag),
771 : m_mode_flag(mode_flag), m_size_flag(size_flag),
772 : m_block_flag(block_flag), m_atime_flag(atime_flag),
773 11 : m_mtime_flag(mtime_flag), m_ctime_flag(ctime_flag) {}
774 :
775 11 : input(input&& rhs) = default;
776 :
777 : input(const input& other) = default;
778 :
779 : input&
780 : operator=(input&& rhs) = default;
781 :
782 : input&
783 : operator=(const input& other) = default;
784 :
785 : std::string
786 : path() const {
787 : return m_path;
788 : }
789 :
790 : uint64_t
791 : nlink() const {
792 : return m_nlink;
793 : }
794 :
795 : uint32_t
796 : mode() const {
797 : return m_mode;
798 : }
799 :
800 : uint32_t
801 : uid() const {
802 : return m_uid;
803 : }
804 :
805 : uint32_t
806 : gid() const {
807 : return m_gid;
808 : }
809 :
810 : int64_t
811 : size() const {
812 : return m_size;
813 : }
814 :
815 : int64_t
816 : blocks() const {
817 : return m_blocks;
818 : }
819 :
820 : int64_t
821 : atime() const {
822 : return m_atime;
823 : }
824 :
825 : int64_t
826 : mtime() const {
827 : return m_mtime;
828 : }
829 :
830 : int64_t
831 : ctime() const {
832 : return m_ctime;
833 : }
834 :
835 : bool
836 : nlink_flag() const {
837 : return m_nlink_flag;
838 : }
839 :
840 : bool
841 : mode_flag() const {
842 : return m_mode_flag;
843 : }
844 :
845 : bool
846 : size_flag() const {
847 : return m_size_flag;
848 : }
849 :
850 : bool
851 : block_flag() const {
852 : return m_block_flag;
853 : }
854 :
855 : bool
856 : atime_flag() const {
857 : return m_atime_flag;
858 : }
859 :
860 : bool
861 : mtime_flag() const {
862 : return m_mtime_flag;
863 : }
864 :
865 : bool
866 : ctime_flag() const {
867 : return m_ctime_flag;
868 : }
869 :
870 0 : explicit input(const rpc_update_metadentry_in_t& other)
871 0 : : m_path(other.path), m_nlink(other.nlink), m_mode(other.mode),
872 0 : m_uid(other.uid), m_gid(other.gid), m_size(other.size),
873 0 : m_blocks(other.blocks), m_atime(other.atime),
874 0 : m_mtime(other.mtime), m_ctime(other.ctime),
875 0 : m_nlink_flag(other.nlink_flag), m_mode_flag(other.mode_flag),
876 0 : m_size_flag(other.size_flag), m_block_flag(other.block_flag),
877 0 : m_atime_flag(other.atime_flag), m_mtime_flag(other.mtime_flag),
878 0 : m_ctime_flag(other.ctime_flag) {}
879 :
880 11 : explicit operator rpc_update_metadentry_in_t() {
881 11 : return {m_path.c_str(), m_nlink, m_mode, m_uid,
882 11 : m_gid, m_size, m_blocks, m_atime,
883 11 : m_mtime, m_ctime, m_nlink_flag, m_mode_flag,
884 11 : m_size_flag, m_block_flag, m_atime_flag, m_mtime_flag,
885 11 : m_ctime_flag};
886 : }
887 :
888 : private:
889 : std::string m_path;
890 : uint64_t m_nlink;
891 : uint32_t m_mode;
892 : uint32_t m_uid;
893 : uint32_t m_gid;
894 : int64_t m_size;
895 : int64_t m_blocks;
896 : int64_t m_atime;
897 : int64_t m_mtime;
898 : int64_t m_ctime;
899 : bool m_nlink_flag;
900 : bool m_mode_flag;
901 : bool m_size_flag;
902 : bool m_block_flag;
903 : bool m_atime_flag;
904 : bool m_mtime_flag;
905 : bool m_ctime_flag;
906 : };
907 :
908 : class output {
909 :
910 : template <typename ExecutionContext>
911 : friend hg_return_t
912 : hermes::detail::post_to_mercury(ExecutionContext*);
913 :
914 : public:
915 : output() : m_err() {}
916 :
917 : output(int32_t err) : m_err(err) {}
918 :
919 : output(output&& rhs) = default;
920 :
921 : output(const output& other) = default;
922 :
923 : output&
924 : operator=(output&& rhs) = default;
925 :
926 : output&
927 : operator=(const output& other) = default;
928 :
929 11 : explicit output(const rpc_err_out_t& out) {
930 11 : m_err = out.err;
931 : }
932 :
933 : int32_t
934 12 : err() const {
935 12 : return m_err;
936 : }
937 :
938 : private:
939 : int32_t m_err;
940 : };
941 : };
942 :
943 : //==============================================================================
944 : // definitions for get_metadentry_size
945 : struct get_metadentry_size {
946 :
947 : // forward declarations of public input/output types for this RPC
948 : class input;
949 :
950 : class output;
951 :
952 : // traits used so that the engine knows what to do with the RPC
953 : using self_type = get_metadentry_size;
954 : using handle_type = hermes::rpc_handle<self_type>;
955 : using input_type = input;
956 : using output_type = output;
957 : using mercury_input_type = rpc_path_only_in_t;
958 : using mercury_output_type = rpc_get_metadentry_size_out_t;
959 :
960 : // RPC public identifier
961 : // (N.B: we reuse the same IDs assigned by Margo so that the daemon
962 : // understands Hermes RPCs)
963 : constexpr static const uint64_t public_id = 3426484224;
964 :
965 : // RPC internal Mercury identifier
966 : constexpr static const hg_id_t mercury_id = public_id;
967 :
968 : // RPC name
969 : constexpr static const auto name = gkfs::rpc::tag::get_metadentry_size;
970 :
971 : // requires response?
972 : constexpr static const auto requires_response = true;
973 :
974 : // Mercury callback to serialize input arguments
975 : constexpr static const auto mercury_in_proc_cb =
976 : HG_GEN_PROC_NAME(rpc_path_only_in_t);
977 :
978 : // Mercury callback to serialize output arguments
979 : constexpr static const auto mercury_out_proc_cb =
980 : HG_GEN_PROC_NAME(rpc_get_metadentry_size_out_t);
981 :
982 5 : class input {
983 :
984 : template <typename ExecutionContext>
985 : friend hg_return_t
986 : hermes::detail::post_to_mercury(ExecutionContext*);
987 :
988 : public:
989 5 : input(const std::string& path) : m_path(path) {}
990 :
991 10 : input(input&& rhs) = default;
992 :
993 : input(const input& other) = default;
994 :
995 : input&
996 : operator=(input&& rhs) = default;
997 :
998 : input&
999 : operator=(const input& other) = default;
1000 :
1001 : std::string
1002 : path() const {
1003 : return m_path;
1004 : }
1005 :
1006 0 : explicit input(const rpc_path_only_in_t& other) : m_path(other.path) {}
1007 :
1008 5 : explicit operator rpc_path_only_in_t() {
1009 5 : return {m_path.c_str()};
1010 : }
1011 :
1012 : private:
1013 : std::string m_path;
1014 : };
1015 :
1016 : class output {
1017 :
1018 : template <typename ExecutionContext>
1019 : friend hg_return_t
1020 : hermes::detail::post_to_mercury(ExecutionContext*);
1021 :
1022 : public:
1023 : output() : m_err(), m_ret_size() {}
1024 :
1025 : output(int32_t err, int64_t ret_size)
1026 : : m_err(err), m_ret_size(ret_size) {}
1027 :
1028 : output(output&& rhs) = default;
1029 :
1030 : output(const output& other) = default;
1031 :
1032 : output&
1033 : operator=(output&& rhs) = default;
1034 :
1035 : output&
1036 : operator=(const output& other) = default;
1037 :
1038 5 : explicit output(const rpc_get_metadentry_size_out_t& out) {
1039 5 : m_err = out.err;
1040 5 : m_ret_size = out.ret_size;
1041 : }
1042 :
1043 : int32_t
1044 10 : err() const {
1045 10 : return m_err;
1046 : }
1047 :
1048 : int64_t
1049 5 : ret_size() const {
1050 5 : return m_ret_size;
1051 : }
1052 :
1053 : private:
1054 : int32_t m_err;
1055 : int64_t m_ret_size;
1056 : };
1057 : };
1058 :
1059 : //==============================================================================
1060 : // definitions for update_metadentry_size
1061 : struct update_metadentry_size {
1062 :
1063 : // forward declarations of public input/output types for this RPC
1064 : class input;
1065 :
1066 : class output;
1067 :
1068 : // traits used so that the engine knows what to do with the RPC
1069 : using self_type = update_metadentry_size;
1070 : using handle_type = hermes::rpc_handle<self_type>;
1071 : using input_type = input;
1072 : using output_type = output;
1073 : using mercury_input_type = rpc_update_metadentry_size_in_t;
1074 : using mercury_output_type = rpc_update_metadentry_size_out_t;
1075 :
1076 : // RPC public identifier
1077 : // (N.B: we reuse the same IDs assigned by Margo so that the daemon
1078 : // understands Hermes RPCs)
1079 : constexpr static const uint64_t public_id = 2760900608;
1080 :
1081 : // RPC internal Mercury identifier
1082 : constexpr static const hg_id_t mercury_id = public_id;
1083 :
1084 : // RPC name
1085 : constexpr static const auto name = gkfs::rpc::tag::update_metadentry_size;
1086 :
1087 : // requires response?
1088 : constexpr static const auto requires_response = true;
1089 :
1090 : // Mercury callback to serialize input arguments
1091 : constexpr static const auto mercury_in_proc_cb =
1092 : HG_GEN_PROC_NAME(rpc_update_metadentry_size_in_t);
1093 :
1094 : // Mercury callback to serialize output arguments
1095 : constexpr static const auto mercury_out_proc_cb =
1096 : HG_GEN_PROC_NAME(rpc_update_metadentry_size_out_t);
1097 :
1098 41 : class input {
1099 :
1100 : template <typename ExecutionContext>
1101 : friend hg_return_t
1102 : hermes::detail::post_to_mercury(ExecutionContext*);
1103 :
1104 : public:
1105 41 : input(const std::string& path, uint64_t size, int64_t offset,
1106 : bool append)
1107 41 : : m_path(path), m_size(size), m_offset(offset), m_append(append) {}
1108 :
1109 41 : input(input&& rhs) = default;
1110 :
1111 : input(const input& other) = default;
1112 :
1113 : input&
1114 : operator=(input&& rhs) = default;
1115 :
1116 : input&
1117 : operator=(const input& other) = default;
1118 :
1119 : std::string
1120 : path() const {
1121 : return m_path;
1122 : }
1123 :
1124 : uint64_t
1125 : size() const {
1126 : return m_size;
1127 : }
1128 :
1129 : int64_t
1130 : offset() const {
1131 : return m_offset;
1132 : }
1133 :
1134 : bool
1135 : append() const {
1136 : return m_append;
1137 : }
1138 :
1139 0 : explicit input(const rpc_update_metadentry_size_in_t& other)
1140 0 : : m_path(other.path), m_size(other.size), m_offset(other.offset),
1141 0 : m_append(other.append) {}
1142 :
1143 41 : explicit operator rpc_update_metadentry_size_in_t() {
1144 41 : return {m_path.c_str(), m_size, m_offset, m_append};
1145 : }
1146 :
1147 : private:
1148 : std::string m_path;
1149 : uint64_t m_size;
1150 : int64_t m_offset;
1151 : bool m_append;
1152 : };
1153 :
1154 : class output {
1155 :
1156 : template <typename ExecutionContext>
1157 : friend hg_return_t
1158 : hermes::detail::post_to_mercury(ExecutionContext*);
1159 :
1160 : public:
1161 : output() : m_err(), m_ret_offset() {}
1162 :
1163 : output(int32_t err, int64_t ret_size)
1164 : : m_err(err), m_ret_offset(ret_size) {}
1165 :
1166 : output(output&& rhs) = default;
1167 :
1168 : output(const output& other) = default;
1169 :
1170 : output&
1171 : operator=(output&& rhs) = default;
1172 :
1173 : output&
1174 : operator=(const output& other) = default;
1175 :
1176 41 : explicit output(const rpc_update_metadentry_size_out_t& out) {
1177 41 : m_err = out.err;
1178 41 : m_ret_offset = out.ret_offset;
1179 : }
1180 :
1181 : int32_t
1182 41 : err() const {
1183 41 : return m_err;
1184 : }
1185 :
1186 : int64_t
1187 41 : ret_size() const {
1188 41 : return m_ret_offset;
1189 : }
1190 :
1191 : private:
1192 : int32_t m_err;
1193 : int64_t m_ret_offset;
1194 : };
1195 : };
1196 :
1197 : #ifdef HAS_SYMLINKS
1198 :
1199 : //==============================================================================
1200 : // definitions for mk_symlink
1201 : struct mk_symlink {
1202 :
1203 : // forward declarations of public input/output types for this RPC
1204 : class input;
1205 :
1206 : class output;
1207 :
1208 : // traits used so that the engine knows what to do with the RPC
1209 : using self_type = mk_symlink;
1210 : using handle_type = hermes::rpc_handle<self_type>;
1211 : using input_type = input;
1212 : using output_type = output;
1213 : using mercury_input_type = rpc_mk_symlink_in_t;
1214 : using mercury_output_type = rpc_err_out_t;
1215 :
1216 : // RPC public identifier
1217 : // (N.B: we reuse the same IDs assigned by Margo so that the daemon
1218 : // understands Hermes RPCs)
1219 : constexpr static const uint64_t public_id = 3207004160;
1220 :
1221 : // RPC internal Mercury identifier
1222 : constexpr static const hg_id_t mercury_id = public_id;
1223 :
1224 : // RPC name
1225 : constexpr static const auto name = gkfs::rpc::tag::mk_symlink;
1226 :
1227 : // requires response?
1228 : constexpr static const auto requires_response = true;
1229 :
1230 : // Mercury callback to serialize input arguments
1231 : constexpr static const auto mercury_in_proc_cb =
1232 : HG_GEN_PROC_NAME(rpc_mk_symlink_in_t);
1233 :
1234 : // Mercury callback to serialize output arguments
1235 : constexpr static const auto mercury_out_proc_cb =
1236 : HG_GEN_PROC_NAME(rpc_err_out_t);
1237 :
1238 20 : class input {
1239 :
1240 : template <typename ExecutionContext>
1241 : friend hg_return_t
1242 : hermes::detail::post_to_mercury(ExecutionContext*);
1243 :
1244 : public:
1245 20 : input(const std::string& path, const std::string& target_path)
1246 20 : : m_path(path), m_target_path(target_path) {}
1247 :
1248 40 : input(input&& rhs) = default;
1249 :
1250 : input(const input& other) = default;
1251 :
1252 : input&
1253 : operator=(input&& rhs) = default;
1254 :
1255 : input&
1256 : operator=(const input& other) = default;
1257 :
1258 : std::string
1259 : path() const {
1260 : return m_path;
1261 : }
1262 :
1263 : std::string
1264 : target_path() const {
1265 : return m_target_path;
1266 : }
1267 :
1268 0 : explicit input(const rpc_mk_symlink_in_t& other)
1269 0 : : m_path(other.path), m_target_path(other.target_path) {}
1270 :
1271 20 : explicit operator rpc_mk_symlink_in_t() {
1272 20 : return {m_path.c_str(), m_target_path.c_str()};
1273 : }
1274 :
1275 : private:
1276 : std::string m_path;
1277 : std::string m_target_path;
1278 : };
1279 :
1280 : class output {
1281 :
1282 : template <typename ExecutionContext>
1283 : friend hg_return_t
1284 : hermes::detail::post_to_mercury(ExecutionContext*);
1285 :
1286 : public:
1287 : output() : m_err() {}
1288 :
1289 : output(int32_t err) : m_err(err) {}
1290 :
1291 : output(output&& rhs) = default;
1292 :
1293 : output(const output& other) = default;
1294 :
1295 : output&
1296 : operator=(output&& rhs) = default;
1297 :
1298 : output&
1299 : operator=(const output& other) = default;
1300 :
1301 20 : explicit output(const rpc_err_out_t& out) {
1302 20 : m_err = out.err;
1303 : }
1304 :
1305 : int32_t
1306 20 : err() const {
1307 20 : return m_err;
1308 : }
1309 :
1310 : private:
1311 : int32_t m_err;
1312 : };
1313 : };
1314 :
1315 : #endif // HAS_SYMLINKS
1316 :
1317 : //==============================================================================
1318 : // definitions for remove data
1319 : struct remove_data {
1320 :
1321 : // forward declarations of public input/output types for this RPC
1322 : class input;
1323 :
1324 : class output;
1325 :
1326 : // traits used so that the engine knows what to do with the RPC
1327 : using self_type = remove_data;
1328 : using handle_type = hermes::rpc_handle<self_type>;
1329 : using input_type = input;
1330 : using output_type = output;
1331 : using mercury_input_type = rpc_rm_node_in_t;
1332 : using mercury_output_type = rpc_err_out_t;
1333 :
1334 : // RPC public identifier
1335 : // (N.B: we reuse the same IDs assigned by Margo so that the daemon
1336 : // understands Hermes RPCs)
1337 : constexpr static const uint64_t public_id = 2649292800;
1338 :
1339 : // RPC internal Mercury identifier
1340 : constexpr static const hg_id_t mercury_id = public_id;
1341 :
1342 : // RPC name
1343 : constexpr static const auto name = gkfs::rpc::tag::remove_data;
1344 :
1345 : // requires response?
1346 : constexpr static const auto requires_response = true;
1347 :
1348 : // Mercury callback to serialize input arguments
1349 : constexpr static const auto mercury_in_proc_cb =
1350 : HG_GEN_PROC_NAME(rpc_rm_node_in_t);
1351 :
1352 : // Mercury callback to serialize output arguments
1353 : constexpr static const auto mercury_out_proc_cb =
1354 : HG_GEN_PROC_NAME(rpc_err_out_t);
1355 :
1356 6 : class input {
1357 :
1358 : template <typename ExecutionContext>
1359 : friend hg_return_t
1360 : hermes::detail::post_to_mercury(ExecutionContext*);
1361 :
1362 : public:
1363 3 : input(const std::string& path) : m_path(path) {}
1364 :
1365 6 : input(input&& rhs) = default;
1366 :
1367 3 : input(const input& other) = default;
1368 :
1369 : input&
1370 : operator=(input&& rhs) = default;
1371 :
1372 : input&
1373 : operator=(const input& other) = default;
1374 :
1375 : std::string
1376 : path() const {
1377 : return m_path;
1378 : }
1379 :
1380 0 : explicit input(const rpc_rm_node_in_t& other) : m_path(other.path) {}
1381 :
1382 3 : explicit operator rpc_rm_node_in_t() {
1383 3 : return {m_path.c_str()};
1384 : }
1385 :
1386 : private:
1387 : std::string m_path;
1388 : };
1389 :
1390 : class output {
1391 :
1392 : template <typename ExecutionContext>
1393 : friend hg_return_t
1394 : hermes::detail::post_to_mercury(ExecutionContext*);
1395 :
1396 : public:
1397 : output() : m_err() {}
1398 :
1399 : output(int32_t err) : m_err(err) {}
1400 :
1401 : output(output&& rhs) = default;
1402 :
1403 : output(const output& other) = default;
1404 :
1405 : output&
1406 : operator=(output&& rhs) = default;
1407 :
1408 : output&
1409 : operator=(const output& other) = default;
1410 :
1411 3 : explicit output(const rpc_err_out_t& out) {
1412 3 : m_err = out.err;
1413 : }
1414 :
1415 : int32_t
1416 3 : err() const {
1417 3 : return m_err;
1418 : }
1419 :
1420 : private:
1421 : int32_t m_err;
1422 : };
1423 : };
1424 :
1425 : //==============================================================================
1426 : // definitions for write_data
1427 : struct write_data {
1428 :
1429 : // forward declarations of public input/output types for this RPC
1430 : class input;
1431 :
1432 : class output;
1433 :
1434 : // traits used so that the engine knows what to do with the RPC
1435 : using self_type = write_data;
1436 : using handle_type = hermes::rpc_handle<self_type>;
1437 : using input_type = input;
1438 : using output_type = output;
1439 : using mercury_input_type = rpc_write_data_in_t;
1440 : using mercury_output_type = rpc_data_out_t;
1441 :
1442 : // RPC public identifier
1443 : // (N.B: we reuse the same IDs assigned by Margo so that the daemon
1444 : // understands Hermes RPCs)
1445 : constexpr static const uint64_t public_id = 3716481024;
1446 :
1447 : // RPC internal Mercury identifier
1448 : constexpr static const hg_id_t mercury_id = public_id;
1449 :
1450 : // RPC name
1451 : constexpr static const auto name = gkfs::rpc::tag::write;
1452 :
1453 : // requires response?
1454 : constexpr static const auto requires_response = true;
1455 :
1456 : // Mercury callback to serialize input arguments
1457 : constexpr static const auto mercury_in_proc_cb =
1458 : HG_GEN_PROC_NAME(rpc_write_data_in_t);
1459 :
1460 : // Mercury callback to serialize output arguments
1461 : constexpr static const auto mercury_out_proc_cb =
1462 : HG_GEN_PROC_NAME(rpc_data_out_t);
1463 :
1464 : class input {
1465 :
1466 : template <typename ExecutionContext>
1467 : friend hg_return_t
1468 : hermes::detail::post_to_mercury(ExecutionContext*);
1469 :
1470 : public:
1471 41 : input(const std::string& path, int64_t offset, uint64_t host_id,
1472 : uint64_t host_size, const std::string& wbitset, uint64_t chunk_n,
1473 : uint64_t chunk_start, uint64_t chunk_end,
1474 : uint64_t total_chunk_size, const hermes::exposed_memory& buffers)
1475 41 : : m_path(path), m_offset(offset), m_host_id(host_id),
1476 : m_host_size(host_size), m_wbitset(wbitset), m_chunk_n(chunk_n),
1477 : m_chunk_start(chunk_start), m_chunk_end(chunk_end),
1478 41 : m_total_chunk_size(total_chunk_size), m_buffers(buffers) {}
1479 :
1480 123 : input(input&& rhs) = default;
1481 :
1482 41 : input(const input& other) = default;
1483 :
1484 : input&
1485 : operator=(input&& rhs) = default;
1486 :
1487 : input&
1488 : operator=(const input& other) = default;
1489 :
1490 : std::string
1491 : path() const {
1492 : return m_path;
1493 : }
1494 :
1495 : int64_t
1496 41 : offset() const {
1497 41 : return m_offset;
1498 : }
1499 :
1500 : uint64_t
1501 : host_id() const {
1502 : return m_host_id;
1503 : }
1504 :
1505 : uint64_t
1506 : host_size() const {
1507 : return m_host_size;
1508 : }
1509 :
1510 : uint64_t
1511 41 : chunk_n() const {
1512 41 : return m_chunk_n;
1513 : }
1514 :
1515 : std::string
1516 : wbitset() const {
1517 : return m_wbitset;
1518 : }
1519 :
1520 : uint64_t
1521 : chunk_start() const {
1522 : return m_chunk_start;
1523 : }
1524 :
1525 : uint64_t
1526 : chunk_end() const {
1527 : return m_chunk_end;
1528 : }
1529 :
1530 : uint64_t
1531 : total_chunk_size() const {
1532 : return m_total_chunk_size;
1533 : }
1534 :
1535 : hermes::exposed_memory
1536 : buffers() const {
1537 : return m_buffers;
1538 : }
1539 :
1540 0 : explicit input(const rpc_write_data_in_t& other)
1541 0 : : m_path(other.path), m_offset(other.offset),
1542 0 : m_host_id(other.host_id), m_host_size(other.host_size),
1543 0 : m_wbitset(other.wbitset), m_chunk_n(other.chunk_n),
1544 0 : m_chunk_start(other.chunk_start), m_chunk_end(other.chunk_end),
1545 0 : m_total_chunk_size(other.total_chunk_size),
1546 0 : m_buffers(other.bulk_handle) {}
1547 :
1548 41 : explicit operator rpc_write_data_in_t() {
1549 41 : return {m_path.c_str(), m_offset, m_host_id,
1550 41 : m_host_size, m_wbitset.c_str(), m_chunk_n,
1551 41 : m_chunk_start, m_chunk_end, m_total_chunk_size,
1552 41 : hg_bulk_t(m_buffers)};
1553 : }
1554 :
1555 : private:
1556 : std::string m_path;
1557 : int64_t m_offset;
1558 : uint64_t m_host_id;
1559 : uint64_t m_host_size;
1560 : std::string m_wbitset;
1561 : uint64_t m_chunk_n;
1562 : uint64_t m_chunk_start;
1563 : uint64_t m_chunk_end;
1564 : uint64_t m_total_chunk_size;
1565 : hermes::exposed_memory m_buffers;
1566 : };
1567 :
1568 : class output {
1569 :
1570 : template <typename ExecutionContext>
1571 : friend hg_return_t
1572 : hermes::detail::post_to_mercury(ExecutionContext*);
1573 :
1574 : public:
1575 : output() : m_err(), m_io_size() {}
1576 :
1577 : output(int32_t err, size_t io_size) : m_err(err), m_io_size(io_size) {}
1578 :
1579 : output(output&& rhs) = default;
1580 :
1581 : output(const output& other) = default;
1582 :
1583 : output&
1584 : operator=(output&& rhs) = default;
1585 :
1586 : output&
1587 : operator=(const output& other) = default;
1588 :
1589 41 : explicit output(const rpc_data_out_t& out) {
1590 41 : m_err = out.err;
1591 41 : m_io_size = out.io_size;
1592 : }
1593 :
1594 : int32_t
1595 41 : err() const {
1596 41 : return m_err;
1597 : }
1598 :
1599 : int64_t
1600 41 : io_size() const {
1601 41 : return m_io_size;
1602 : }
1603 :
1604 : private:
1605 : int32_t m_err;
1606 : size_t m_io_size;
1607 : };
1608 : };
1609 :
1610 : //==============================================================================
1611 : // definitions for read_data
1612 : struct read_data {
1613 :
1614 : // forward declarations of public input/output types for this RPC
1615 : class input;
1616 :
1617 : class output;
1618 :
1619 : // traits used so that the engine knows what to do with the RPC
1620 : using self_type = read_data;
1621 : using handle_type = hermes::rpc_handle<self_type>;
1622 : using input_type = input;
1623 : using output_type = output;
1624 : using mercury_input_type = rpc_read_data_in_t;
1625 : using mercury_output_type = rpc_data_out_t;
1626 :
1627 : // RPC public identifier
1628 : // (N.B: we reuse the same IDs assigned by Margo so that the daemon
1629 : // understands Hermes RPCs)
1630 : constexpr static const uint64_t public_id = 892207104;
1631 :
1632 : // RPC internal Mercury identifier
1633 : constexpr static const hg_id_t mercury_id = public_id;
1634 :
1635 : // RPC name
1636 : constexpr static const auto name = gkfs::rpc::tag::read;
1637 :
1638 : // requires response?
1639 : constexpr static const auto requires_response = true;
1640 :
1641 : // Mercury callback to serialize input arguments
1642 : constexpr static const auto mercury_in_proc_cb =
1643 : HG_GEN_PROC_NAME(rpc_read_data_in_t);
1644 :
1645 : // Mercury callback to serialize output arguments
1646 : constexpr static const auto mercury_out_proc_cb =
1647 : HG_GEN_PROC_NAME(rpc_data_out_t);
1648 :
1649 : class input {
1650 :
1651 : template <typename ExecutionContext>
1652 : friend hg_return_t
1653 : hermes::detail::post_to_mercury(ExecutionContext*);
1654 :
1655 : public:
1656 28 : input(const std::string& path, int64_t offset, uint64_t host_id,
1657 : uint64_t host_size, const std::string& wbitset, uint64_t chunk_n,
1658 : uint64_t chunk_start, uint64_t chunk_end,
1659 : uint64_t total_chunk_size, const hermes::exposed_memory& buffers)
1660 28 : : m_path(path), m_offset(offset), m_host_id(host_id),
1661 : m_host_size(host_size), m_wbitset(wbitset), m_chunk_n(chunk_n),
1662 : m_chunk_start(chunk_start), m_chunk_end(chunk_end),
1663 28 : m_total_chunk_size(total_chunk_size), m_buffers(buffers) {}
1664 :
1665 84 : input(input&& rhs) = default;
1666 :
1667 28 : input(const input& other) = default;
1668 :
1669 : input&
1670 : operator=(input&& rhs) = default;
1671 :
1672 : input&
1673 : operator=(const input& other) = default;
1674 :
1675 : std::string
1676 : path() const {
1677 : return m_path;
1678 : }
1679 :
1680 : int64_t
1681 28 : offset() const {
1682 28 : return m_offset;
1683 : }
1684 :
1685 : uint64_t
1686 : host_id() const {
1687 : return m_host_id;
1688 : }
1689 :
1690 : uint64_t
1691 : host_size() const {
1692 : return m_host_size;
1693 : }
1694 :
1695 : std::string
1696 : wbitset() const {
1697 : return m_wbitset;
1698 : }
1699 :
1700 : uint64_t
1701 28 : chunk_n() const {
1702 28 : return m_chunk_n;
1703 : }
1704 :
1705 : uint64_t
1706 : chunk_start() const {
1707 : return m_chunk_start;
1708 : }
1709 :
1710 : uint64_t
1711 : chunk_end() const {
1712 : return m_chunk_end;
1713 : }
1714 :
1715 : uint64_t
1716 : total_chunk_size() const {
1717 : return m_total_chunk_size;
1718 : }
1719 :
1720 : hermes::exposed_memory
1721 : buffers() const {
1722 : return m_buffers;
1723 : }
1724 :
1725 0 : explicit input(const rpc_read_data_in_t& other)
1726 0 : : m_path(other.path), m_offset(other.offset),
1727 0 : m_host_id(other.host_id), m_host_size(other.host_size),
1728 0 : m_wbitset(other.wbitset), m_chunk_n(other.chunk_n),
1729 0 : m_chunk_start(other.chunk_start), m_chunk_end(other.chunk_end),
1730 0 : m_total_chunk_size(other.total_chunk_size),
1731 0 : m_buffers(other.bulk_handle) {}
1732 :
1733 28 : explicit operator rpc_read_data_in_t() {
1734 28 : return {m_path.c_str(), m_offset, m_host_id,
1735 28 : m_host_size, m_wbitset.c_str(), m_chunk_n,
1736 28 : m_chunk_start, m_chunk_end, m_total_chunk_size,
1737 28 : hg_bulk_t(m_buffers)};
1738 : }
1739 :
1740 : private:
1741 : std::string m_path;
1742 : int64_t m_offset;
1743 : uint64_t m_host_id;
1744 : uint64_t m_host_size;
1745 : std::string m_wbitset;
1746 : uint64_t m_chunk_n;
1747 : uint64_t m_chunk_start;
1748 : uint64_t m_chunk_end;
1749 : uint64_t m_total_chunk_size;
1750 : hermes::exposed_memory m_buffers;
1751 : };
1752 :
1753 : class output {
1754 :
1755 : template <typename ExecutionContext>
1756 : friend hg_return_t
1757 : hermes::detail::post_to_mercury(ExecutionContext*);
1758 :
1759 : public:
1760 : output() : m_err(), m_io_size() {}
1761 :
1762 : output(int32_t err, size_t io_size) : m_err(err), m_io_size(io_size) {}
1763 :
1764 : output(output&& rhs) = default;
1765 :
1766 : output(const output& other) = default;
1767 :
1768 : output&
1769 : operator=(output&& rhs) = default;
1770 :
1771 : output&
1772 : operator=(const output& other) = default;
1773 :
1774 28 : explicit output(const rpc_data_out_t& out) {
1775 28 : m_err = out.err;
1776 28 : m_io_size = out.io_size;
1777 : }
1778 :
1779 : int32_t
1780 28 : err() const {
1781 28 : return m_err;
1782 : }
1783 :
1784 : int64_t
1785 28 : io_size() const {
1786 28 : return m_io_size;
1787 : }
1788 :
1789 : private:
1790 : int32_t m_err;
1791 : size_t m_io_size;
1792 : };
1793 : };
1794 :
1795 : //==============================================================================
1796 : // definitions for trunc_data
1797 : struct trunc_data {
1798 :
1799 : // forward declarations of public input/output types for this RPC
1800 : class input;
1801 :
1802 : class output;
1803 :
1804 : // traits used so that the engine knows what to do with the RPC
1805 : using self_type = trunc_data;
1806 : using handle_type = hermes::rpc_handle<self_type>;
1807 : using input_type = input;
1808 : using output_type = output;
1809 : using mercury_input_type = rpc_trunc_in_t;
1810 : using mercury_output_type = rpc_err_out_t;
1811 :
1812 : // RPC public identifier
1813 : // (N.B: we reuse the same IDs assigned by Margo so that the daemon
1814 : // understands Hermes RPCs)
1815 : constexpr static const uint64_t public_id = 1850933248;
1816 :
1817 : // RPC internal Mercury identifier
1818 : constexpr static const hg_id_t mercury_id = public_id;
1819 :
1820 : // RPC name
1821 : constexpr static const auto name = gkfs::rpc::tag::truncate;
1822 :
1823 : // requires response?
1824 : constexpr static const auto requires_response = true;
1825 :
1826 : // Mercury callback to serialize input arguments
1827 : constexpr static const auto mercury_in_proc_cb =
1828 : HG_GEN_PROC_NAME(rpc_trunc_in_t);
1829 :
1830 : // Mercury callback to serialize output arguments
1831 : constexpr static const auto mercury_out_proc_cb =
1832 : HG_GEN_PROC_NAME(rpc_err_out_t);
1833 :
1834 4 : class input {
1835 :
1836 : template <typename ExecutionContext>
1837 : friend hg_return_t
1838 : hermes::detail::post_to_mercury(ExecutionContext*);
1839 :
1840 : public:
1841 2 : input(const std::string& path, uint64_t length)
1842 2 : : m_path(path), m_length(length) {}
1843 :
1844 4 : input(input&& rhs) = default;
1845 :
1846 2 : input(const input& other) = default;
1847 :
1848 : input&
1849 : operator=(input&& rhs) = default;
1850 :
1851 : input&
1852 : operator=(const input& other) = default;
1853 :
1854 : std::string
1855 : path() const {
1856 : return m_path;
1857 : }
1858 :
1859 : uint64_t
1860 : length() const {
1861 : return m_length;
1862 : }
1863 :
1864 0 : explicit input(const rpc_trunc_in_t& other)
1865 0 : : m_path(other.path), m_length(other.length) {}
1866 :
1867 2 : explicit operator rpc_trunc_in_t() {
1868 2 : return {
1869 2 : m_path.c_str(),
1870 : m_length,
1871 2 : };
1872 : }
1873 :
1874 : private:
1875 : std::string m_path;
1876 : uint64_t m_length;
1877 : };
1878 :
1879 : class output {
1880 :
1881 : template <typename ExecutionContext>
1882 : friend hg_return_t
1883 : hermes::detail::post_to_mercury(ExecutionContext*);
1884 :
1885 : public:
1886 : output() : m_err() {}
1887 :
1888 : output(int32_t err) : m_err(err) {}
1889 :
1890 : output(output&& rhs) = default;
1891 :
1892 : output(const output& other) = default;
1893 :
1894 : output&
1895 : operator=(output&& rhs) = default;
1896 :
1897 : output&
1898 : operator=(const output& other) = default;
1899 :
1900 2 : explicit output(const rpc_err_out_t& out) {
1901 2 : m_err = out.err;
1902 : }
1903 :
1904 : int32_t
1905 2 : err() const {
1906 2 : return m_err;
1907 : }
1908 :
1909 : private:
1910 : int32_t m_err;
1911 : };
1912 : };
1913 :
1914 : //==============================================================================
1915 : // definitions for get_dirents
1916 : struct get_dirents {
1917 :
1918 : // forward declarations of public input/output types for this RPC
1919 : class input;
1920 :
1921 : class output;
1922 :
1923 : // traits used so that the engine knows what to do with the RPC
1924 : using self_type = get_dirents;
1925 : using handle_type = hermes::rpc_handle<self_type>;
1926 : using input_type = input;
1927 : using output_type = output;
1928 : using mercury_input_type = rpc_get_dirents_in_t;
1929 : using mercury_output_type = rpc_get_dirents_out_t;
1930 :
1931 : // RPC public identifier
1932 : // (N.B: we reuse the same IDs assigned by Margo so that the daemon
1933 : // understands Hermes RPCs)
1934 : constexpr static const uint64_t public_id = 4121034752;
1935 :
1936 : // RPC internal Mercury identifier
1937 : constexpr static const hg_id_t mercury_id = public_id;
1938 :
1939 : // RPC name
1940 : constexpr static const auto name = gkfs::rpc::tag::get_dirents;
1941 :
1942 : // requires response?
1943 : constexpr static const auto requires_response = true;
1944 :
1945 : // Mercury callback to serialize input arguments
1946 : constexpr static const auto mercury_in_proc_cb =
1947 : HG_GEN_PROC_NAME(rpc_get_dirents_in_t);
1948 :
1949 : // Mercury callback to serialize output arguments
1950 : constexpr static const auto mercury_out_proc_cb =
1951 : HG_GEN_PROC_NAME(rpc_get_dirents_out_t);
1952 :
1953 50 : class input {
1954 :
1955 : template <typename ExecutionContext>
1956 : friend hg_return_t
1957 : hermes::detail::post_to_mercury(ExecutionContext*);
1958 :
1959 : public:
1960 25 : input(const std::string& path, const hermes::exposed_memory& buffers)
1961 25 : : m_path(path), m_buffers(buffers) {}
1962 :
1963 50 : input(input&& rhs) = default;
1964 :
1965 25 : input(const input& other) = default;
1966 :
1967 : input&
1968 : operator=(input&& rhs) = default;
1969 :
1970 : input&
1971 : operator=(const input& other) = default;
1972 :
1973 : std::string
1974 : path() const {
1975 : return m_path;
1976 : }
1977 :
1978 : hermes::exposed_memory
1979 : buffers() const {
1980 : return m_buffers;
1981 : }
1982 :
1983 0 : explicit input(const rpc_get_dirents_in_t& other)
1984 0 : : m_path(other.path), m_buffers(other.bulk_handle) {}
1985 :
1986 25 : explicit operator rpc_get_dirents_in_t() {
1987 25 : return {m_path.c_str(), hg_bulk_t(m_buffers)};
1988 : }
1989 :
1990 : private:
1991 : std::string m_path;
1992 : hermes::exposed_memory m_buffers;
1993 : };
1994 :
1995 : class output {
1996 :
1997 : template <typename ExecutionContext>
1998 : friend hg_return_t
1999 : hermes::detail::post_to_mercury(ExecutionContext*);
2000 :
2001 : public:
2002 25 : output() : m_err(), m_dirents_size() {}
2003 :
2004 : output(int32_t err, size_t dirents_size)
2005 : : m_err(err), m_dirents_size(dirents_size) {}
2006 :
2007 : output(output&& rhs) = default;
2008 :
2009 : output(const output& other) = default;
2010 :
2011 : output&
2012 : operator=(output&& rhs) = default;
2013 :
2014 : output&
2015 : operator=(const output& other) = default;
2016 :
2017 25 : explicit output(const rpc_get_dirents_out_t& out) {
2018 25 : m_err = out.err;
2019 25 : m_dirents_size = out.dirents_size;
2020 : }
2021 :
2022 : int32_t
2023 25 : err() const {
2024 25 : return m_err;
2025 : }
2026 :
2027 : size_t
2028 1079 : dirents_size() const {
2029 1054 : return m_dirents_size;
2030 : }
2031 :
2032 : private:
2033 : int32_t m_err;
2034 : size_t m_dirents_size;
2035 : };
2036 : };
2037 :
2038 : //==============================================================================
2039 : // definitions for get_dirents_extended
2040 : struct get_dirents_extended {
2041 :
2042 : // forward declarations of public input/output types for this RPC
2043 : class input;
2044 :
2045 : class output;
2046 :
2047 : // traits used so that the engine knows what to do with the RPC
2048 : using self_type = get_dirents_extended;
2049 : using handle_type = hermes::rpc_handle<self_type>;
2050 : using input_type = input;
2051 : using output_type = output;
2052 : using mercury_input_type = rpc_get_dirents_in_t;
2053 : using mercury_output_type = rpc_get_dirents_out_t;
2054 :
2055 : // RPC public identifier
2056 : // (N.B: we reuse the same IDs assigned by Margo so that the daemon
2057 : // understands Hermes RPCs)
2058 : constexpr static const uint64_t public_id = 1463943168;
2059 :
2060 : // RPC internal Mercury identifier
2061 : constexpr static const hg_id_t mercury_id = public_id;
2062 :
2063 : // RPC name
2064 : constexpr static const auto name = gkfs::rpc::tag::get_dirents_extended;
2065 :
2066 : // requires response?
2067 : constexpr static const auto requires_response = true;
2068 :
2069 : // Mercury callback to serialize input arguments
2070 : constexpr static const auto mercury_in_proc_cb =
2071 : HG_GEN_PROC_NAME(rpc_get_dirents_in_t);
2072 :
2073 : // Mercury callback to serialize output arguments
2074 : constexpr static const auto mercury_out_proc_cb =
2075 : HG_GEN_PROC_NAME(rpc_get_dirents_out_t);
2076 :
2077 8 : class input {
2078 :
2079 : template <typename ExecutionContext>
2080 : friend hg_return_t
2081 : hermes::detail::post_to_mercury(ExecutionContext*);
2082 :
2083 : public:
2084 4 : input(const std::string& path, const hermes::exposed_memory& buffers)
2085 4 : : m_path(path), m_buffers(buffers) {}
2086 :
2087 8 : input(input&& rhs) = default;
2088 :
2089 :
2090 4 : input(const input& other) = default;
2091 :
2092 : input&
2093 : operator=(input&& rhs) = default;
2094 :
2095 : input&
2096 : operator=(const input& other) = default;
2097 :
2098 : std::string
2099 : path() const {
2100 : return m_path;
2101 : }
2102 :
2103 : hermes::exposed_memory
2104 : buffers() const {
2105 : return m_buffers;
2106 : }
2107 :
2108 0 : explicit input(const rpc_get_dirents_in_t& other)
2109 0 : : m_path(other.path), m_buffers(other.bulk_handle) {}
2110 :
2111 4 : explicit operator rpc_get_dirents_in_t() {
2112 4 : return {m_path.c_str(), hg_bulk_t(m_buffers)};
2113 : }
2114 :
2115 : private:
2116 : std::string m_path;
2117 : hermes::exposed_memory m_buffers;
2118 : };
2119 :
2120 : class output {
2121 :
2122 : template <typename ExecutionContext>
2123 : friend hg_return_t
2124 : hermes::detail::post_to_mercury(ExecutionContext*);
2125 :
2126 : public:
2127 4 : output() : m_err(), m_dirents_size() {}
2128 :
2129 : output(int32_t err, size_t dirents_size)
2130 : : m_err(err), m_dirents_size(dirents_size) {}
2131 :
2132 : output(output&& rhs) = default;
2133 :
2134 : output(const output& other) = default;
2135 :
2136 : output&
2137 : operator=(output&& rhs) = default;
2138 :
2139 : output&
2140 : operator=(const output& other) = default;
2141 :
2142 4 : explicit output(const rpc_get_dirents_out_t& out) {
2143 4 : m_err = out.err;
2144 4 : m_dirents_size = out.dirents_size;
2145 : }
2146 :
2147 : int32_t
2148 4 : err() const {
2149 4 : return m_err;
2150 : }
2151 :
2152 : size_t
2153 12 : dirents_size() const {
2154 8 : return m_dirents_size;
2155 : }
2156 :
2157 : private:
2158 : int32_t m_err;
2159 : size_t m_dirents_size;
2160 : };
2161 : };
2162 :
2163 :
2164 : //==============================================================================
2165 : // definitions for chunk_stat
2166 : struct chunk_stat {
2167 :
2168 : // forward declarations of public input/output types for this RPC
2169 : class input;
2170 :
2171 : class output;
2172 :
2173 : // traits used so that the engine knows what to do with the RPC
2174 : using self_type = chunk_stat;
2175 : using handle_type = hermes::rpc_handle<self_type>;
2176 : using input_type = input;
2177 : using output_type = output;
2178 : using mercury_input_type = rpc_chunk_stat_in_t;
2179 : using mercury_output_type = rpc_chunk_stat_out_t;
2180 :
2181 : // RPC public identifier
2182 : // (N.B: we reuse the same IDs assigned by Margo so that the daemon
2183 : // understands Hermes RPCs)
2184 : constexpr static const uint64_t public_id = 532742144;
2185 :
2186 : // RPC internal Mercury identifier
2187 : constexpr static const hg_id_t mercury_id = public_id;
2188 :
2189 : // RPC name
2190 : constexpr static const auto name = gkfs::rpc::tag::get_chunk_stat;
2191 :
2192 : // requires response?
2193 : constexpr static const auto requires_response = true;
2194 :
2195 : // Mercury callback to serialize input arguments
2196 : constexpr static const auto mercury_in_proc_cb =
2197 : HG_GEN_PROC_NAME(rpc_chunk_stat_in_t);
2198 :
2199 : // Mercury callback to serialize output arguments
2200 : constexpr static const auto mercury_out_proc_cb =
2201 : HG_GEN_PROC_NAME(rpc_chunk_stat_out_t);
2202 :
2203 : class input {
2204 :
2205 : template <typename ExecutionContext>
2206 : friend hg_return_t
2207 : hermes::detail::post_to_mercury(ExecutionContext*);
2208 :
2209 : public:
2210 2 : input(int32_t dummy) : m_dummy(dummy) {}
2211 :
2212 : input(input&& rhs) = default;
2213 :
2214 : input(const input& other) = default;
2215 :
2216 : input&
2217 : operator=(input&& rhs) = default;
2218 :
2219 : input&
2220 : operator=(const input& other) = default;
2221 :
2222 : int32_t
2223 : dummy() const {
2224 : return m_dummy;
2225 : }
2226 :
2227 0 : explicit input(const rpc_chunk_stat_in_t& other)
2228 0 : : m_dummy(other.dummy) {}
2229 :
2230 2 : explicit operator rpc_chunk_stat_in_t() {
2231 2 : return {m_dummy};
2232 : }
2233 :
2234 : private:
2235 : int32_t m_dummy;
2236 : };
2237 :
2238 : class output {
2239 :
2240 : template <typename ExecutionContext>
2241 : friend hg_return_t
2242 : hermes::detail::post_to_mercury(ExecutionContext*);
2243 :
2244 : public:
2245 2 : output() : m_err(), m_chunk_size(), m_chunk_total(), m_chunk_free() {}
2246 :
2247 : output(int32_t err, uint64_t chunk_size, uint64_t chunk_total,
2248 : uint64_t chunk_free)
2249 : : m_err(err), m_chunk_size(chunk_size), m_chunk_total(chunk_total),
2250 : m_chunk_free(chunk_free) {}
2251 :
2252 : output(output&& rhs) = default;
2253 :
2254 : output(const output& other) = default;
2255 :
2256 : output&
2257 : operator=(output&& rhs) = default;
2258 :
2259 : output&
2260 : operator=(const output& other) = default;
2261 :
2262 2 : explicit output(const rpc_chunk_stat_out_t& out) {
2263 2 : m_err = out.err;
2264 2 : m_chunk_size = out.chunk_size;
2265 2 : m_chunk_total = out.chunk_total;
2266 2 : m_chunk_free = out.chunk_free;
2267 : }
2268 :
2269 : int32_t
2270 2 : err() const {
2271 2 : return m_err;
2272 : }
2273 :
2274 : uint64_t
2275 2 : chunk_size() const {
2276 2 : return m_chunk_size;
2277 : }
2278 :
2279 : uint64_t
2280 2 : chunk_total() const {
2281 2 : return m_chunk_total;
2282 : }
2283 :
2284 : uint64_t
2285 2 : chunk_free() const {
2286 2 : return m_chunk_free;
2287 : }
2288 :
2289 : private:
2290 : int32_t m_err;
2291 : uint64_t m_chunk_size;
2292 : uint64_t m_chunk_total;
2293 : uint64_t m_chunk_free;
2294 : };
2295 : };
2296 :
2297 : } // namespace gkfs::rpc
2298 :
2299 :
2300 : #endif // GKFS_RPCS_TYPES_HPP
|