45 std::unique_ptr<cond::serialization::SerializationHelperBase> iHelper,
57 dataProduct_(iDataProduct),
58 compression_(iCompression) {}
77 prefetchAsyncImplTemplate(
78 [
this, iov = iRecord.validityInterval(), iParent, &iRecord](
auto& iGroup,
auto iActivity) {
79 queue_->push(iGroup, [
this, &iGroup, act =
std::move(iActivity), iov, iParent, &iRecord] {
82 reinterpret_cast<std::uintptr_t>(
this),
85 iRecord.activityRegistry()->preESModuleSignal_.emit(iRecord.key(),
context);
89 : record_{iRecord}, context_{iContext} {}
90 ~EndGuard() { record_.activityRegistry()->postESModuleSignal_.emit(record_.key(), context_); }
95 auto index = indexForInterval(iov);
97 readFromHDF5api(
index);
101 exceptPtr_ = std::current_exception();
105 []() {
return true; },
131 memSize_ = ds->findAttribute(
"memsize")->readUInt32();
132 type_ = ds->findAttribute(
"type")->readString();
147 if (iMemSize == compressedBuffer.size()) {
154 strm.zalloc = Z_NULL;
156 strm.opaque = Z_NULL;
158 strm.next_in = Z_NULL;
159 auto ret = inflateInit(&strm);
162 strm.avail_in = compressedBuffer.size();
163 strm.next_in =
reinterpret_cast<unsigned char*
>(compressedBuffer.data());
165 buffer = std::vector<char>(iMemSize);
166 strm.avail_out =
buffer.size();
167 strm.next_out =
reinterpret_cast<unsigned char*
>(
buffer.data());
168 ret = inflate(&strm, Z_FINISH);
173 (
void)inflateEnd(&strm);
180 if (iMemSize == compressedBuffer.size()) {
186 lzma_stream
stream = LZMA_STREAM_INIT;
188 auto returnStatus = lzma_stream_decoder(&
stream, UINT64_MAX, 0
U);
189 if (returnStatus != LZMA_OK) {
190 throw cms::Exception(
"H5CondFailedDecompress") <<
"failed to setup lzma";
193 stream.next_in =
reinterpret_cast<uint8_t*
>(compressedBuffer.data());
194 stream.avail_in = compressedBuffer.size();
196 buffer = std::vector<char>(iMemSize);
197 stream.next_out =
reinterpret_cast<uint8_t*
>(
buffer.data());
200 returnStatus = lzma_code(&
stream, LZMA_FINISH);
202 if (returnStatus != LZMA_STREAM_END) {
203 throw cms::Exception(
"H5CondFailedDecompress") <<
"failed to decompress buffer using lzma";
210 std::size_t iStorageSize,
211 std::size_t iMemSize,
216 std::vector<char> compressedBuffer(iStorageSize);
218 file.seekg(iFileOffset);
219 file.read(compressedBuffer.data(), compressedBuffer.size());
230 std::stringbuf sBuffer;
235 <<
"failed to deserialize: buffer size:" <<
buffer.size() <<
" type: '" << iTypeName <<
"'";
240 ESSourceProductResolverBase::invalidateCache();
~HDF5ProductResolver() override
cond::hdf5::DataProduct const * dataProduct_
void prefetchAsyncImpl(edm::WaitingTaskHolder iTask, edm::eventsetup::EventSetupRecordImpl const &iES, edm::eventsetup::DataKey const &iKey, edm::EventSetupImpl const *, edm::ServiceToken const &, edm::ESParentContext const &) noexcept final
const IOVSyncValue & first() const
std::unique_ptr< cond::serialization::SerializationHelperBase > helper_
std::ptrdiff_t indexForInterval(edm::ValidityInterval const &iIOV) const
ret
prodAgent to be discontinued
HDF5ProductResolver(edm::SerialTaskQueue *iQueue, std::unique_ptr< cond::serialization::SerializationHelperBase >, cms::h5::File const *iFile, std::string const &iFileName, cond::hdf5::Compression iCompression, cond::hdf5::Record const *iRecord, cond::hdf5::DataProduct const *iDataProduct)
std::vector< IOVSyncValue > iovFirsts_
void threadFriendlyPrefetch(uint64_t iFileOffset, std::size_t iStorageSize, std::size_t iMemSize, const std::string &iType)
uint32_t T const *__restrict__ uint32_t const *__restrict__ int32_t int Histo::index_type cudaStream_t stream
const void * get() const noexcept
TEMPL(T2) struct Divides void
void prefetch(edm::eventsetup::DataKey const &iKey, edm::EventSetupRecordDetails) final
std::vector< IOVSyncValue >::const_iterator findMatchingFirst(std::vector< IOVSyncValue > const &iIOVs, IOVSyncValue iMatch)
cond::serialization::unique_void_ptr data_
std::vector< hobj_ref_t > payloadForIOVs_
void readFromHDF5api(std::ptrdiff_t iIndex)
cond::hdf5::Compression compression_
std::exception_ptr exceptPtr_
unsigned long long uint64_t
cond::hdf5::Record const * record_
void const * getAfterPrefetchImpl() const final
IOVSyncValue convertSyncValue(edm::IOVSyncValue const &iFrom, bool iIsRunLumi)
void invalidateCache() final
std::shared_ptr< DataSet > derefDataSet(hobj_ref_t iRef) const
std::vector< char > decompress_lzma(std::vector< char >, std::size_t iMemSize) const
cms::h5::File const * file_
std::vector< char > decompress_zlib(std::vector< char >, std::size_t iMemSize) const