in cc/src/core/state_transitions.h [55:147]
inline SystemState GetNextState() const {
switch(action) {
case Action::CheckpointFull:
switch(phase) {
case Phase::REST:
return SystemState{ Action::CheckpointFull, Phase::PREP_INDEX_CHKPT, version };
case Phase::PREP_INDEX_CHKPT:
return SystemState{ Action::CheckpointFull, Phase::INDEX_CHKPT, version };
case Phase::INDEX_CHKPT:
return SystemState{ Action::CheckpointFull, Phase::PREPARE, version };
case Phase::PREPARE:
return SystemState{ Action::CheckpointFull, Phase::IN_PROGRESS, version + 1 };
case Phase::IN_PROGRESS:
return SystemState{ Action::CheckpointFull, Phase::WAIT_PENDING, version };
case Phase::WAIT_PENDING:
return SystemState{ Action::CheckpointFull, Phase::WAIT_FLUSH, version };
case Phase::WAIT_FLUSH:
return SystemState{ Action::CheckpointFull, Phase::PERSISTENCE_CALLBACK, version };
case Phase::PERSISTENCE_CALLBACK:
return SystemState{ Action::CheckpointFull, Phase::REST, version };
default:
// not reached
assert(false);
return SystemState(UINT64_MAX);
}
break;
case Action::CheckpointIndex:
switch(phase) {
case Phase::REST:
return SystemState{ Action::CheckpointIndex, Phase::PREP_INDEX_CHKPT, version };
case Phase::PREP_INDEX_CHKPT:
return SystemState{ Action::CheckpointIndex, Phase::INDEX_CHKPT, version };
case Phase::INDEX_CHKPT:
return SystemState{ Action::CheckpointIndex, Phase::REST, version };
default:
// not reached
assert(false);
return SystemState(UINT64_MAX);
}
break;
case Action::CheckpointHybridLog:
switch(phase) {
case Phase::REST:
return SystemState{ Action::CheckpointHybridLog, Phase::PREPARE, version };
case Phase::PREPARE:
return SystemState{ Action::CheckpointHybridLog, Phase::IN_PROGRESS, version + 1 };
case Phase::IN_PROGRESS:
return SystemState{ Action::CheckpointHybridLog, Phase::WAIT_PENDING, version };
case Phase::WAIT_PENDING:
return SystemState{ Action::CheckpointHybridLog, Phase::WAIT_FLUSH, version };
case Phase::WAIT_FLUSH:
return SystemState{ Action::CheckpointHybridLog, Phase::PERSISTENCE_CALLBACK, version };
case Phase::PERSISTENCE_CALLBACK:
return SystemState{ Action::CheckpointHybridLog, Phase::REST, version };
default:
// not reached
assert(false);
return SystemState(UINT64_MAX);
}
break;
case Action::GC:
switch(phase) {
case Phase::REST:
return SystemState{ Action::GC, Phase::GC_IO_PENDING, version };
case Phase::GC_IO_PENDING:
return SystemState{ Action::GC, Phase::GC_IN_PROGRESS, version };
case Phase::GC_IN_PROGRESS:
return SystemState{ Action::GC, Phase::REST, version };
default:
// not reached
assert(false);
return SystemState(UINT64_MAX);
}
break;
case Action::GrowIndex:
switch(phase) {
case Phase::REST:
return SystemState{ Action::GrowIndex, Phase::GROW_PREPARE, version };
case Phase::GROW_PREPARE:
return SystemState{ Action::GrowIndex, Phase::GROW_IN_PROGRESS, version };
case Phase::GROW_IN_PROGRESS:
return SystemState{ Action::GrowIndex, Phase::REST, version };
default:
// not reached
assert(false);
return SystemState(UINT64_MAX);
}
default:
// not reached
assert(false);
return SystemState(UINT64_MAX);
}
}