@@ -905,7 +905,7 @@ void Series::init(
905905
906906 switch (at)
907907 {
908- case Access::CREATE :
908+ case Access::CREATE_RANDOM_ACCESS :
909909 case Access::READ_WRITE :
910910 case Access::READ_ONLY : {
911911 auto [parsed_input, tracing_json] = initIOHandler<json::TracingJSON>(
@@ -917,8 +917,10 @@ void Series::init(
917917 init_directly (std::move (parsed_input), std::move (tracing_json));
918918 }
919919 break ;
920+ case Access::CREATE_LINEAR :
920921 case Access::READ_LINEAR :
921- case Access::APPEND : {
922+ case Access::APPEND_RANDOM_ACCESS :
923+ case Access::APPEND_LINEAR : {
922924 auto [first_parsed_input, first_tracing_json] =
923925 initIOHandler<json::TracingJSON>(
924926 filepath,
@@ -963,7 +965,7 @@ auto Series::initIOHandler(
963965 /* considerFiles = */ true );
964966 auto input = parseInput (filepath);
965967 if (resolve_generic_extension && input->format == Format::GENERIC &&
966- at != Access:: CREATE )
968+ ! access::create (at) )
967969 {
968970 auto isPartOfSeries =
969971 input->iterationEncoding == IterationEncoding::fileBased
@@ -1155,13 +1157,15 @@ Given file pattern: ')END"
11551157 IOHandler ()->m_seriesStatus = internal::SeriesStatus::Default;
11561158 break ;
11571159 }
1158- case Access::CREATE : {
1160+ case Access::CREATE_RANDOM_ACCESS :
1161+ case Access::CREATE_LINEAR : {
11591162 initDefaults (input->iterationEncoding );
11601163 setIterationEncoding_internal (
11611164 input->iterationEncoding , series.m_iterationEncodingSetExplicitly );
11621165 break ;
11631166 }
1164- case Access::APPEND : {
1167+ case Access::APPEND_RANDOM_ACCESS :
1168+ case Access::APPEND_LINEAR : {
11651169 initDefaults (input->iterationEncoding );
11661170 setIterationEncoding_internal (
11671171 input->iterationEncoding , series.m_iterationEncodingSetExplicitly );
@@ -1225,7 +1229,7 @@ void Series::initDefaults(IterationEncoding ie, bool initAll)
12251229 * In file-based iteration encoding, files are always truncated in Append
12261230 * mode (Append mode works on a per-iteration basis).
12271231 */
1228- if (!initAll && IOHandler ()->m_frontendAccess == Access:: APPEND &&
1232+ if (!initAll && access::append ( IOHandler ()->m_frontendAccess ) &&
12291233 ie != IterationEncoding::fileBased)
12301234 {
12311235 return ;
@@ -1349,8 +1353,10 @@ void Series::flushFileBased(
13491353 }
13501354 break ;
13511355 case Access::READ_WRITE :
1352- case Access::CREATE :
1353- case Access::APPEND : {
1356+ case Access::CREATE_RANDOM_ACCESS :
1357+ case Access::CREATE_LINEAR :
1358+ case Access::APPEND_RANDOM_ACCESS :
1359+ case Access::APPEND_LINEAR : {
13541360 bool allDirty = dirty ();
13551361 for (auto it = begin; it != end; ++it)
13561362 {
@@ -1471,7 +1477,7 @@ void Series::flushGorVBased(
14711477 {
14721478 if (!written ())
14731479 {
1474- if (IOHandler ()->m_frontendAccess == Access:: APPEND )
1480+ if (access::append ( IOHandler ()->m_frontendAccess ) )
14751481 {
14761482 Parameter<Operation::CHECK_FILE > param;
14771483 param.name = series.m_name ;
@@ -2855,7 +2861,7 @@ void Series::openIteration(IterationIndex_t index, Iteration &iteration)
28552861 * before it is possible to open it.
28562862 */
28572863 if (!iteration.written () &&
2858- (IOHandler ()->m_frontendAccess == Access:: CREATE ||
2864+ (access::create ( IOHandler ()->m_frontendAccess ) ||
28592865 oldStatus != internal::CloseStatus::ParseAccessDeferred))
28602866 {
28612867 // nothing to do, file will be opened by writing routines
@@ -3267,13 +3273,21 @@ Series::snapshots(std::optional<SnapshotWorkflow> const snapshot_workflow)
32673273 SnapshotWorkflow::RandomAccess);
32683274 break ;
32693275
3270- case Access::CREATE :
3271- case Access::APPEND :
3276+ // TODO: Remove parameter
3277+ case Access::CREATE_RANDOM_ACCESS :
3278+ case Access::APPEND_RANDOM_ACCESS :
32723279 // Users can select.
32733280 usedSnapshotWorkflow = snapshot_workflow.value_or (
32743281 /* random-access logic by default */
32753282 SnapshotWorkflow::RandomAccess);
32763283 break ;
3284+ case Access::CREATE_LINEAR :
3285+ case Access::APPEND_LINEAR :
3286+ // Users can select.
3287+ usedSnapshotWorkflow = snapshot_workflow.value_or (
3288+ /* random-access logic by default */
3289+ SnapshotWorkflow::Synchronous);
3290+ break ;
32773291 }
32783292 }
32793293
@@ -3342,10 +3356,12 @@ void Series::parseBase()
33423356 readIterations ();
33433357}
33443358
3359+ // TODO: ensure backwards compatibility
33453360WriteIterations Series::writeIterations ()
33463361{
33473362 auto const access = IOHandler ()->m_frontendAccess ;
3348- if (access != Access::CREATE && access != Access::APPEND )
3363+ if (access != Access::CREATE_RANDOM_ACCESS &&
3364+ access != Access::APPEND_RANDOM_ACCESS )
33493365 {
33503366 throw error::WrongAPIUsage (
33513367 " [Series::writeIterations()] May only be applied for access modes "
@@ -3514,24 +3530,11 @@ auto Series::preparseSnapshots()
35143530
35153531bool Series::randomAccessSteps () const
35163532{
3517- auto randomAccess = [](Access access) {
3518- switch (access)
3519- {
3520- case Access::READ_RANDOM_ACCESS :
3521- case Access::READ_WRITE :
3522- return true ;
3523- case Access::READ_LINEAR :
3524- case Access::CREATE :
3525- case Access::APPEND :
3526- return false ;
3527- }
3528- return false ;
3529- };
35303533 return get ().m_parsePreference .value_or (
35313534 internal::ParsePreference::UpFront) ==
35323535 internal::ParsePreference::UpFront &&
35333536 iterationEncoding () == IterationEncoding::variableBased &&
3534- randomAccess (IOHandler ()->m_backendAccess );
3537+ access::random_access (IOHandler ()->m_backendAccess );
35353538}
35363539
35373540namespace
0 commit comments