@@ -1131,10 +1131,22 @@ std::optional<std::deque<uint64_t> > Series::readGorVBased(bool do_init)
11311131 IOHandler ()->enqueue (IOTask (&series.iterations , pOpen));
11321132
11331133 readAttributes (ReadMode::IgnoreExisting);
1134+
1135+ auto withRWAccess = [this ](auto &&functor) {
1136+ auto oldType = IOHandler ()->m_frontendAccess ;
1137+ auto newType = const_cast <Access *>(&IOHandler ()->m_frontendAccess );
1138+ *newType = Access::READ_WRITE;
1139+ std::forward<decltype (functor)>(functor)();
1140+ *newType = oldType;
1141+ };
1142+
11341143 /*
11351144 * 'snapshot' changes over steps, so reread that.
11361145 */
1137- series.iterations .readAttributes (ReadMode::OverrideExisting);
1146+ withRWAccess ([&series]() {
1147+ series.iterations .readAttributes (ReadMode::OverrideExisting);
1148+ });
1149+
11381150 /* obtain all paths inside the basepath (i.e. all iterations) */
11391151 Parameter<Operation::LIST_PATHS> pList;
11401152 IOHandler ()->enqueue (IOTask (&series.iterations , pList));
@@ -1158,7 +1170,12 @@ std::optional<std::deque<uint64_t> > Series::readGorVBased(bool do_init)
11581170 {
11591171 pOpen.path = path;
11601172 IOHandler ()->enqueue (IOTask (&i, pOpen));
1173+ auto oldType = IOHandler ()->m_frontendAccess ;
1174+ auto newType =
1175+ const_cast <Access *>(&IOHandler ()->m_frontendAccess );
1176+ *newType = Access::READ_WRITE;
11611177 i.reread (path);
1178+ *newType = oldType;
11621179 }
11631180 }
11641181 else
@@ -1227,7 +1244,7 @@ std::optional<std::deque<uint64_t> > Series::readGorVBased(bool do_init)
12271244 for (auto const &it : *pList.paths )
12281245 {
12291246 uint64_t index = std::stoull (it);
1230- readSingleIteration (index, it, true );
1247+ withRWAccess ([&]() { readSingleIteration (index, it, true ); } );
12311248 }
12321249 if (currentSteps.has_value ())
12331250 {
@@ -1247,7 +1264,7 @@ std::optional<std::deque<uint64_t> > Series::readGorVBased(bool do_init)
12471264 }
12481265 for (auto it : res)
12491266 {
1250- readSingleIteration (it, " " , false );
1267+ withRWAccess ([&]() { readSingleIteration (it, " " , false ); } );
12511268 }
12521269 return res;
12531270 }
0 commit comments