faubackup2/src/copier distributor.cpp,1.2,1.3 distributor.hpp,1.2,1.3
Erik Merkel <[email protected]> Tue, 07 Jun 2005 11:39:15 +0000
| Newsgroups | gmane.comp.sysutils.backup.faubackup.cvs |
|---|---|
| Message-ID | <[email protected]> |
Update of /cvsroot/faubackup/faubackup2/src/copier
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8958/copier
Modified Files:
distributor.cpp distributor.hpp
Log Message:
alternate hardlink function - TODO: preserve Hardlinks
Index: distributor.cpp
===================================================================
RCS file: /cvsroot/faubackup/faubackup2/src/copier/distributor.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** distributor.cpp 6 Jun 2005 19:45:07 -0000 1.2
--- distributor.cpp 7 Jun 2005 11:39:13 -0000 1.3
***************
*** 1,4 ****
--- 1,5 ----
#include "copier/distributor.hpp"
#include "rsync/rsync.hpp"
+ #include "common/system_calls.hpp"
namespace faubackup
***************
*** 20,28 ****
network->sendString(file.getFilename());
network->sendString(file.getNameForLink());
! }
! else
if((st.st_size > MIN_RSYNC_SIZE) &&
! (file.getFileSize() > MIN_RSYNC_SIZE) &&
! (rsync) ) {
output.information("rsync file:\t" + file.getFilename(),
DEBUG_OUTPUT);
--- 21,28 ----
network->sendString(file.getFilename());
network->sendString(file.getNameForLink());
! } else
if((st.st_size > MIN_RSYNC_SIZE) &&
! (file.getFileSize() > MIN_RSYNC_SIZE) &&
! (rsync) ) {
output.information("rsync file:\t" + file.getFilename(),
DEBUG_OUTPUT);
***************
*** 30,35 ****
network->sendString(file.getFilename());
checkSum(old_dir + file.getFilename(), st.st_size, *network);
! }
! else {
output.information("copy file:\t" + file.getFilename() + " " + int2string(rsync),
DEBUG_OUTPUT);
--- 30,34 ----
network->sendString(file.getFilename());
checkSum(old_dir + file.getFilename(), st.st_size, *network);
! } else {
output.information("copy file:\t" + file.getFilename() + " " + int2string(rsync),
DEBUG_OUTPUT);
***************
*** 44,51 ****
output.information("Hardlink file:\t" +
file.getFilename(), DEBUG_OUTPUT);
return;
}
! network->sendByte(BackupLinkRegFile);
! network->sendString(file.getFilename());
}
void Distributor::new_file(Fileinfo file)
--- 43,53 ----
output.information("Hardlink file:\t" +
file.getFilename(), DEBUG_OUTPUT);
+
return;
}
! //network->sendByte(BackupLinkRegFile);
! //network->sendString(file.getFilename());
! makeHardLink(old_dir + file.getFilename(), destination + file.getFilename());
!
}
void Distributor::new_file(Fileinfo file)
***************
*** 67,72 ****
network->sendString(file.getFilename());
network->sendString(file.getNameForLink());
! }
! else {
if(do_nothing) {
output.information("Transfer file:\t" +
--- 69,73 ----
network->sendString(file.getFilename());
network->sendString(file.getNameForLink());
! } else {
if(do_nothing) {
output.information("Transfer file:\t" +
***************
*** 93,98 ****
network->sendString(file.getFilename());
}
! }
! else {
if(file.getFileType() == SLink)
network->sendByte(SymlinkFile);
--- 94,98 ----
network->sendString(file.getFilename());
}
! } else {
if(file.getFileType() == SLink)
network->sendByte(SymlinkFile);
***************
*** 103,111 ****
}
! Distributor::Distributor(NetCommunication &com, string old_backup_dir)
! :network(&com), old_dir(old_backup_dir)
{
if(old_dir[old_dir.size()-1] != '/')
old_dir.append("/");
}
Distributor::~Distributor()
--- 103,113 ----
}
! Distributor::Distributor(NetCommunication &com, string old_backup_dir, string dest)
! :network(&com), old_dir(old_backup_dir), destination(dest)
{
if(old_dir[old_dir.size()-1] != '/')
old_dir.append("/");
+ if(destination[destination.size()-1] != '/')
+ destination.append("/");
}
Distributor::~Distributor()
***************
*** 136,141 ****
fileinfo.getFilename(), DEBUG_OUTPUT);
no_reg_file(fileinfo);
! }
! else
if( existFile(old_dir + fileinfo.getFilename()) ) {
output.information("file exist: " + old_dir +
--- 138,142 ----
fileinfo.getFilename(), DEBUG_OUTPUT);
no_reg_file(fileinfo);
! } else
if( existFile(old_dir + fileinfo.getFilename()) ) {
output.information("file exist: " + old_dir +
***************
*** 149,154 ****
DEBUG_OUTPUT);
file_unchanged(fileinfo);
! }
! else {
output.information("file exist changed: " +
fileinfo.getFilename(),
--- 150,154 ----
DEBUG_OUTPUT);
file_unchanged(fileinfo);
! } else {
output.information("file exist changed: " +
fileinfo.getFilename(),
***************
*** 156,161 ****
file_changed(fileinfo);
}
! }
! else {
output.information("file does not exist: " +
fileinfo.getFilename(), DEBUG_OUTPUT);
--- 156,160 ----
file_changed(fileinfo);
}
! } else {
output.information("file does not exist: " +
fileinfo.getFilename(), DEBUG_OUTPUT);
Index: distributor.hpp
===================================================================
RCS file: /cvsroot/faubackup/faubackup2/src/copier/distributor.hpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** distributor.hpp 7 Jun 2005 10:31:16 -0000 1.2
--- distributor.hpp 7 Jun 2005 11:39:13 -0000 1.3
***************
*** 25,29 ****
private:
NetCommunication *network;
! string old_dir;
void file_changed(Fileinfo file);
--- 25,29 ----
private:
NetCommunication *network;
! string old_dir, destination;
void file_changed(Fileinfo file);
***************
*** 33,37 ****
public:
! Distributor(NetCommunication &com, string old_backup_dir);
~Distributor();
void distribute();
--- 33,37 ----
public:
! Distributor(NetCommunication &com, string old_backup_dir, string dest);
~Distributor();
void distribute();
-------------------------------------------------------
This SF.Net email is sponsored by: NEC IT Guy Games. How far can you shotput
a projector? How fast can you ride your desk chair down the office luge track?
If you want to score the big prize, get to know the little guy.
Play to win an NEC 61" plasma display: http://www.necitguy.com/?r=20