feat(cpp-object-oriented-modular-refactoring): step 23 - hdf5-writer-modules
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
#ifndef FESA_IO_HDF5_HDF5_ATOMIC_FILE_H_
|
||||
#define FESA_IO_HDF5_HDF5_ATOMIC_FILE_H_
|
||||
|
||||
#include <filesystem>
|
||||
|
||||
#include "fesa/core/status.h"
|
||||
|
||||
namespace fesa::hdf5_internal {
|
||||
|
||||
/// @brief Removes an uncommitted same-directory candidate on failure.
|
||||
class CandidateFileGuard {
|
||||
public:
|
||||
explicit CandidateFileGuard(std::filesystem::path path);
|
||||
CandidateFileGuard(const CandidateFileGuard&) = delete;
|
||||
CandidateFileGuard& operator=(const CandidateFileGuard&) = delete;
|
||||
~CandidateFileGuard();
|
||||
|
||||
void Release() noexcept;
|
||||
|
||||
private:
|
||||
std::filesystem::path path_;
|
||||
bool active_{true};
|
||||
};
|
||||
|
||||
/// @brief Selects a unique same-directory candidate path.
|
||||
std::filesystem::path MakeCandidatePath(
|
||||
const std::filesystem::path& output_path);
|
||||
|
||||
/// @brief Publishes only a successfully self-checked candidate.
|
||||
/// @note Validation failure removes the candidate and preserves any final.
|
||||
Status AtomicFinalizeValidatedCandidate(
|
||||
const std::filesystem::path& candidate_path,
|
||||
const std::filesystem::path& output_path, const Status& validation);
|
||||
|
||||
} // namespace fesa::hdf5_internal
|
||||
|
||||
#endif // FESA_IO_HDF5_HDF5_ATOMIC_FILE_H_
|
||||
Reference in New Issue
Block a user