Redundant
File Storage (Local)
Using
all the knowledge you have accumulated thus far from learning about
reading and writing to files, threads, and Watchdog, we will create a
file system backup application. It should continuously monitor a
source directory for changes in the monitored directory and
automatically replicate those changes to another destination
directory in real-time. At first, this may seem difficult but let’s
remember that we are simply just taking input from Watchdog and
either copying the file to another directory or deleting the file in
another directory.
Your
application should consist of a single module named fileBackup.py in
that module you should have a class named FileBackupManager.
FileBackupManager must include two functions.
start(src,
dst)
This
function will start the backup process. It will monitor the directory
specified by src and it will replicate all changes to a destination
directory specified by dst. This function will start Watchdog and the
accompanying threads. This function must return and should not wait
for the thread pool to terminate.
The
first thing this function should do when it is called is it should
copy the entire src directory to the dst so that both directories are
the same at the start. How do I copy an entire directory? After that,
it should start the threads and monitoring processes.
src
– A string representing a file path that is to be monitored.
dst
– A string representing a file path that will hold a copy of the src
directory.
stop()
This
function should terminate the backup processes. Meaning it should
terminate all threads and the Watchdog.
Accompanying
this assignment is a file name fileBackup.py, it will contain the
empty class where you will write your code. You will also find a file
named fileBackupTests.py, it will contain tests that will test your
code.
The post Redundant File Storage (Local) appeared first on My Assignment Online.