WRENCH  1.11
Cyberinfrastructure Simulation Workbench
Overview Installation Getting Started WRENCH 101 WRENCH 102
FileRegistryService.h
1 
10 #ifndef WRENCH_FILEREGISTRYSERVICE_H
11 #define WRENCH_FILEREGISTRYSERVICE_H
12 
13 #include <set>
14 
15 #include "wrench/services/Service.h"
16 #include "wrench/services/network_proximity/NetworkProximityService.h"
17 #include "wrench/services/storage/StorageService.h"
18 #include "wrench/services/storage/storage_helpers/FileLocation.h"
19 
20 #include "FileRegistryServiceProperty.h"
21 #include "FileRegistryServiceMessagePayload.h"
22 
23 namespace wrench {
24 
25  class DataFile;
26 
27  class StorageService;
28 
35  class FileRegistryService : public Service {
36 
37  private:
38  WRENCH_PROPERTY_COLLECTION_TYPE default_property_values = {
42  };
43 
44  WRENCH_MESSAGE_PAYLOADCOLLECTION_TYPE default_messagepayload_values = {
53  };
54 
55  public:
56  // Public Constructor
57  FileRegistryService(std::string hostname,
58  WRENCH_PROPERTY_COLLECTION_TYPE property_list = {},
59  WRENCH_MESSAGE_PAYLOADCOLLECTION_TYPE messagepayload_list = {}
60  );
61 
62  /****************************/
64  /****************************/
65 
66  std::set<std::shared_ptr<FileLocation>> lookupEntry(std::shared_ptr<DataFile>file);
67 
68  std::map<double, std::shared_ptr<FileLocation>> lookupEntry(
69  std::shared_ptr<DataFile>file, std::string reference_host,
70  std::shared_ptr <NetworkProximityService> network_proximity_service);
71 
72  void addEntry(std::shared_ptr<DataFile>file, std::shared_ptr <FileLocation> location);
73 
74  void removeEntry(std::shared_ptr<DataFile>file, std::shared_ptr <FileLocation> location);
75 
76  /****************************/
78  /****************************/
79 
80 
81  /****************************/
83  /****************************/
84 
85  ~FileRegistryService() override;
86  /****************************/
88  /****************************/
89 
90  private:
91  friend class Simulation;
92 
93  void addEntryToDatabase(std::shared_ptr<DataFile>file, std::shared_ptr <FileLocation> location);
94 
95  bool removeEntryFromDatabase(std::shared_ptr<DataFile>file, std::shared_ptr <FileLocation> location);
96 
97  int main() override;
98 
99  bool processNextMessage();
100 
101  std::map<std::shared_ptr<DataFile>, std::set < std::shared_ptr < FileLocation>>>
102  entries;
103  };
104 
105 };
106 
107 #endif //WRENCH_FILEREGISTRYSERVICE_H
wrench::FileRegistryServiceMessagePayload::ADD_ENTRY_ANSWER_MESSAGE_PAYLOAD
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
wrench::FileRegistryServiceMessagePayload::REMOVE_ENTRY_REQUEST_MESSAGE_PAYLOAD
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
wrench::FileRegistryServiceProperty::LOOKUP_COMPUTE_COST
static const std::string LOOKUP_COMPUTE_COST
The computational cost, in flops, of looking entries for a file.
Definition: FileRegistryServiceProperty.h:28
wrench::ServiceMessagePayload::DAEMON_STOPPED_MESSAGE_PAYLOAD
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:37
wrench::FileRegistryServiceProperty::ADD_ENTRY_COMPUTE_COST
static const std::string ADD_ENTRY_COMPUTE_COST
The computational cost, in flops, of adding, an entry for a file.
Definition: FileRegistryServiceProperty.h:34
wrench::FileRegistryService::lookupEntry
std::set< std::shared_ptr< FileLocation > > lookupEntry(std::shared_ptr< DataFile >file)
Lookup entries for a file.
Definition: FileRegistryService.cpp:61
wrench::FileRegistryService
A file registry service (a.k.a. replica catalog) that holds a database of which files are available a...
Definition: FileRegistryService.h:35
wrench::FileRegistryServiceMessagePayload::FILE_LOOKUP_ANSWER_MESSAGE_PAYLOAD
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
wrench::FileRegistryServiceMessagePayload::REMOVE_ENTRY_ANSWER_MESSAGE_PAYLOAD
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
wrench
Definition: Action.cpp:28
wrench::FileRegistryServiceMessagePayload::FILE_LOOKUP_REQUEST_MESSAGE_PAYLOAD
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
wrench::FileRegistryServiceMessagePayload::ADD_ENTRY_REQUEST_MESSAGE_PAYLOAD
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
wrench::ServiceMessagePayload::STOP_DAEMON_MESSAGE_PAYLOAD
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:35
wrench::FileRegistryService::FileRegistryService
FileRegistryService(std::string hostname, WRENCH_PROPERTY_COLLECTION_TYPE property_list={}, WRENCH_MESSAGE_PAYLOADCOLLECTION_TYPE messagepayload_list={})
Constructor.
Definition: FileRegistryService.cpp:38
wrench::Simulation
A class that provides basic simulation methods. Once the simulation object has been explicitly or imp...
Definition: Simulation.h:48
wrench::FileRegistryServiceProperty::REMOVE_ENTRY_COMPUTE_COST
static const std::string REMOVE_ENTRY_COMPUTE_COST
The computational cost, in flops, of removing an entry for a file.
Definition: FileRegistryServiceProperty.h:40
wrench::Service
A service that can be added to the simulation and that can be used by a WMS when executing a workflow...
Definition: Service.h:31
wrench::FileRegistryService::addEntry
void addEntry(std::shared_ptr< DataFile >file, std::shared_ptr< FileLocation > location)
Add an entry.
Definition: FileRegistryService.cpp:166
wrench::FileRegistryService::removeEntry
void removeEntry(std::shared_ptr< DataFile >file, std::shared_ptr< FileLocation > location)
Remove an entry.
Definition: FileRegistryService.cpp:210