SimpleStorageService.h
1 
10 #ifndef WRENCH_SIMPLESTORAGESERVICE_H
11 #define WRENCH_SIMPLESTORAGESERVICE_H
12 
13 
14 #include <wrench/services/storage/simple/NetworkConnection.h>
15 #include <wrench/services/storage/simple/NetworkConnectionManager.h>
16 #include "wrench/services/storage/StorageService.h"
17 #include "SimpleStorageServiceProperty.h"
18 #include "SimpleStorageServiceMessagePayload.h"
19 #include "wrench/simgrid_S4U_util/S4U_PendingCommunication.h"
20 
21 namespace wrench {
22 
23  class SimulationMessage;
24  class SimulationTimestampFileCopyStart;
25 
26  class S4U_PendingCommunication;
27 
28  class IncomingFile;
29 
35 
36  private:
37  std::map<std::string, std::string> default_property_values = {
40  };
41 
42  std::map<std::string, std::string> default_messagepayload_values = {
57  };
58 
59  public:
60 
61  // Public Constructor
62  SimpleStorageService(std::string hostname,
63  double capacity,
64  std::map<std::string, std::string> property_list = {},
65  std::map<std::string, std::string> messagepayload_list = {});
66 
67  /***********************/
69  /***********************/
70 
72 
73  /***********************/
75  /***********************/
76 
77  private:
78 
79 
80 
81  friend class Simulation;
82 
83  // Low-level Constructor
84  SimpleStorageService(std::string hostname,
85  double capacity,
86  std::map<std::string, std::string> property_list,
87  std::map<std::string, std::string> messagepayload_list,
88  std::string suffix);
89 
90  int main() override;
91 
92  bool processControlMessage(std::unique_ptr<NetworkConnection> connection);
93 
94  bool processDataConnection(std::unique_ptr<NetworkConnection> connection);
95  bool processIncomingDataConnection(std::unique_ptr<NetworkConnection> connection);
96  bool processOutgoingDataConnection(std::unique_ptr<NetworkConnection> connection);
97 
98  unsigned long getNewUniqueNumber();
99 
100  bool processFileWriteRequest(WorkflowFile *file, std::string dst_dir, std::string answer_mailbox);
101 
102  bool processFileReadRequest(WorkflowFile *file, std::string src_dir, std::string answer_mailbox,
103  std::string mailbox_to_receive_the_file_content);
104 
105  bool processFileCopyRequest(WorkflowFile *file, StorageService *src, std::string src_dir, std::string dst_dir, std::string answer_mailbox, SimulationTimestampFileCopyStart *start_timestamp);
106 
107  unsigned long num_concurrent_connections;
108 
109  std::unique_ptr<NetworkConnectionManager> network_connection_manager;
110 
111 
112  };
113 
114 };
115 
116 
117 #endif //WRENCH_SIMPLESTORAGESERVICE_H
A storage service that provides direct access to some storage resource (e.g., a disk) ...
Definition: SimpleStorageService.h:34
SimpleStorageService(std::string hostname, double capacity, std::map< std::string, std::string > property_list={}, std::map< std::string, std::string > messagepayload_list={})
Public constructor.
Definition: SimpleStorageService.cpp:55
static const std::string STOP_DAEMON_MESSAGE_PAYLOAD
The number of bytes in the control message sent to the daemon to terminate it.
Definition: ServiceMessagePayload.h:31
static const std::string FILE_WRITE_REQUEST_MESSAGE_PAYLOAD
The number of bytes in the control message sent to the daemon to request a file copy.
Definition: StorageServiceMessagePayload.h:47
static const std::string FILE_COPY_ANSWER_MESSAGE_PAYLOAD
The number of bytes in the control message sent by the daemon to answer a file copy request...
Definition: StorageServiceMessagePayload.h:44
static const std::string FREE_SPACE_ANSWER_MESSAGE_PAYLOAD
The number of bytes in the control message sent by the daemon to answer free space information reques...
Definition: StorageServiceMessagePayload.h:29
A data file used/produced by a WorkflowTask in a Workflow.
Definition: WorkflowFile.h:26
static const std::string SELF_CONNECTION_DELAY
The simulated delay when a storage service connects to itself (default = "0")
Definition: StorageServiceProperty.h:30
A class that provides basic simulation methods.
Definition: Simulation.h:34
static const std::string FILE_DELETE_ANSWER_MESSAGE_PAYLOAD
The number of bytes in the control message sent by the daemon to answer a file deletion request...
Definition: StorageServiceMessagePayload.h:39
static const std::string FILE_COPY_REQUEST_MESSAGE_PAYLOAD
The number of bytes in the control message sent to the daemon to request a file copy.
Definition: StorageServiceMessagePayload.h:42
static const std::string FREE_SPACE_REQUEST_MESSAGE_PAYLOAD
The number of bytes in the control message sent to the daemon to request its free space information...
Definition: StorageServiceMessagePayload.h:27
static const std::string FILE_LOOKUP_ANSWER_MESSAGE_PAYLOAD
The number of bytes in the control message sent by the daemon to answer a file lookup request...
Definition: StorageServiceMessagePayload.h:34
static const std::string FILE_READ_ANSWER_MESSAGE_PAYLOAD
The number of bytes in the control message sent by the daemon to answer a file copy request...
Definition: StorageServiceMessagePayload.h:54
A simulation timestamp class for file copy start times.
Definition: SimulationTimestampTypes.h:195
static const std::string FILE_READ_REQUEST_MESSAGE_PAYLOAD
The number of bytes in the control message sent to the daemon to request a file copy.
Definition: StorageServiceMessagePayload.h:52
static const std::string FILE_WRITE_ANSWER_MESSAGE_PAYLOAD
The number of bytes in the control message sent by the daemon to answer a file copy request...
Definition: StorageServiceMessagePayload.h:49
The storage service base class.
Definition: StorageService.h:35
static const std::string MAX_NUM_CONCURRENT_DATA_CONNECTIONS
The maximum number of concurrent data connections supported by the service (default = "infinity") ...
Definition: StorageServiceProperty.h:27
static const std::string DAEMON_STOPPED_MESSAGE_PAYLOAD
The number of bytes in the control message sent by the daemon to confirm it has terminated.
Definition: ServiceMessagePayload.h:33
static const std::string FILE_LOOKUP_REQUEST_MESSAGE_PAYLOAD
The number of bytes in the control message sent to the daemon to request a file lookup.
Definition: StorageServiceMessagePayload.h:32
Definition: TerminalOutput.cpp:15
static const std::string FILE_DELETE_REQUEST_MESSAGE_PAYLOAD
The number of bytes in the control message sent to the daemon to request a file deletion.
Definition: StorageServiceMessagePayload.h:37