Skip to content

Commit 18d45e7

Browse files
committed
Throwing std::invalid_argument when doing some_service->read/writeFile(LOCATION(some_other_service,...))
1 parent 7f22d7c commit 18d45e7

File tree

6 files changed

+11
-467
lines changed

6 files changed

+11
-467
lines changed

CMakeLists.txt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -266,8 +266,6 @@ set(SOURCE_FILES
266266
include/wrench/services/compute/batch/batch_schedulers/BatchScheduler.h
267267
include/wrench/services/compute/batch/batch_schedulers/homegrown/HomegrownBatchScheduler.h
268268
include/wrench/services/storage/storage_helpers/FileTransferThread.h
269-
include/wrench/services/storage/storage_helpers/LogicalFileSystemNoCaching.h
270-
include/wrench/services/storage/storage_helpers/LogicalFileSystemLRUCaching.h
271269
src/wrench/logging/TerminalOutput.cpp
272270
src/wrench/managers/data_movement_manager/DataMovementManager.cpp
273271
src/wrench/managers/data_movement_manager/DataMovementManagerMessage.cpp
@@ -461,9 +459,9 @@ set(TEST_FILES
461459
test/services/compute_services/bare_metal_compound_jobs/BareMetalComputeServiceMultiActionTests.cpp
462460
test/services/compute_services/bare_metal_compound_jobs/BareMetalComputeServiceMultiJobTests.cpp
463461
test/services/compute_services/bare_metal_standard_jobs/BareMetalComputeServiceOneTaskTest.cpp
464-
test/services/storage_services/LogicalFileSystem/LogicalFileSystemTest.cpp
465462
test/services/storage_services/SimpleStorageService/SimpleStorageServiceCachingTest.cpp
466463
test/services/storage_services/SimpleStorageService/SimpleStorageServiceFunctionalTest.cpp
464+
test/services/storage_services/SimpleStorageService/SimpleStorageServiceWrongServiceTest.cpp
467465
test/services/storage_services/SimpleStorageService/SimpleStorageServicePerformanceTest.cpp
468466
test/services/storage_services/SimpleStorageService/SimpleStorageServiceLimitedConnectionsTest.cpp
469467
test/services/storage_services/SimpleStorageService/StorageServiceDeleteRegisterTest.cpp

include/wrench/services/storage/storage_helpers/LogicalFileSystemLRUCaching.h

Lines changed: 0 additions & 112 deletions
This file was deleted.

include/wrench/services/storage/storage_helpers/LogicalFileSystemNoCaching.h

Lines changed: 0 additions & 75 deletions
This file was deleted.

src/wrench/services/storage/StorageService.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,10 @@ namespace wrench {
110110
throw std::invalid_argument("StorageService::writeFile(): Invalid arguments");
111111
}
112112

113+
if (location->getStorageService() != this->getSharedPtr<StorageService>()) {
114+
throw std::invalid_argument("StorageService::writeFile(): Can only read from a location at that same storage service");
115+
}
116+
113117
this->assertServiceIsUp();
114118

115119
this->commport->putMessage(
@@ -249,6 +253,10 @@ namespace wrench {
249253
throw std::invalid_argument("StorageService::readFile(): Invalid nullptr/0 arguments");
250254
}
251255

256+
if (location->getStorageService() != this->getSharedPtr<StorageService>()) {
257+
throw std::invalid_argument("StorageService::readFile(): Can only read from a location at that same storage service");
258+
}
259+
252260
assertServiceIsUp(this->getSharedPtr<Service>());
253261

254262
this->commport->putMessage(

0 commit comments

Comments
 (0)