feat(backup): add in-memory backup

This commit is contained in:
Houkime 2023-02-03 18:29:45 +00:00 committed by Inex Code
parent e5a965ea29
commit 37c18ead99
2 changed files with 7 additions and 2 deletions

View file

@ -2,10 +2,13 @@ from selfprivacy_api.graphql.queries.providers import BackupProvider
from selfprivacy_api.backup.providers.provider import AbstractBackupProvider from selfprivacy_api.backup.providers.provider import AbstractBackupProvider
from selfprivacy_api.backup.providers.backblaze import Backblaze from selfprivacy_api.backup.providers.backblaze import Backblaze
from selfprivacy_api.backup.providers.memory import InMemoryBackup
PROVIDER_MAPPING = { PROVIDER_MAPPING = {
BackupProvider.BACKBLAZE: Backblaze BackupProvider.BACKBLAZE: Backblaze,
BackupProvider.MEMORY: InMemoryBackup,
} }
def get_provider(provider_type : BackupProvider) -> AbstractBackupProvider:
def get_provider(provider_type: BackupProvider) -> AbstractBackupProvider:
return PROVIDER_MAPPING[provider_type] return PROVIDER_MAPPING[provider_type]

View file

@ -19,3 +19,5 @@ class ServerProvider(Enum):
@strawberry.enum @strawberry.enum
class BackupProvider(Enum): class BackupProvider(Enum):
BACKBLAZE = "BACKBLAZE" BACKBLAZE = "BACKBLAZE"
# for testing purposes, make sure not selectable in prod.
MEMORY = "MEMORY"