mirror of
https://git.selfprivacy.org/SelfPrivacy/selfprivacy-rest-api.git
synced 2025-01-23 09:16:51 +00:00
refactor(backups): cleanup localfile-specific logic
This commit is contained in:
parent
8475ae3375
commit
38de01da8b
|
@ -21,7 +21,6 @@ REDIS_SNAPSHOTS_PREFIX = "backups:snapshots:"
|
||||||
REDIS_LAST_BACKUP_PREFIX = "backups:last-backed-up:"
|
REDIS_LAST_BACKUP_PREFIX = "backups:last-backed-up:"
|
||||||
REDIS_INITTED_CACHE_PREFIX = "backups:initted_services:"
|
REDIS_INITTED_CACHE_PREFIX = "backups:initted_services:"
|
||||||
|
|
||||||
REDIS_REPO_PATH_KEY = "backups:test_repo_path"
|
|
||||||
REDIS_PROVIDER_KEY = "backups:provider"
|
REDIS_PROVIDER_KEY = "backups:provider"
|
||||||
REDIS_AUTOBACKUP_PERIOD_KEY = "backups:autobackup_period"
|
REDIS_AUTOBACKUP_PERIOD_KEY = "backups:autobackup_period"
|
||||||
|
|
||||||
|
@ -33,7 +32,6 @@ class Storage:
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def reset():
|
def reset():
|
||||||
redis.delete(REDIS_PROVIDER_KEY)
|
redis.delete(REDIS_PROVIDER_KEY)
|
||||||
redis.delete(REDIS_REPO_PATH_KEY)
|
|
||||||
redis.delete(REDIS_AUTOBACKUP_PERIOD_KEY)
|
redis.delete(REDIS_AUTOBACKUP_PERIOD_KEY)
|
||||||
|
|
||||||
prefixes_to_clean = [
|
prefixes_to_clean = [
|
||||||
|
@ -52,18 +50,6 @@ class Storage:
|
||||||
for key in redis.keys(REDIS_SNAPSHOTS_PREFIX + "*"):
|
for key in redis.keys(REDIS_SNAPSHOTS_PREFIX + "*"):
|
||||||
redis.delete(key)
|
redis.delete(key)
|
||||||
|
|
||||||
@staticmethod
|
|
||||||
def store_testrepo_path(path: str):
|
|
||||||
redis.set(REDIS_REPO_PATH_KEY, path)
|
|
||||||
|
|
||||||
@staticmethod
|
|
||||||
def get_testrepo_path() -> str:
|
|
||||||
if not redis.exists(REDIS_REPO_PATH_KEY):
|
|
||||||
raise ValueError(
|
|
||||||
"No test repository filepath is set, but we tried to access it"
|
|
||||||
)
|
|
||||||
return redis.get(REDIS_REPO_PATH_KEY)
|
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def services_with_autobackup() -> List[str]:
|
def services_with_autobackup() -> List[str]:
|
||||||
keys = redis.keys(REDIS_AUTOBACKUP_ENABLED_PREFIX + "*")
|
keys = redis.keys(REDIS_AUTOBACKUP_ENABLED_PREFIX + "*")
|
||||||
|
|
Loading…
Reference in a new issue