????
Current Path : /proc/thread-self/root/proc/self/root/lib/Acronis/PyTools/commands/ |
Current File : //proc/thread-self/root/proc/self/root/lib/Acronis/PyTools/commands/retention_specs.py |
import time SECONDS_IN_DAY = 86400 ACTIVITY_COMPLETED_STATE = 5 def get_days_before_time(days): return int(time.time()) - SECONDS_IN_DAY * days def completed_activities_by_amount(amount, days): return { 'pattern': [ ('^Is', 'string', 'Tol::History::Plain::Activity'), ('.State', 'dword', ACTIVITY_COMPLETED_STATE), ('.Period.FinishTime', 'sqword', 0), ('.Period.FinishTime^Less', 'sqword', get_days_before_time(days)), ], 'historical_order': True, 'objects_count_limit': amount, } def completed_activities_by_age_in_days(days): return { 'pattern': [ ('^Is', 'string', 'Tol::History::Plain::Activity'), ('.State', 'dword', ACTIVITY_COMPLETED_STATE), ('.Period.FinishTime', 'sqword', 0), ('.Period.FinishTime^Less', 'sqword', get_days_before_time(days)), ], 'historical_order': True, 'objects_count_limit': 0, } RETENTION_SPECS_CLOUD = [ completed_activities_by_age_in_days(60), completed_activities_by_amount(10000, 7) ] RETENTION_SPECS_ONPREM = [ completed_activities_by_age_in_days(60), completed_activities_by_amount(10000, 7) ]