Skip to content

Commit

Permalink
more double removals
Browse files Browse the repository at this point in the history
  • Loading branch information
henricasanova committed Oct 16, 2024
1 parent c1a4b1b commit 3de179c
Show file tree
Hide file tree
Showing 21 changed files with 76 additions and 73 deletions.
12 changes: 6 additions & 6 deletions include/wrench/services/storage/StorageService.h
Original file line number Diff line number Diff line change
Expand Up @@ -407,30 +407,30 @@ namespace wrench {
* @brief Get the storage service's total space (in zero simulated time)
* @return a capacity in bytes
*/
virtual double getTotalSpace() = 0;
virtual sg_size_t getTotalSpace() = 0;

/** Service free space method */
/**
* @brief Get the storage service's total free space (incurs simulated overhead)
* @return a capacity in bytes
*/
virtual double getTotalFreeSpace();
virtual sg_size_t getTotalFreeSpace();

/** Service free space method */
/**
* @brief Get the storage service's free space at a path (incurs simulated overhead)
* @brief path a path
* @return a capacity in bytes
*/
virtual double getTotalFreeSpaceAtPath(const std::string &path);
virtual sg_size_t getTotalFreeSpaceAtPath(const std::string &path);

/** Service free space tracing (doesn't incur simulated overhead) */
/**
* @brief Get the storage service's total free space (no simulated overhead)
* @return Current free space in bytes
*
*/
virtual double getTotalFreeSpaceZeroTime() {
virtual sg_size_t getTotalFreeSpaceZeroTime() {
throw std::runtime_error("StorageService::traceTotalFreeSpace: should have been overridden by derived class");
}

Expand All @@ -440,7 +440,7 @@ namespace wrench {
* @return Current number of registered Datafile for all filesystem(s) from this service
*
*/
virtual double getTotalFilesZeroTime() {
virtual unsigned long getTotalFilesZeroTime() {
throw std::runtime_error("StorageService::traceTotalFiles: should have been overridden by derived class");
}

Expand Down Expand Up @@ -483,7 +483,7 @@ namespace wrench {
* @brief Determine the storage service's buffer size
* @return a size in bytes
*/
virtual double getBufferSize() const = 0;
virtual sg_size_t getBufferSize() const = 0;

/**
* @brief Determines whether the storage service is a scratch service of a ComputeService
Expand Down
12 changes: 6 additions & 6 deletions include/wrench/services/storage/StorageServiceMessage.h
Original file line number Diff line number Diff line change
Expand Up @@ -193,9 +193,9 @@ namespace wrench {
StorageServiceFileWriteAnswerMessage(std::shared_ptr<FileLocation> &location,
bool success,
std::shared_ptr<FailureCause> failure_cause,
std::map<S4U_CommPort *, double> data_write_commport_and_bytes,
std::map<S4U_CommPort *, sg_size_t> data_write_commport_and_bytes,
sg_size_t buffer_size,
double payload);
sg_size_t payload);

/** @brief The file location hould be written */
std::shared_ptr<FileLocation> location;
Expand All @@ -204,7 +204,7 @@ namespace wrench {
/** @brief The cause of the failure, if any, or nullptr */
std::shared_ptr<FailureCause> failure_cause;
/** @brief The set of destination commports and the number of bytes to send to each */
std::map<S4U_CommPort *, double> data_write_commport_and_bytes;
std::map<S4U_CommPort *, sg_size_t> data_write_commport_and_bytes;
/** @brief The buffer size to use */
sg_size_t buffer_size;
};
Expand All @@ -218,7 +218,7 @@ namespace wrench {
simgrid::s4u::Host *requesting_host,
std::shared_ptr<FileLocation> location,
sg_size_t num_bytes_to_read,
double payload);
sg_size_t payload);
StorageServiceFileReadRequestMessage(StorageServiceFileReadRequestMessage &other);
StorageServiceFileReadRequestMessage(StorageServiceFileReadRequestMessage *other);
/** @brief The commport_name to which the answer message should be sent */
Expand All @@ -242,7 +242,7 @@ namespace wrench {
S4U_CommPort *commport_to_receive_the_file_content,
sg_size_t buffer_size,
unsigned long number_of_sources,
double payload);
sg_size_t payload);

/** @brief The location of the file */
std::shared_ptr<FileLocation> location;
Expand All @@ -264,7 +264,7 @@ namespace wrench {
class StorageServiceFileContentChunkMessage : public StorageServiceMessage {
public:
explicit StorageServiceFileContentChunkMessage(std::shared_ptr<DataFile> file,
double chunk_size, bool last_chunk);
sg_size_t chunk_size, bool last_chunk);

/** @brief The file */
std::shared_ptr<DataFile> file;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ namespace wrench {
/** @brief Storage service */
std::shared_ptr<StorageService> service;
/** @brief Free space in byte */
double free_space;
sg_size_t free_space;
/** @brief the file count */
uint64_t file_count;
};
Expand Down Expand Up @@ -128,10 +128,10 @@ namespace wrench {
double getLoad() override;

// Overload StorageService's implementation.
double getTotalSpace() override;
sg_size_t getTotalSpace() override;

// Overload StorageService's implementation.
double getTotalFreeSpaceAtPath(const std::string &path) override;
sg_size_t getTotalFreeSpaceAtPath(const std::string &path) override;

// Overload StorageService's implementation.
void setIsScratch(bool is_scratch) override;
Expand All @@ -148,7 +148,7 @@ namespace wrench {
* @brief Determine the storage service's buffer size
* @return a size in bytes
*/
double getBufferSize() const override {
sg_size_t getBufferSize() const override {
return 0;
}

Expand Down Expand Up @@ -324,7 +324,7 @@ namespace wrench {
* Should usually be user-provided, or will be
* set to the smallest disk size as default.
*/
double max_chunk_size = 0;
sg_size_t max_chunk_size = 0;

/**
* @brief Whether to strip a file in the CSS or in the external allocation function.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ namespace wrench {
*/
class CompoundStorageServiceMessage : public StorageServiceMessage {
protected:
CompoundStorageServiceMessage(double payload);
CompoundStorageServiceMessage(sg_size_t payload);
};

/**
Expand All @@ -38,7 +38,7 @@ namespace wrench {
CompoundStorageAllocationRequestMessage(S4U_CommPort *answer_commport,
std::shared_ptr<DataFile> file,
unsigned int stripe_count,
double payload);
sg_size_t payload);

/** @brief CommPort to which the answer message should be sent */
S4U_CommPort *answer_commport;
Expand All @@ -53,7 +53,7 @@ namespace wrench {
*/
class CompoundStorageAllocationAnswerMessage : public CompoundStorageServiceMessage {
public:
CompoundStorageAllocationAnswerMessage(std::vector<std::shared_ptr<FileLocation>> locations, double payload);
CompoundStorageAllocationAnswerMessage(std::vector<std::shared_ptr<FileLocation>> locations, sg_size_t payload);

/** @brief Known or newly allocated FileLocations for requested file */
std::vector<std::shared_ptr<FileLocation>> locations;
Expand All @@ -64,7 +64,7 @@ namespace wrench {
*/
class CompoundStorageLookupRequestMessage : public CompoundStorageServiceMessage {
public:
CompoundStorageLookupRequestMessage(S4U_CommPort *answer_commport, std::shared_ptr<DataFile> file, double payload);
CompoundStorageLookupRequestMessage(S4U_CommPort *answer_commport, std::shared_ptr<DataFile> file, sg_size_t payload);

/** @brief CommPort to which the answer message should be sent */
S4U_CommPort *answer_commport;
Expand All @@ -77,7 +77,7 @@ namespace wrench {
*/
class CompoundStorageLookupAnswerMessage : public CompoundStorageServiceMessage {
public:
CompoundStorageLookupAnswerMessage(std::vector<std::shared_ptr<FileLocation>> locations, double payload);
CompoundStorageLookupAnswerMessage(std::vector<std::shared_ptr<FileLocation>> locations, sg_size_t payload);

/** @brief Known FileLocations for requested file */
std::vector<std::shared_ptr<FileLocation>> locations;
Expand Down
6 changes: 3 additions & 3 deletions include/wrench/services/storage/proxy/StorageServiceProxy.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ namespace wrench {
using StorageService::writeFile;


double getTotalSpace() override;
double getTotalFreeSpaceAtPath(const std::string &path) override;
sg_size_t getTotalSpace() override;
sg_size_t getTotalFreeSpaceAtPath(const std::string &path) override;

/**
* @brief Return the storage service's default mountpoint, if any.
Expand Down Expand Up @@ -84,7 +84,7 @@ namespace wrench {

bool isBufferized() const override;//cache

double getBufferSize() const override;//cache
sg_size_t getBufferSize() const override;//cache

bool hasFile(const std::shared_ptr<FileLocation> &location) override;

Expand Down
8 changes: 4 additions & 4 deletions include/wrench/services/storage/simple/SimpleStorageService.h
Original file line number Diff line number Diff line change
Expand Up @@ -102,11 +102,11 @@ namespace wrench {
bool hasMultipleMountPoints();
bool hasMountPoint(const std::string &mp);

double getTotalSpace() override;
sg_size_t getTotalSpace() override;

double getTotalFreeSpaceZeroTime() override;
sg_size_t getTotalFreeSpaceZeroTime() override;

double getTotalFilesZeroTime() override;
unsigned long getTotalFilesZeroTime() override;

std::string getBaseRootPath() override;

Expand Down Expand Up @@ -192,7 +192,7 @@ namespace wrench {
* @brief Determine the storage service's buffer size
* @return a size in bytes
*/
double getBufferSize() const override {
sg_size_t getBufferSize() const override {
return this->buffer_size;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ namespace wrench {
/** \cond INTERNAL **/
/***********************/
void cleanup(bool has_returned_from_main, int return_value) override;
double countRunningFileTransferThreads();
unsigned long countRunningFileTransferThreads();

/***********************/
/** \endcond **/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ namespace wrench {
/** @brief commport_name to report to */
S4U_CommPort *commport;
/** @brief transfer size */
double transfer_size;
sg_size_t transfer_size;
/** @brief SG IO op */
simgrid::s4u::IoPtr stream;

Expand Down Expand Up @@ -89,7 +89,7 @@ namespace wrench {
simgrid::s4u::Host *dst_host,
simgrid::s4u::Disk *dst_disk,
S4U_CommPort *commport,
double transfer_size) : src_location(std::move(src_location)), src_opened_file(std::move(src_opened_file)),
sg_size_t transfer_size) : src_location(std::move(src_location)), src_opened_file(std::move(src_opened_file)),
src_host(src_host), src_disk(src_disk),
dst_location(std::move(dst_location)), dst_opened_file(std::move(dst_opened_file)),
dst_host(dst_host), dst_disk(dst_disk),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ namespace wrench {
* @brief Constructor
* @param payload: the message payload
*/
FileTransferThreadMessage(double payload) : ServiceMessage(payload) {}
FileTransferThreadMessage(sg_size_t payload) : ServiceMessage(payload) {}
};


Expand Down
4 changes: 2 additions & 2 deletions include/wrench/services/storage/xrootd/Node.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,9 @@ namespace wrench {

virtual double getFileLastWriteDate(const std::shared_ptr<FileLocation> &location) override;

virtual double getTotalSpace() override;
virtual sg_size_t getTotalSpace() override;
virtual bool isBufferized() const override;
virtual double getBufferSize() const override;
virtual sg_size_t getBufferSize() const override;
virtual bool reserveSpace(std::shared_ptr<FileLocation> &location) override;
virtual void unreserveSpace(std::shared_ptr<FileLocation> &location) override;

Expand Down
4 changes: 2 additions & 2 deletions src/wrench/services/storage/StorageService.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ namespace wrench {
* @return A number of bytes
*
*/
double StorageService::getTotalFreeSpace() {
sg_size_t StorageService::getTotalFreeSpace() {
return getTotalFreeSpaceAtPath("");
}

Expand All @@ -184,7 +184,7 @@ namespace wrench {
*
* @return A number of bytes (or 0 if the path is invalid)
*/
double StorageService::getTotalFreeSpaceAtPath(const std::string &path) {
sg_size_t StorageService::getTotalFreeSpaceAtPath(const std::string &path) {
assertServiceIsUp();

// Send a message to the daemon
Expand Down
10 changes: 5 additions & 5 deletions src/wrench/services/storage/StorageServiceMessage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -248,9 +248,9 @@ namespace wrench {
StorageServiceFileWriteAnswerMessage::StorageServiceFileWriteAnswerMessage(std::shared_ptr<FileLocation> &location,
bool success,
std::shared_ptr<FailureCause> failure_cause,
std::map<S4U_CommPort *, double> data_write_commports_and_bytes,
std::map<S4U_CommPort *, sg_size_t> data_write_commports_and_bytes,
sg_size_t buffer_size,
double payload) : StorageServiceMessage(payload) {
sg_size_t payload) : StorageServiceMessage(payload) {
#ifdef WRENCH_INTERNAL_EXCEPTIONS
if ((location == nullptr) ||
(success && (data_write_commport == nullptr)) ||
Expand Down Expand Up @@ -281,7 +281,7 @@ namespace wrench {
simgrid::s4u::Host *requesting_host,
std::shared_ptr<FileLocation> location,
sg_size_t num_bytes_to_read,
double payload) : StorageServiceMessage(payload) {
sg_size_t payload) : StorageServiceMessage(payload) {

#ifdef WRENCH_INTERNAL_EXCEPTIONS

Expand Down Expand Up @@ -330,7 +330,7 @@ namespace wrench {
S4U_CommPort *commport_to_receive_the_file_content,
sg_size_t buffer_size,
unsigned long number_of_sources,
double payload) : StorageServiceMessage(payload) {
sg_size_t payload) : StorageServiceMessage(payload) {
#ifdef WRENCH_INTERNAL_EXCEPTIONS
if ((location == nullptr) ||
(success && (failure_cause != nullptr)) || (!success && (failure_cause == nullptr))) {
Expand All @@ -354,7 +354,7 @@ namespace wrench {
* @param last_chunk: whether this is the last chunk in the file
*/
StorageServiceFileContentChunkMessage::StorageServiceFileContentChunkMessage(
std::shared_ptr<DataFile> file, double chunk_size, bool last_chunk) : StorageServiceMessage(chunk_size) {
std::shared_ptr<DataFile> file, sg_size_t chunk_size, bool last_chunk) : StorageServiceMessage(chunk_size) {
#ifdef WRENCH_INTERNAL_EXCEPTIONS
if (file == nullptr) {
throw std::invalid_argument(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -958,7 +958,7 @@ namespace wrench {
// this->traceInternalStorageUse(IOAction::WriteEnd, designated_locations_subset);

for (const auto &loc: designated_locations_subset) {
WRENCH_DEBUG("CSS::writeFile(): For location %s, free space = %f", loc->getStorageService()->getName().c_str(), loc->getStorageService()->getTotalFreeSpace());
WRENCH_DEBUG("CSS::writeFile(): For location %s, free space = %llu", loc->getStorageService()->getName().c_str(), loc->getStorageService()->getTotalFreeSpace());
}

WRENCH_INFO("CSS::writeFile(): All writes done and ack");
Expand Down Expand Up @@ -1125,9 +1125,9 @@ namespace wrench {
*
* @return A number of bytes
*/
double CompoundStorageService::getTotalSpace() {
sg_size_t CompoundStorageService::getTotalSpace() {
// WRENCH_INFO("CompoundStorageService::getTotalSpace");
double free_space = 0.0;
sg_size_t free_space = 0.0;
for (const auto &storage_server: this->storage_services) {
for (const auto &service: storage_server.second) {
free_space += service->getTotalSpace();
Expand All @@ -1145,7 +1145,7 @@ namespace wrench {
* @return The free space in bytes at the path
*
*/
double CompoundStorageService::getTotalFreeSpaceAtPath(const std::string &path) {
sg_size_t CompoundStorageService::getTotalFreeSpaceAtPath(const std::string &path) {
WRENCH_DEBUG("CSS::getFreeSpace Forwarding request to internal services");

double free_space = 0.0;
Expand Down
Loading

0 comments on commit 3de179c

Please sign in to comment.