#include #include #include namespace DB { namespace ErrorCodes { extern const int LOGICAL_ERROR; } std::string_view toString(BackupStatus backup_status) { switch (backup_status) { case BackupStatus::CREATING_BACKUP: return "CREATING_BACKUP"; case BackupStatus::BACKUP_CREATED: return "BACKUP_CREATED"; case BackupStatus::BACKUP_FAILED: return "BACKUP_FAILED"; case BackupStatus::RESTORING: return "RESTORING"; case BackupStatus::RESTORED: return "RESTORED"; case BackupStatus::RESTORE_FAILED: return "RESTORE_FAILED"; default: break; } throw Exception(ErrorCodes::LOGICAL_ERROR, "Unexpected backup status: {}", static_cast(backup_status)); } const std::vector> & getBackupStatusEnumValues() { static const std::vector> values = [] { std::vector> res; for (auto status : collections::range(BackupStatus::MAX)) res.emplace_back(toString(status), static_cast(status)); return res; }(); return values; } }