FileRegistryService.h
1 
11 #ifndef WRENCH_FILEREGISTRYSERVICE_H
12 #define WRENCH_FILEREGISTRYSERVICE_H
13 
14 #include <set>
15 
16 #include <wrench/services/Service.h>
17 #include <wrench/services/network_proximity/NetworkProximityService.h>
18 #include <wrench/services/storage/StorageService.h>
19 #include <wrench/services/storage/storage_helpers/FileLocation.h>
20 
21 #include "FileRegistryServiceProperty.h"
22 #include "FileRegistryServiceMessagePayload.h"
23 
24 namespace wrench {
25 
26  class WorkflowFile;
27 
28  class StorageService;
29 
36  class FileRegistryService : public Service {
37 
38  public:
39 
40 
41  private:
42 
43  std::map<std::string, std::string> default_property_values = {
47  };
48 
49  std::map<std::string, double> default_messagepayload_values = {
58  };
59 
60  public:
61 
62 
63  // Public Constructor
64  explicit FileRegistryService(std::string hostname,
65  std::map<std::string, std::string> property_list = {},
66  std::map<std::string, double> messagepayload_list = {}
67  );
68 
69  /****************************/
71  /****************************/
72 
73  std::set<std::shared_ptr<FileLocation>> lookupEntry(WorkflowFile *file);
74 
75  std::map<double, std::shared_ptr<FileLocation>> lookupEntry(WorkflowFile *file, std::string reference_host,
76  std::shared_ptr<NetworkProximityService> network_proximity_service);
77 
78  void addEntry(WorkflowFile *file, std::shared_ptr<FileLocation> location);
79 
80  void removeEntry(WorkflowFile *file, std::shared_ptr<FileLocation> location);
81 
82  /****************************/
84  /****************************/
85 
86 
87  /****************************/
89  /****************************/
90 
91  ~FileRegistryService() override;
92  /****************************/
94  /****************************/
95 
96  private:
97 
98  friend class Simulation;
99 
100  void addEntryToDatabase(WorkflowFile *file, std::shared_ptr<FileLocation> location);
101 
102  bool removeEntryFromDatabase(WorkflowFile *file, std::shared_ptr<FileLocation> location);
103 
104  int main() override;
105 
106  bool processNextMessage();
107 
108  std::map<WorkflowFile *, std::set<std::shared_ptr<FileLocation>>> entries;
109  };
110 
111 
112 
113 };
114 
115 
116 #endif //WRENCH_FILEREGISTRYSERVICE_H
static const std::string ADD_ENTRY_ANSWER_MESSAGE_PAYLOAD
The number of bytes in the control message sent by the daemon to answer an entry addition request.
Definition: FileRegistryServiceMessagePayload.h:32
static const std::string REMOVE_ENTRY_REQUEST_MESSAGE_PAYLOAD
The number of bytes in the control message sent to the daemon to cause it to remove an entry.
Definition: FileRegistryServiceMessagePayload.h:35
static const std::string LOOKUP_COMPUTE_COST
The computational cost, in flops, of looking entries for a file.
Definition: FileRegistryServiceProperty.h:28
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 ADD_ENTRY_COMPUTE_COST
The computational cost, in flops, of adding, an entry for a file.
Definition: FileRegistryServiceProperty.h:34
A file registry service (a.k.a. replica catalog) that holds a database of which files are available a...
Definition: FileRegistryService.h:36
FileRegistryService(std::string hostname, std::map< std::string, std::string > property_list={}, std::map< std::string, double > messagepayload_list={})
Constructor.
Definition: FileRegistryService.cpp:39
static const std::string FILE_LOOKUP_ANSWER_MESSAGE_PAYLOAD
The number of bytes per file location returned in an answer sent by the daemon to answer a file locat...
Definition: FileRegistryServiceMessagePayload.h:27
static const std::string REMOVE_ENTRY_ANSWER_MESSAGE_PAYLOAD
The number of bytes in the control message sent by the daemon to answer an entry removal request.
Definition: FileRegistryServiceMessagePayload.h:37
Definition: Alarm.cpp:20
static const std::string FILE_LOOKUP_REQUEST_MESSAGE_PAYLOAD
The number of bytes in a request control message sent to the daemon to request a list of file locatio...
Definition: FileRegistryServiceMessagePayload.h:25
static const std::string ADD_ENTRY_REQUEST_MESSAGE_PAYLOAD
The number of bytes in the control message sent to the daemon to cause it to add an entry.
Definition: FileRegistryServiceMessagePayload.h:30
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
A class that provides basic simulation methods. Once the simulation object has been explicitly or imp...
Definition: Simulation.h:45
static const std::string REMOVE_ENTRY_COMPUTE_COST
The computational cost, in flops, of removing an entry for a file.
Definition: FileRegistryServiceProperty.h:40
A service that can be added to the simulation and that can be used by a WMS when executing a workflow...
Definition: Service.h:26
A data file used/produced by a WorkflowTask in a Workflow.
Definition: WorkflowFile.h:26