def Regress(mirror_rp): """Bring mirror and inc directory back to regress_to_time Also affects the rdiff-backup-data directory, so Globals.rbdir should be set. Regress should only work one step at a time (i.e. don't "regress" through two separate backup sets. This function should be run locally to the rdiff-backup-data directory. """ inc_rpath = Globals.rbdir.append_path(b"increments") assert mirror_rp.index == () and inc_rpath.index == (), ( "Mirror and increment paths must have an empty index") assert mirror_rp.isdir() and inc_rpath.isdir(), ( "Mirror and increments paths must be directories") assert mirror_rp.conn is inc_rpath.conn is Globals.local_connection, ( "Regress must happen locally.") meta_manager, former_current_mirror_rp = _set_regress_time() _set_restore_times() _regress_rbdir(meta_manager) ITR = rorpiter.IterTreeReducer(RegressITRB, []) for rf in _iterate_meta_rfs(mirror_rp, inc_rpath): ITR(rf.index, rf) ITR.finish_processing() if former_current_mirror_rp: if Globals.do_fsync: C.sync() # Sync first, since we are marking dest dir as good now former_current_mirror_rp.delete()
def backup_remove_curmirror_local(): """Remove the older of the current_mirror files. Use at end of session""" assert Globals.rbdir.conn is Globals.local_connection, ( "Function can only be called locally and not over '{conn}'.".format( conn=Globals.rbdir.conn)) curmir_incs = restore.get_inclist(Globals.rbdir.append(b"current_mirror")) assert len(curmir_incs) == 2, ( "There must be two current mirrors not '{ilen}'.".format( ilen=len(curmir_incs))) if curmir_incs[0].getinctime() < curmir_incs[1].getinctime(): older_inc = curmir_incs[0] else: older_inc = curmir_incs[1] if Globals.do_fsync: C.sync() # Make sure everything is written before curmirror is removed older_inc.delete()
def test_sync(self): """Test running C.sync""" C.sync()
def test_sync(self): """Test running C.sync""" C.sync()