File indexing completed on 2024-05-11 03:33:55
0001 #ifndef CondCore_HDF5ESSource_HDF5ProductResolver_h
0002 #define CondCore_HDF5ESSource_HDF5ProductResolver_h
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024 #include "FWCore/Framework/interface/ESSourceProductResolverBase.h"
0025 #include "CondFormats/SerializationHelper/interface/SerializationHelperBase.h"
0026 #include "Record.h"
0027 #include "DataProduct.h"
0028 #include "h5_File.h"
0029 #include "Compression.h"
0030
0031
0032 namespace edm {
0033 class SerialTaskQueue;
0034 }
0035
0036 class HDF5ProductResolver : public edm::eventsetup::ESSourceProductResolverBase {
0037 public:
0038 HDF5ProductResolver(edm::SerialTaskQueue* iQueue,
0039 std::unique_ptr<cond::serialization::SerializationHelperBase>,
0040 cms::h5::File const* iFile,
0041 std::string const& iFileName,
0042 cond::hdf5::Compression iCompression,
0043 cond::hdf5::Record const* iRecord,
0044 cond::hdf5::DataProduct const* iDataProduct);
0045 ~HDF5ProductResolver() override;
0046
0047 HDF5ProductResolver(const HDF5ProductResolver&) = delete;
0048 const HDF5ProductResolver& operator=(const HDF5ProductResolver&) = delete;
0049
0050 private:
0051 void prefetchAsyncImpl(edm::WaitingTaskHolder iTask,
0052 edm::eventsetup::EventSetupRecordImpl const& iES,
0053 edm::eventsetup::DataKey const& iKey,
0054 edm::EventSetupImpl const*,
0055 edm::ServiceToken const&,
0056 edm::ESParentContext const&) noexcept final;
0057
0058 void invalidateCache() final;
0059 void prefetch(edm::eventsetup::DataKey const& iKey, edm::EventSetupRecordDetails) final;
0060 void const* getAfterPrefetchImpl() const final;
0061
0062 std::ptrdiff_t indexForInterval(edm::ValidityInterval const& iIOV) const;
0063
0064 void readFromHDF5api(std::ptrdiff_t iIndex);
0065 void threadFriendlyPrefetch(uint64_t iFileOffset,
0066 std::size_t iStorageSize,
0067 std::size_t iMemSize,
0068 const std::string& iType);
0069
0070 std::vector<char> decompress_zlib(std::vector<char>, std::size_t iMemSize) const;
0071 std::vector<char> decompress_lzma(std::vector<char>, std::size_t iMemSize) const;
0072
0073 edm::SerialTaskQueue* queue_;
0074 cond::serialization::unique_void_ptr data_;
0075 std::unique_ptr<cond::serialization::SerializationHelperBase> helper_;
0076 cms::h5::File const* file_;
0077 std::string fileName_;
0078 cond::hdf5::Record const* record_;
0079 cond::hdf5::DataProduct const* dataProduct_;
0080 cond::hdf5::Compression compression_;
0081
0082
0083 uint64_t fileOffset_;
0084 std::string type_;
0085 std::size_t storageSize_;
0086 std::size_t memSize_;
0087 std::exception_ptr exceptPtr_;
0088 };
0089
0090 #endif