11 #ifndef WRENCH_STORAGESERVICE_H
12 #define WRENCH_STORAGESERVICE_H
18 #include "wrench/services/Service.h"
19 #include "wrench/failure_causes/FailureCause.h"
20 #include "wrench/services/file_registry/FileRegistryService.h"
21 #include "wrench/job/StandardJob.h"
22 #include "wrench/services/storage/storage_helpers/LogicalFileSystem.h"
23 #include "wrench/services/storage/storage_helpers/FileLocation.h"
31 class FileRegistryService;
56 static bool lookupFile(std::shared_ptr<DataFile>file, std::shared_ptr<FileLocation> location);
57 static void deleteFile(std::shared_ptr<DataFile>file, std::shared_ptr<FileLocation> location,
58 std::shared_ptr<FileRegistryService> file_registry_service =
nullptr);
59 static void readFile(std::shared_ptr<DataFile>file, std::shared_ptr<FileLocation> location);
60 static void readFile(std::shared_ptr<DataFile>file, std::shared_ptr<FileLocation> location,
double num_bytes);
61 static void writeFile(std::shared_ptr<DataFile>file, std::shared_ptr<FileLocation> location);
62 static void createFile(std::shared_ptr<DataFile>file, std::shared_ptr<FileLocation> location);
71 static void copyFile(std::shared_ptr<DataFile>file,
72 std::shared_ptr<FileLocation> src_location,
73 std::shared_ptr<FileLocation> dst_location);
77 std::shared_ptr<DataFile>file,
78 std::shared_ptr<FileLocation> src_location,
79 std::shared_ptr<FileLocation> dst_location);
81 static void readFiles(std::map<std::shared_ptr<DataFile>, std::shared_ptr<FileLocation>> locations);
83 static void writeFiles(std::map<std::shared_ptr<DataFile>, std::shared_ptr<FileLocation>> locations);
87 const std::set<std::string> mount_points,
88 const std::string &service_name);
96 static void stageFile(std::shared_ptr<DataFile>file , std::shared_ptr<FileLocation> location);
102 std::map<std::string, std::unique_ptr<LogicalFileSystem>>
file_systems;
115 static void writeOrReadFiles(FileOperation action,
116 std::map<std::shared_ptr<DataFile>, std::shared_ptr<FileLocation>> locations);
118 void stageFile(std::shared_ptr<DataFile>file , std::string mountpoint, std::string directory);
132 #endif //WRENCH_STORAGESERVICE_H
static void writeFiles(std::map< std::shared_ptr< DataFile >, std::shared_ptr< FileLocation >> locations)
Synchronously and sequentially upload a set of files from storage services.
Definition: StorageService.cpp:451
static void deleteFile(std::shared_ptr< DataFile >file, std::shared_ptr< FileLocation > location, std::shared_ptr< FileRegistryService > file_registry_service=nullptr)
Synchronously delete a file at a location.
Definition: StorageService.cpp:515
std::string getMountPoint()
Get the mount point (will throw is more than one)
Definition: StorageService.cpp:684
StorageService(const std::string &hostname, const std::set< std::string > mount_points, const std::string &service_name)
Constructor.
Definition: StorageService.cpp:39
static void initiateFileCopy(simgrid::s4u::Mailbox *answer_mailbox, std::shared_ptr< DataFile >file, std::shared_ptr< FileLocation > src_location, std::shared_ptr< FileLocation > dst_location)
Asynchronously ask for a file copy between two storage services.
Definition: StorageService.cpp:637
static void writeFile(std::shared_ptr< DataFile >file, std::shared_ptr< FileLocation > location)
Synchronously write a file to the storage service.
Definition: StorageService.cpp:354
A file registry service (a.k.a. replica catalog) that holds a database of which files are available a...
Definition: FileRegistryService.h:35
bool hasMultipleMountPoints()
Checked whether the storage service has multiple mount points.
Definition: StorageService.cpp:708
A helper class that implements the concept of a communication thread that performs a file transfer.
Definition: FileTransferThread.h:31
void setScratch()
Indicate that this storace service is a scratch service of a ComputeService.
Definition: StorageService.cpp:71
std::set< std::string > getMountPoints()
Get the set of mount points.
Definition: StorageService.cpp:696
The storage service base class.
Definition: StorageService.h:36
static void readFile(std::shared_ptr< DataFile >file, std::shared_ptr< FileLocation > location)
Synchronously read a file from the storage service.
Definition: StorageService.cpp:231
Definition: Action.cpp:28
virtual std::map< std::string, double > getTotalSpace()
Get the total static capacity of the storage service (in zero simulation time)
Definition: StorageService.cpp:672
bool hasMountPoint(std::string mp)
Checked whether the storage service has a particular mount point.
Definition: StorageService.cpp:718
static void createFile(std::shared_ptr< DataFile >file, std::shared_ptr< FileLocation > location)
Store a file at a particular mount point ex nihilo (this instantly creates the file at the storage se...
Definition: StorageService.cpp:85
static void stageFile(std::shared_ptr< DataFile >file, std::shared_ptr< FileLocation > location)
Store a file at a particular mount point BEFORE the simulation is launched.
Definition: StorageService.cpp:99
void stop() override
Stop the service.
Definition: StorageService.cpp:123
static bool lookupFile(std::shared_ptr< DataFile >file, std::shared_ptr< FileLocation > location)
Synchronously asks the storage service whether it holds a file.
Definition: StorageService.cpp:183
bool isScratch()
Determines whether the storage service is a scratch service of a ComputeService.
Definition: StorageService.cpp:64
static void readFiles(std::map< std::shared_ptr< DataFile >, std::shared_ptr< FileLocation >> locations)
Synchronously and sequentially read a set of files from storage services.
Definition: StorageService.cpp:439
static void copyFile(std::shared_ptr< DataFile >file, std::shared_ptr< FileLocation > src_location, std::shared_ptr< FileLocation > dst_location)
Synchronously ask the storage service to read a file from another storage service.
Definition: StorageService.cpp:576
virtual std::map< std::string, double > getFreeSpace()
Synchronously asks the storage service for its capacity at all its mount points.
Definition: StorageService.cpp:142
unsigned long buffer_size
The service's buffer size.
Definition: StorageService.h:99
std::string hostname
The name of the host on which the daemon is running.
Definition: S4U_Daemon.h:60
A class that provides basic simulation methods. Once the simulation object has been explicitly or imp...
Definition: Simulation.h:48
std::map< std::string, std::unique_ptr< LogicalFileSystem > > file_systems
File systems.
Definition: StorageService.h:102
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