Skip to content

Commit 043b63b

Browse files
committed
Fixed a bug on store all in memory. now when called all files created also after the call to the method are stored in memory
1 parent 584c522 commit 043b63b

2 files changed

Lines changed: 11 additions & 2 deletions

File tree

capiocl.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ inline void print_message(const std::string &message_type = "",
7878
class Engine {
7979
friend class capiocl::Serializer;
8080
std::string node_name;
81+
bool store_all_in_memory;
8182

8283
/**
8384
* Hash map used to store the configuration from CAPIO-CL

src/Engine.cpp

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,8 @@ void capiocl::Engine::add(std::string &path, std::vector<std::string> &producers
133133
const std::string &fire_rule, bool permanent, bool exclude,
134134
const std::vector<std::string> &dependencies) {
135135
_locations.emplace(path, std::make_tuple(producers, consumers, commit_rule, fire_rule,
136-
permanent, exclude, true, 0, 0, dependencies, false));
136+
permanent, exclude, true, 0, 0, dependencies,
137+
false | this->store_all_in_memory));
137138
}
138139

139140
void capiocl::Engine::newFile(const std::string &path) {
@@ -444,6 +445,7 @@ void capiocl::Engine::setStoreFileInMemory(const std::filesystem::path &path) {
444445
}
445446

446447
void capiocl::Engine::setAllStoreInMemory() {
448+
this->store_all_in_memory = true;
447449
for (const auto &[fst, snd] : _locations) {
448450
this->setStoreFileInMemory(fst);
449451
}
@@ -459,9 +461,15 @@ void capiocl::Engine::setStoreFileInFileSystem(const std::filesystem::path &path
459461
}
460462

461463
bool capiocl::Engine::isStoredInMemory(const std::filesystem::path &path) {
464+
465+
if (this->store_all_in_memory) {
466+
return true;
467+
}
468+
462469
if (const auto itm = _locations.find(path); itm != _locations.end()) {
463470
return std::get<10>(itm->second);
464471
}
472+
465473
this->newFile(path);
466474
return isStoredInMemory(path);
467475
}
@@ -470,7 +478,7 @@ std::vector<std::string> capiocl::Engine::getFileToStoreInMemory() {
470478
std::vector<std::string> files;
471479

472480
for (const auto &[path, file] : _locations) {
473-
if (std::get<10>(file)) {
481+
if (std::get<10>(file) || this->store_all_in_memory) {
474482
files.push_back(path);
475483
}
476484
}

0 commit comments

Comments
 (0)