24 lines
600 B
JavaScript
24 lines
600 B
JavaScript
import { DIR_XO_CONFIG_BACKUPS, DIR_XO_POOL_METADATA_BACKUPS } from './RemoteAdapter.mjs'
|
|
|
|
export function parseMetadataBackupId(backupId) {
|
|
const [dir, ...rest] = backupId.split('/')
|
|
if (dir === DIR_XO_CONFIG_BACKUPS) {
|
|
const [scheduleId, timestamp] = rest
|
|
return {
|
|
type: 'xoConfig',
|
|
scheduleId,
|
|
timestamp,
|
|
}
|
|
} else if (dir === DIR_XO_POOL_METADATA_BACKUPS) {
|
|
const [scheduleId, poolUuid, timestamp] = rest
|
|
return {
|
|
type: 'pool',
|
|
poolUuid,
|
|
scheduleId,
|
|
timestamp,
|
|
}
|
|
}
|
|
|
|
throw new Error(`not supported backup dir (${dir})`)
|
|
}
|