selfprivacy-rest-api/selfprivacy_api/backup/backuppers/__init__.py

40 lines
1 KiB
Python
Raw Normal View History

from abc import ABC, abstractmethod
2023-02-13 11:16:35 +00:00
from typing import List
from selfprivacy_api.models.backup.snapshot import Snapshot
class AbstractBackupper(ABC):
def __init__(self):
pass
2023-03-14 00:39:15 +00:00
@abstractmethod
def is_initted(self) -> bool:
raise NotImplementedError
@abstractmethod
def set_creds(self, account: str, key: str, repo: str):
2023-03-14 00:39:15 +00:00
raise NotImplementedError
@abstractmethod
def start_backup(self, folders: List[str], repo_name: str):
raise NotImplementedError
2023-02-13 11:16:35 +00:00
@abstractmethod
def get_snapshots(self) -> List[Snapshot]:
2023-02-13 11:16:35 +00:00
"""Get all snapshots from the repo"""
raise NotImplementedError
@abstractmethod
2023-06-23 09:40:10 +00:00
def init(self):
raise NotImplementedError
@abstractmethod
2023-06-23 09:40:10 +00:00
def restore_from_backup(self, snapshot_id: str, folders: List[str]):
"""Restore a target folder using a snapshot"""
raise NotImplementedError
2023-02-22 18:48:08 +00:00
@abstractmethod
2023-06-23 09:40:10 +00:00
def restored_size(self, snapshot_id: str) -> int:
2023-02-22 18:48:08 +00:00
raise NotImplementedError