11 #ifndef WRENCH_STORAGESERVICEMESSAGE_H
12 #define WRENCH_STORAGESERVICEMESSAGE_H
17 #include "wrench/services/ServiceMessage.h"
18 #include "wrench/failure_causes/FailureCause.h"
19 #include "wrench/services/file_registry/FileRegistryService.h"
20 #include "wrench/simulation/SimulationTimestampTypes.h"
21 #include "wrench/simulation/Simulation.h"
22 #include "wrench/simulation/SimulationOutput.h"
33 class StorageServiceMessage :
public ServiceMessage {
35 StorageServiceMessage(
double payload);
42 class StorageServiceFreeSpaceRequestMessage :
public StorageServiceMessage {
44 StorageServiceFreeSpaceRequestMessage(simgrid::s4u::Mailbox *answer_mailbox,
double payload);
47 simgrid::s4u::Mailbox *answer_mailbox;
53 class StorageServiceFreeSpaceAnswerMessage :
public StorageServiceMessage {
55 StorageServiceFreeSpaceAnswerMessage(std::map<std::string, double> free_space,
double payload);
58 std::map<std::string, double> free_space;
64 class StorageServiceFileLookupRequestMessage :
public StorageServiceMessage {
66 StorageServiceFileLookupRequestMessage(simgrid::s4u::Mailbox *answer_mailbox, std::shared_ptr<DataFile>file,
67 std::shared_ptr<FileLocation> location,
double payload);
70 simgrid::s4u::Mailbox *answer_mailbox;
72 std::shared_ptr<DataFile>file;
74 std::shared_ptr<FileLocation> location;
80 class StorageServiceFileLookupAnswerMessage :
public StorageServiceMessage {
82 StorageServiceFileLookupAnswerMessage(std::shared_ptr<DataFile>file,
bool file_is_available,
double payload);
85 std::shared_ptr<DataFile>file;
87 bool file_is_available;
93 class StorageServiceFileDeleteRequestMessage :
public StorageServiceMessage {
95 StorageServiceFileDeleteRequestMessage(simgrid::s4u::Mailbox *answer_mailbox,
96 std::shared_ptr<DataFile>file,
97 std::shared_ptr<FileLocation> location,
101 simgrid::s4u::Mailbox *answer_mailbox;
103 std::shared_ptr<DataFile>file;
105 std::shared_ptr<FileLocation> location;
111 class StorageServiceFileDeleteAnswerMessage :
public StorageServiceMessage {
113 StorageServiceFileDeleteAnswerMessage(std::shared_ptr<DataFile>file,
114 std::shared_ptr<StorageService> storage_service,
116 std::shared_ptr<FailureCause> failure_cause,
120 std::shared_ptr<DataFile>file;
122 std::shared_ptr<StorageService> storage_service;
126 std::shared_ptr<FailureCause> failure_cause;
132 class StorageServiceFileCopyRequestMessage :
public StorageServiceMessage {
134 StorageServiceFileCopyRequestMessage(simgrid::s4u::Mailbox *answer_mailbox,
135 std::shared_ptr<DataFile> file,
136 std::shared_ptr<FileLocation> src,
137 std::shared_ptr<FileLocation> dst,
138 std::shared_ptr<FileRegistryService> file_registry_service,
142 simgrid::s4u::Mailbox *answer_mailbox;
144 std::shared_ptr<DataFile>file;
146 std::shared_ptr<FileLocation> src;
148 std::shared_ptr<FileLocation> dst;
150 std::shared_ptr<FileRegistryService> file_registry_service;
156 class StorageServiceFileCopyAnswerMessage :
public StorageServiceMessage {
158 StorageServiceFileCopyAnswerMessage(std::shared_ptr<DataFile>file,
159 std::shared_ptr<FileLocation> src,
160 std::shared_ptr<FileLocation> dst,
161 std::shared_ptr<FileRegistryService> file_registry_service,
162 bool file_registry_service_updated,
163 bool success, std::shared_ptr<FailureCause> cause,
167 std::shared_ptr<DataFile>file;
169 std::shared_ptr<FileLocation> src;
171 std::shared_ptr<FileLocation> dst;
173 std::shared_ptr<FileRegistryService> file_registry_service;
175 bool file_registry_service_updated;
179 std::shared_ptr<FailureCause> failure_cause;
188 class StorageServiceFileWriteRequestMessage :
public StorageServiceMessage {
190 StorageServiceFileWriteRequestMessage(simgrid::s4u::Mailbox *answer_mailbox,
191 std::shared_ptr<DataFile>file,
192 std::shared_ptr<FileLocation> location,
193 unsigned long buffer_size,
197 simgrid::s4u::Mailbox *answer_mailbox;
199 std::shared_ptr<DataFile>file;
201 std::shared_ptr<FileLocation> location;
203 unsigned long buffer_size;
209 class StorageServiceFileWriteAnswerMessage :
public StorageServiceMessage {
211 StorageServiceFileWriteAnswerMessage(std::shared_ptr<DataFile>file,
212 std::shared_ptr<FileLocation> location,
214 std::shared_ptr<FailureCause> failure_cause,
215 simgrid::s4u::Mailbox *data_write_mailbox_name,
219 std::shared_ptr<DataFile>file;
221 std::shared_ptr<FileLocation> location;
225 simgrid::s4u::Mailbox *data_write_mailbox;
227 std::shared_ptr<FailureCause> failure_cause;
233 class StorageServiceFileReadRequestMessage :
public StorageServiceMessage {
235 StorageServiceFileReadRequestMessage(simgrid::s4u::Mailbox *answer_mailbox,
236 simgrid::s4u::Mailbox *mailbox_to_receive_the_file_content,
237 std::shared_ptr<DataFile>file,
238 std::shared_ptr<FileLocation> location,
239 double num_bytes_to_read,
240 unsigned long buffer_size,
244 simgrid::s4u::Mailbox *answer_mailbox;
246 simgrid::s4u::Mailbox *mailbox_to_receive_the_file_content;
248 std::shared_ptr<DataFile>file;
250 std::shared_ptr<FileLocation> location;
252 double num_bytes_to_read;
254 unsigned long buffer_size;
260 class StorageServiceFileReadAnswerMessage :
public StorageServiceMessage {
262 StorageServiceFileReadAnswerMessage(std::shared_ptr<DataFile>file,
263 std::shared_ptr<FileLocation> location,
265 std::shared_ptr<FailureCause> failure_cause,
269 std::shared_ptr<DataFile>file;
271 std::shared_ptr<FileLocation> location;
275 std::shared_ptr<FailureCause> failure_cause;
281 class StorageServiceFileContentChunkMessage :
public StorageServiceMessage {
283 explicit StorageServiceFileContentChunkMessage(std::shared_ptr<DataFile>file,
284 unsigned long chunk_size,
bool last_chunk);
287 std::shared_ptr<DataFile>file;
296 class StorageServiceAckMessage :
public StorageServiceMessage {
298 StorageServiceAckMessage() : StorageServiceMessage(0) {}
309 #endif //WRENCH_STORAGESERVICEMESSAGE_H