diff --git a/src/OutputFile.h b/src/OutputFile.h index 0c6334d7207404ef5f6fd7d2b303e797588826c9..2b1cf30577a185e77c4d806565b6f918a1542685 100644 --- a/src/OutputFile.h +++ b/src/OutputFile.h @@ -234,75 +234,4 @@ class FileOutput : public Output { std::string destination_path_; }; -class DaxOutput : public Output { - public: - using HeaderType = FRDFileHeader_v2; - using HandleType = int; - uint64_t kHugePage = 2097152; // 2MiB - uint64_t kFileSize = 100 * kHugePage; - - off_t header_address_{}; - off_t page_offset_{}; - - off_t buffer_offset_ = kHugePage * 10; - - void* buffer_{nullptr}; - - bool IsOpen() const { return (std::get<HandleType>(handle_) >= 0); } - - auto Open() -> bool { - int fd; - auto ret = open("/dev/dax1.0", O_RDWR); - if (ret >= 0) { - // Memory map a file segment - buffer_ = mmap(NULL, buffer_offset_, PROT_WRITE, MAP_SHARED, fd, page_offset_); - handle_ = fd; - } - return IsOpen(); - } - - auto Close() -> bool { - auto ret = close(std::get<HandleType>(handle_)); - if (ret != 0) { - LOG(ERROR) << tools::strerror("DAX close failed"); - } - return ret == 0; - } - - int WriteAt(const char*& data, size_t size_bytes, std::optional<off_t> abs_seek) { - if (abs_seek.has_value()) { - memcpy(&(((char*)(buffer_))[abs_seek.value()]), data, size_bytes); - // lseek(std::get<int>(handle_), abs_seek.value(), SEEK_SET); - // page_offset_ = abs_seek.value(); - } - return size_bytes; - } - - int Write(const char*& data, size_t size_bytes, uint32_t size_orbits) { - if (md_.size + size_bytes > kFileSize) { - return 0; - } else { - // size_t ret = write(std::get<int>(handle_), data, size_bytes); - memcpy(buffer_, data, size_bytes); - // assert(ret == size_bytes); - - md_.AddOrbits(size_orbits, size_bytes); - return size_bytes; - } - } - - std::string GetIdentifier() const { - return "dax1.0_" + std::to_string(buffer_offset_) + "_" + std::to_string(page_offset_); - } - void ReserveHeader() { - assert(md_.size == 0); - reserved_header_ = true; - md_.size = sizeof(HeaderType); - header_ = {}; - - header_address_ = page_offset_; - page_offset_ += sizeof(HeaderType); - } -}; - #endif \ No newline at end of file diff --git a/src/OutputFileHandler.h b/src/OutputFileHandler.h index fdb1575316428a79b81ffd88034dc6f1eb9d67a1..2d9b4a73017f191846ede0e23f346116b1ef1e30 100644 --- a/src/OutputFileHandler.h +++ b/src/OutputFileHandler.h @@ -22,11 +22,7 @@ struct FileLocator { filename_suffix(std::move(suf)) {} }; -#ifdef DAX_MODE -using OutputType = DaxOutput; -#else using OutputType = FileOutput; -#endif class OutputFileHandler { public: diff --git a/src/sink.cc b/src/sink.cc index fbff4ad4680f7427fc2ac52bc186ca18db22f13a..5555cbc48e0eaa6e9e2fffa4b16fc29b02c8be1e 100644 --- a/src/sink.cc +++ b/src/sink.cc @@ -6,7 +6,6 @@ #include "sink.h" template class Sink<FileOutput>; -template class Sink<DaxOutput>; template <typename TOutput> tbb::concurrent_bounded_queue<TOutput> Sink<TOutput>::commit_queue_ = @@ -49,8 +48,6 @@ void Sink<TOutput>::CommitOutput(TOutput &f) { WriteLumisectionFooter(run_number, ls_meta); file.run_metrics_->AddLumisectionMetadata(ls_meta); } - } else if constexpr (std::is_same<TOutput, DaxOutput>()) { - LOG(TRACE) << "Committing current DAX buffer"; } else { throw std::invalid_argument("Not a valid input type"); } @@ -65,13 +62,3 @@ void Sink<FileOutput>::WriteMetadata(std::string &&sub_path, std::string &&conte md_stream << content; md_stream.close(); } - -template <> -void Sink<DaxOutput>::WriteMetadata(std::string &&sub_path, std::string &&content) { - sub_path.insert(0, root_path_); - - std::fstream md_stream; - md_stream.open(sub_path.c_str(), std::ios_base::out); - md_stream << content; - md_stream.close(); -} \ No newline at end of file