summaryrefslogtreecommitdiff
path: root/bin/bbackupd/BackupDaemon.cpp
diff options
context:
space:
mode:
authorChris Wilson <chris+github@qwirx.com>2008-08-21 10:41:18 +0000
committerChris Wilson <chris+github@qwirx.com>2008-08-21 10:41:18 +0000
commit2019b57dcbba43e8b3feba9385aec4a25bfa55b2 (patch)
treea669d280e5a15a760f70e4a707b0dbdf03c79dcb /bin/bbackupd/BackupDaemon.cpp
parentaad61cfb4d89c65cafc698da5aa1b6b06a5a232c (diff)
Pass a RunStatusProvider and a ReadLoggingStream::Logger from
BackupDaemon through BackupClientDirectoryRecord, BackupStoreFile and BackupStoreFileEncodeStream to ReadLoggingStream, to allow progress callbacks during file upload and cancelling upload part-way. Implement ReadLoggingStream::Logger in BackupClientDirectoryRecord::SyncParams, which thunks the notifications back to the ProgressNotifier. Add the SysadminNotifier interface from Boxi. Add NotifyIDMapsSetup() to ProgressNotifier. Change BackupClientDirectoryRecord::SyncParams to store references to the individual callback interfaces rather than BackupDaemon. Initialise all members in BackupDaemon. Add ability for BackupDaemon user to override the ProgressNotifier, LocationResolver, SysadminNotifier and RunStatusProvider that will be used during the backup. Make BackupDaemon::Location class public and provide access to the configured locations for Boxi (dangerous, they could be modified without BackupDaemon knowing it).
Diffstat (limited to 'bin/bbackupd/BackupDaemon.cpp')
-rw-r--r--bin/bbackupd/BackupDaemon.cpp59
1 files changed, 35 insertions, 24 deletions
diff --git a/bin/bbackupd/BackupDaemon.cpp b/bin/bbackupd/BackupDaemon.cpp
index fe5fa35f..06e23728 100644
--- a/bin/bbackupd/BackupDaemon.cpp
+++ b/bin/bbackupd/BackupDaemon.cpp
@@ -49,34 +49,33 @@
#include "SSLLib.h"
-#include "BackupDaemon.h"
-#include "BackupDaemonConfigVerify.h"
+#include "autogen_BackupProtocolClient.h"
+#include "autogen_ClientException.h"
+#include "autogen_ConversionException.h"
+#include "Archive.h"
#include "BackupClientContext.h"
+#include "BackupClientCryptoKeys.h"
#include "BackupClientDirectoryRecord.h"
-#include "BackupStoreDirectory.h"
#include "BackupClientFileAttributes.h"
-#include "BackupStoreFilenameClear.h"
#include "BackupClientInodeToIDMap.h"
-#include "autogen_BackupProtocolClient.h"
-#include "autogen_ConversionException.h"
-#include "BackupClientCryptoKeys.h"
-#include "BannerText.h"
+#include "BackupClientMakeExcludeList.h"
+#include "BackupDaemon.h"
+#include "BackupDaemonConfigVerify.h"
+#include "BackupStoreConstants.h"
+#include "BackupStoreDirectory.h"
+#include "BackupStoreException.h"
#include "BackupStoreFile.h"
-#include "Random.h"
+#include "BackupStoreFilenameClear.h"
+#include "BannerText.h"
+#include "Conversion.h"
#include "ExcludeList.h"
-#include "BackupClientMakeExcludeList.h"
-#include "IOStreamGetLine.h"
-#include "Utils.h"
#include "FileStream.h"
-#include "BackupStoreException.h"
-#include "BackupStoreConstants.h"
-#include "LocalProcessStream.h"
#include "IOStreamGetLine.h"
-#include "Conversion.h"
-#include "Archive.h"
-#include "Timer.h"
+#include "LocalProcessStream.h"
#include "Logging.h"
-#include "autogen_ClientException.h"
+#include "Random.h"
+#include "Timer.h"
+#include "Utils.h"
#ifdef WIN32
#include "Win32ServiceFunctions.h"
@@ -122,13 +121,23 @@ unsigned int WINAPI HelperThread(LPVOID lpParam)
// --------------------------------------------------------------------------
BackupDaemon::BackupDaemon()
: mState(BackupDaemon::State_Initialising),
+ mDeleteRedundantLocationsAfter(0),
mpCommandSocketInfo(0),
mDeleteUnusedRootDirEntriesAfter(0),
mClientStoreMarker(BackupClientContext::ClientStoreMarker_NotKnown),
mStorageLimitExceeded(false),
mReadErrorsOnFilesystemObjects(false),
mLastSyncTime(0),
- mLogAllFileAccess(false)
+ mNextSyncTime(0),
+ mCurrentSyncStartTime(0),
+ mUpdateStoreInterval(0),
+ mDeleteStoreObjectInfoFile(false),
+ mDoSyncForcedByPreviousSyncError(false),
+ mLogAllFileAccess(false),
+ mpProgressNotifier(this),
+ mpLocationResolver(this),
+ mpRunStatusProvider(this),
+ mpSysadminNotifier(this)
#ifdef WIN32
, mInstallService(false),
mRemoveService(false),
@@ -1078,14 +1087,14 @@ void BackupDaemon::RunSyncNow()
// just connect, as this may be unnecessary)
BackupClientContext clientContext
(
- *this,
+ *mpLocationResolver,
mTlsContext,
conf.GetKeyValue("StoreHostname"),
conf.GetKeyValueInt("StorePort"),
conf.GetKeyValueInt("AccountNumber"),
conf.GetKeyValueBool("ExtendedLogging"),
conf.KeyExists("ExtendedLogFile"),
- extendedLogFile, *this
+ extendedLogFile, *mpProgressNotifier
);
// The minimum age a file needs to be before it will be
@@ -1158,8 +1167,8 @@ void BackupDaemon::RunSyncNow()
}
// Set up the sync parameters
- BackupClientDirectoryRecord::SyncParams params(
- *this, clientContext);
+ BackupClientDirectoryRecord::SyncParams params(*mpRunStatusProvider,
+ *mpSysadminNotifier, *mpProgressNotifier, clientContext);
params.mSyncPeriodStart = syncPeriodStart;
params.mSyncPeriodEnd = syncPeriodEndExtended;
// use potentially extended end time
@@ -1214,6 +1223,8 @@ void BackupDaemon::RunSyncNow()
SetupLocations(clientContext, locations);
}
+ mpProgressNotifier->NotifyIDMapsSetup(clientContext);
+
// Get some ID maps going
SetupIDMapsForSync();