mirror of
https://git.selfprivacy.org/SelfPrivacy/selfprivacy-rest-api.git
synced 2025-01-11 10:29:30 +00:00
refactor(backups): clean up caps code
This commit is contained in:
parent
a75a102df6
commit
1fc47b049d
|
@ -396,18 +396,6 @@ class Backups:
|
|||
)
|
||||
)
|
||||
|
||||
@staticmethod
|
||||
def set_max_auto_snapshots(value: int) -> None:
|
||||
"""everything <=0 means unlimited"""
|
||||
if value <= 0:
|
||||
value = -1
|
||||
Storage.set_max_auto_snapshots(value)
|
||||
|
||||
@staticmethod
|
||||
def max_auto_snapshots() -> int:
|
||||
"""-1 means unlimited"""
|
||||
return Storage.max_auto_snapshots()
|
||||
|
||||
# Restoring
|
||||
|
||||
@staticmethod
|
||||
|
|
|
@ -30,7 +30,6 @@ REDIS_INITTED_CACHE = "backups:repo_initted"
|
|||
REDIS_PROVIDER_KEY = "backups:provider"
|
||||
REDIS_AUTOBACKUP_PERIOD_KEY = "backups:autobackup_period"
|
||||
|
||||
REDIS_AUTOBACKUP_MAX_KEY = "backups:autobackup_cap"
|
||||
REDIS_AUTOBACKUP_QUOTAS_KEY = "backups:autobackup_quotas_key"
|
||||
|
||||
redis = RedisPool().get_connection()
|
||||
|
@ -45,7 +44,6 @@ class Storage:
|
|||
redis.delete(REDIS_PROVIDER_KEY)
|
||||
redis.delete(REDIS_AUTOBACKUP_PERIOD_KEY)
|
||||
redis.delete(REDIS_INITTED_CACHE)
|
||||
redis.delete(REDIS_AUTOBACKUP_MAX_KEY)
|
||||
redis.delete(REDIS_AUTOBACKUP_QUOTAS_KEY)
|
||||
|
||||
prefixes_to_clean = [
|
||||
|
@ -203,14 +201,3 @@ class Storage:
|
|||
)
|
||||
return unlimited_quotas
|
||||
return AutobackupQuotas.from_pydantic(quotas_model)
|
||||
|
||||
@staticmethod
|
||||
def set_max_auto_snapshots(value: int):
|
||||
redis.set(REDIS_AUTOBACKUP_MAX_KEY, value)
|
||||
|
||||
@staticmethod
|
||||
def max_auto_snapshots():
|
||||
if redis.exists(REDIS_AUTOBACKUP_MAX_KEY):
|
||||
return int(redis.get(REDIS_AUTOBACKUP_MAX_KEY))
|
||||
else:
|
||||
return -1
|
||||
|
|
Loading…
Reference in a new issue