Skip to content

Commit

Permalink
Refactor ClientStoreMarker::NotKnown out of BackupClientContext.h
Browse files Browse the repository at this point in the history
  • Loading branch information
qris committed Dec 8, 2018
1 parent a977554 commit 4c55b10
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 12 deletions.
2 changes: 1 addition & 1 deletion lib/backupstore/BackupCommands.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ std::auto_ptr<BackupProtocolMessage> BackupProtocolFinished2::DoCommand(
rContext.GetConnectionDetails());

// We can only get the current marker if we have a lock. Otherwise it doesn't make sense.
int64_t marker = BackupFileSystem::ClientStoreMarker_NotKnown;
int64_t marker = ClientStoreMarker::NotKnown;
if(!rContext.SessionIsReadOnly())
{
marker = rContext.GetClientStoreMarker();
Expand Down
9 changes: 9 additions & 0 deletions lib/backupstore/BackupConstants.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,14 @@
BackupProtocolError::ErrorType, \
BackupProtocolError::code));

namespace ClientStoreMarker
{
enum
{
NotKnown = -1,
Default = 0,
};
};

#endif // BACKUPCONSTANTS__H

7 changes: 4 additions & 3 deletions lib/bbackupd/BackupClientContext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#include <sys/time.h>
#endif

#include "BackupConstants.h"
#include "BoxPortsAndFiles.h"
#include "BoxTime.h"
#include "BackupClientContext.h"
Expand Down Expand Up @@ -49,7 +50,7 @@ BackupClientContext::BackupClientContext
: mrConfig(rConfig),
mrResolver(rResolver),
mrProgressNotifier(rProgressNotifier),
mClientStoreMarker(ClientStoreMarker_NotKnown),
mClientStoreMarker(ClientStoreMarker::NotKnown),
mpDeleteList(NULL),
mpCurrentIDMap(NULL),
mpNewIDMap(NULL),
Expand Down Expand Up @@ -129,7 +130,7 @@ BackupProtocolCallable &BackupClientContext::GetConnection()
BackupProtocolLoginConfirmed& login_conf(mapConnection->GetLoginConfirmed());

// If reconnecting, check that the client store marker is the one we expect:
if(mClientStoreMarker != ClientStoreMarker_NotKnown)
if(mClientStoreMarker != ClientStoreMarker::NotKnown)
{
if(login_conf.GetClientStoreMarker() != mClientStoreMarker)
{
Expand All @@ -152,7 +153,7 @@ BackupProtocolCallable &BackupClientContext::GetConnection()
"same account?");
}
}
else // mClientStoreMarker == ClientStoreMarker_NotKnown
else // mClientStoreMarker == ClientStoreMarker::NotKnown
{
// Yes, choose one, the current time will do
box_time_t marker = GetCurrentBoxTime();
Expand Down
5 changes: 0 additions & 5 deletions lib/bbackupd/BackupClientContext.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,6 @@ class BackupClientContext : public DiffTimer
BackupClientDeleteList &GetDeleteList();
void PerformDeletions();

enum
{
ClientStoreMarker_NotKnown = 0
};

void SetClientStoreMarker(int64_t ClientStoreMarker) {mClientStoreMarker = ClientStoreMarker;}
int64_t GetClientStoreMarker() const {return mClientStoreMarker;}

Expand Down
6 changes: 3 additions & 3 deletions lib/bbackupd/BackupDaemon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ BackupDaemon::BackupDaemon()
mDeleteRedundantLocationsAfter(0),
mLastNotifiedEvent(SysadminNotifier::MAX),
mDeleteUnusedRootDirEntriesAfter(0),
mClientStoreMarker(BackupClientContext::ClientStoreMarker_NotKnown),
mClientStoreMarker(ClientStoreMarker::NotKnown),
mStorageLimitExceeded(false),
mReadErrorsOnFilesystemObjects(false),
mLastSyncTime(0),
Expand Down Expand Up @@ -896,7 +896,7 @@ void BackupDaemon::ResetCachedState()
// Clear state data
// Go back to beginning of time
mLastSyncTime = 0;
mClientStoreMarker = BackupClientContext::ClientStoreMarker_NotKnown; // no store marker, so download everything
mClientStoreMarker = ClientStoreMarker::NotKnown; // no store marker, so download everything
DeleteAllLocations();
DeleteAllIDMaps();
}
Expand Down Expand Up @@ -3584,7 +3584,7 @@ bool BackupDaemon::DeserializeStoreObjectInfo(box_time_t & theLastSyncTime,

DeleteAllLocations();

mClientStoreMarker = BackupClientContext::ClientStoreMarker_NotKnown;
mClientStoreMarker = ClientStoreMarker::NotKnown;
theLastSyncTime = 0;
theNextSyncTime = 0;

Expand Down

0 comments on commit 4c55b10

Please sign in to comment.