Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Add new entry in Release_Notes.
[simgrid.git] / include / simgrid / s4u / Io.hpp
1 /* Copyright (c) 2017-2023. The SimGrid Team. All rights reserved.          */
2
3 /* This program is free software; you can redistribute it and/or modify it
4  * under the terms of the license (GNU LGPL) which comes with this package. */
5
6 #ifndef SIMGRID_S4U_IO_HPP
7 #define SIMGRID_S4U_IO_HPP
8
9 #include <simgrid/forward.h>
10 #include <simgrid/s4u/Activity.hpp>
11
12 #include <string>
13
14 namespace simgrid::s4u {
15
16 /** I/O Activity, representing the asynchronous disk access.
17  *
18  * They are generated from Disk::io_init(), Disk::read() Disk::read_async(), Disk::write() and Disk::write_async().
19  */
20
21 class XBT_PUBLIC Io : public Activity_T<Io> {
22 #ifndef DOXYGEN
23   friend kernel::activity::IoImpl;
24   friend kernel::EngineImpl;
25 #endif
26
27 protected:
28   explicit Io(kernel::activity::IoImplPtr pimpl);
29   Io* do_start() override;
30
31   static ssize_t deprecated_wait_any_for(const std::vector<IoPtr>& ios, double timeout); // XBT_ATTRIB_DEPRECATED_v339
32
33 public:
34   enum class OpType { READ, WRITE };
35
36    /*! \static Initiate the creation of an I/O. Setters have to be called afterwards */
37   static IoPtr init();
38 #ifndef DOXYGEN
39   XBT_ATTRIB_DEPRECATED_v339("Please use ActivitySet instead") 
40   static ssize_t wait_any(const std::vector<IoPtr>& ios) { return deprecated_wait_any_for(ios, -1); }
41   XBT_ATTRIB_DEPRECATED_v339("Please use ActivitySet instead") 
42   static ssize_t wait_any_for(const std::vector<IoPtr>& ios, double timeout) { return deprecated_wait_any_for(ios, timeout); }
43 #endif
44
45   double get_remaining() const override;
46   sg_size_t get_performed_ioops() const;
47   IoPtr set_disk(const_sg_disk_t disk);
48   IoPtr set_priority(double priority);
49   IoPtr set_size(sg_size_t size);
50   IoPtr set_op_type(OpType type);
51
52   static IoPtr streamto_init(Host* from, const Disk* from_disk, Host* to, const Disk* to_disk);
53   static IoPtr streamto_async(Host* from, const Disk* from_disk, Host* to, const Disk* to_disk,
54                               uint64_t simulated_size_in_bytes);
55   static void streamto(Host* from, const Disk* from_disk, Host* to, const Disk* to_disk,
56                        uint64_t simulated_size_in_bytes);
57
58   IoPtr set_source(Host* from, const Disk* from_disk);
59   IoPtr set_destination(Host* to, const Disk* to_disk);
60
61   IoPtr update_priority(double priority);
62
63   bool is_assigned() const override;
64 };
65
66 } // namespace simgrid::s4u
67
68 #endif /* SIMGRID_S4U_IO_HPP */