-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
62 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
modyn/storage/include/internal/file_wrapper/file_wrapper_utils.hpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#pragma once | ||
|
||
#include "internal/file_wrapper/binary_file_wrapper.hpp" | ||
#include "internal/file_wrapper/file_wrapper.hpp" | ||
#include "internal/file_wrapper/single_sample_file_wrapper.hpp" | ||
#include "internal/utils/utils.hpp" | ||
|
||
namespace storage::file_wrapper { | ||
|
||
static std::unique_ptr<FileWrapper> get_file_wrapper(const std::string& path, const FileWrapperType& type, | ||
const YAML::Node& file_wrapper_config, | ||
const std::shared_ptr<FilesystemWrapper>& filesystem_wrapper) { | ||
ASSERT(filesystem_wrapper != nullptr, "Filesystem wrapper is nullptr"); | ||
ASSERT(!path.empty(), "Path is empty"); | ||
ASSERT(filesystem_wrapper->exists(path), "Path does not exist"); | ||
|
||
std::unique_ptr<FileWrapper> file_wrapper; | ||
if (type == FileWrapperType::BINARY) { | ||
file_wrapper = std::make_unique<BinaryFileWrapper>(path, file_wrapper_config, filesystem_wrapper); | ||
} else if (type == FileWrapperType::SINGLE_SAMPLE) { | ||
file_wrapper = std::make_unique<SingleSampleFileWrapper>(path, file_wrapper_config, filesystem_wrapper); | ||
} else { | ||
FAIL("Unknown file wrapper type"); | ||
} | ||
return file_wrapper; | ||
} | ||
} // namespace storage::file_wrapper |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
modyn/storage/include/internal/filesystem_wrapper/filesystem_wrapper_utils.hpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#pragma once | ||
|
||
#include "internal/filesystem_wrapper/filesystem_wrapper.hpp" | ||
#include "internal/filesystem_wrapper/local_filesystem_wrapper.hpp" | ||
#include "internal/utils/utils.hpp" | ||
|
||
namespace storage::filesystem_wrapper { | ||
|
||
static std::shared_ptr<FilesystemWrapper> get_filesystem_wrapper(const std::string& path, | ||
const FilesystemWrapperType& type) { | ||
std::shared_ptr<FilesystemWrapper> filesystem_wrapper; | ||
if (type == FilesystemWrapperType::LOCAL) { | ||
filesystem_wrapper = std::make_shared<LocalFilesystemWrapper>(path); | ||
} else { | ||
FAIL("Unknown filesystem wrapper type"); | ||
} | ||
return filesystem_wrapper; | ||
} | ||
} // namespace storage::filesystem_wrapper |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters