2023-02-08 14:57:34 +00:00
|
|
|
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
|
2023-02-08 14:57:34 +00:00
|
|
|
|
|
|
|
|
|
|
|
class AbstractBackuper(ABC):
|
|
|
|
def __init__(self):
|
|
|
|
pass
|
|
|
|
|
2023-03-14 00:39:15 +00:00
|
|
|
@abstractmethod
|
|
|
|
def is_initted(self, repo_name: str) -> bool:
|
|
|
|
raise NotImplementedError
|
|
|
|
|
2023-02-08 14:57:34 +00:00
|
|
|
@abstractmethod
|
2023-04-14 11:20:03 +00:00
|
|
|
def start_backup(self, folders: List[str], repo_name: str):
|
2023-02-08 14:57:34 +00:00
|
|
|
raise NotImplementedError
|
2023-02-13 11:16:35 +00:00
|
|
|
|
|
|
|
@abstractmethod
|
|
|
|
def get_snapshots(self, repo_name) -> List[Snapshot]:
|
|
|
|
"""Get all snapshots from the repo"""
|
|
|
|
raise NotImplementedError
|
2023-02-17 16:11:17 +00:00
|
|
|
|
|
|
|
@abstractmethod
|
|
|
|
def init(self, repo_name):
|
|
|
|
raise NotImplementedError
|
2023-02-22 14:45:11 +00:00
|
|
|
|
|
|
|
@abstractmethod
|
2023-04-14 11:20:03 +00:00
|
|
|
def restore_from_backup(self, repo_name: str, snapshot_id: str, folders: List[str]):
|
2023-02-22 14:45:11 +00:00
|
|
|
"""Restore a target folder using a snapshot"""
|
|
|
|
raise NotImplementedError
|
2023-02-22 18:48:08 +00:00
|
|
|
|
|
|
|
@abstractmethod
|
|
|
|
def restored_size(self, repo_name, snapshot_id) -> float:
|
|
|
|
raise NotImplementedError
|