/** * BackupProvider — Abstract base class for backup providers * All providers must implement these methods */ class BackupProvider { /** * Authenticate with the backup service * @param {Object} credentials - Provider-specific credentials */ async authenticate(credentials) { throw new Error('authenticate() not implemented in ' + this.constructor.name) } /** * Upload a backup file * @param {Buffer} buffer - File content * @param {string} filename - Filename (e.g., 'repo-backup-2025-03-24.zip') * @returns {Promise<{size: number}>} */ async uploadBackup(buffer, filename) { throw new Error('uploadBackup() not implemented in ' + this.constructor.name) } /** * List all backups for a repository * @returns {Promise} Array of {name, size, date} */ async listBackups() { throw new Error('listBackups() not implemented in ' + this.constructor.name) } /** * Download a specific backup * @param {string} filename - Filename to download * @returns {Promise} */ async downloadBackup(filename) { throw new Error('downloadBackup() not implemented in ' + this.constructor.name) } /** * Delete a backup file * @param {string} filename - Filename to delete */ async deleteBackup(filename) { throw new Error('deleteBackup() not implemented in ' + this.constructor.name) } /** * Test connection to backup service * @returns {Promise<{ok: boolean, error?: string}>} */ async testConnection() { throw new Error('testConnection() not implemented in ' + this.constructor.name) } } module.exports = BackupProvider