FileRegistryService.h
1 
11 #ifndef WRENCH_FILEREGISTRYSERVICE_H
12 #define WRENCH_FILEREGISTRYSERVICE_H
13 
14 #include <set>
15 #include <wrench/services/network_proximity/NetworkProximityService.h>
16 
17 #include "wrench/services/Service.h"
18 #include "FileRegistryServiceProperty.h"
19 #include "FileRegistryServiceMessagePayload.h"
20 
21 namespace wrench {
22 
23  class WorkflowFile;
24 
25  class StorageService;
26 
33  class FileRegistryService : public Service {
34 
35  public:
36 
37 
38  private:
39 
40  std::map<std::string, std::string> default_property_values = {
42  };
43 
44  std::map<std::string, std::string> default_messagepayload_values = {
53  };
54 
55  public:
56 
57 
58  // Public Constructor
59  FileRegistryService(std::string hostname,
60  std::map<std::string, std::string> property_list = {},
61  std::map<std::string, std::string> messagepayload_list = {}
62  );
63 
64  /****************************/
66  /****************************/
67 
68  std::set<StorageService *> lookupEntry(WorkflowFile *file);
69 
70  std::map<double, StorageService *> lookupEntry(WorkflowFile *file, std::string reference_host,
72 
73  void addEntry(WorkflowFile *file, StorageService *storage_service);
74 
75  void removeEntry(WorkflowFile *file, StorageService *storage_service);
76 
77  /****************************/
79  /****************************/
80 
81 
82  /****************************/
84  /****************************/
85 
87  /****************************/
89  /****************************/
90 
91  private:
92 
93  friend class Simulation;
94 
95  FileRegistryService(std::string hostname,
96  std::map<std::string, std::string> property_list,
97  std::map<std::string, std::string> messagepayload_list,
98  std::string suffix = "");
99 
100 
101  void addEntryToDatabase(WorkflowFile *file, StorageService *storage_service);
102 
103  bool removeEntryFromDatabase(WorkflowFile *file, StorageService *storage_service);
104 
105  int main();
106 
107  bool processNextMessage();
108 
109  std::map<WorkflowFile *, std::set<StorageService *>> entries;
110  };
111 
112 
113 
114 };
115 
116 
117 #endif //WRENCH_FILEREGISTRYSERVICE_H
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 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 STOP_DAEMON_MESSAGE_PAYLOAD
The number of bytes in the control message sent to the daemon to terminate it.
Definition: ServiceMessagePayload.h:31
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
static const std::string LOOKUP_COMPUTE_COST
The computational cost, in flops, of looking up entries for a file.
Definition: FileRegistryServiceProperty.h:26
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
A data file used/produced by a WorkflowTask in a Workflow.
Definition: WorkflowFile.h:26
A class that provides basic simulation methods.
Definition: Simulation.h:34
A file registry service (a.k.a. replica catalog) that holds a database of which files are available a...
Definition: FileRegistryService.h:33
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
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
A network proximity service that continuously estimates inter-host latencies and can be queried for s...
Definition: NetworkProximityService.h:26
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
The storage service base class.
Definition: StorageService.h:35
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
Definition: TerminalOutput.cpp:15
FileRegistryService(std::string hostname, std::map< std::string, std::string > property_list={}, std::map< std::string, std::string > messagepayload_list={})
Constructor.
Definition: FileRegistryService.cpp:36