wsd: quarantine: isQuarantineEnabled -> isEnabled and log it
As this is a member of the Quarantine class, there is no need to have "Quarantine" in the name. This was a hang-up from the time when it was a static. Now we can log the enabled-state. Change-Id: Iab1cec4d90671cda175c1d320e4f3318dd7b89a1 Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>pull/7915/head
parent
798bb55143
commit
fb067faae4
|
@ -646,8 +646,10 @@ void DocumentBroker::pollThread()
|
|||
if (dataLoss || _docState.disconnected() == DocumentState::Disconnected::Unexpected)
|
||||
{
|
||||
// Quarantine the last copy, if different.
|
||||
LOG_WRN((dataLoss ? "Data loss " : "Crash ") << "detected, will quarantine last version of ["
|
||||
<< getDocKey() << "] if necessary. Quarantine enabled: " << bool(_quarantine)
|
||||
LOG_WRN((dataLoss ? "Data loss " : "Crash ")
|
||||
<< "detected, will quarantine last version of [" << getDocKey()
|
||||
<< "] if necessary. Quarantine enabled: "
|
||||
<< (_quarantine && _quarantine->isEnabled())
|
||||
<< ", Storage available: " << bool(_storage));
|
||||
if (_storage && _quarantine)
|
||||
{
|
||||
|
|
|
@ -100,7 +100,7 @@ void Quarantine::initialize(const std::string& path)
|
|||
|
||||
void Quarantine::removeQuarantine()
|
||||
{
|
||||
if (!isQuarantineEnabled())
|
||||
if (!isEnabled())
|
||||
return;
|
||||
|
||||
FileUtil::removeFile(QuarantinePath, true);
|
||||
|
@ -108,7 +108,7 @@ void Quarantine::removeQuarantine()
|
|||
|
||||
std::size_t Quarantine::quarantineSize()
|
||||
{
|
||||
if (!isQuarantineEnabled())
|
||||
if (!isEnabled())
|
||||
return 0;
|
||||
|
||||
std::vector<std::string> files;
|
||||
|
@ -125,7 +125,7 @@ std::size_t Quarantine::quarantineSize()
|
|||
|
||||
void Quarantine::makeQuarantineSpace()
|
||||
{
|
||||
if (!isQuarantineEnabled())
|
||||
if (!isEnabled())
|
||||
return;
|
||||
|
||||
LOG_ASSERT_MSG(!Mutex.try_lock(), "Quarantine Mutex must be taken");
|
||||
|
@ -181,7 +181,7 @@ void Quarantine::makeQuarantineSpace()
|
|||
|
||||
void Quarantine::clearOldQuarantineVersions()
|
||||
{
|
||||
if (!isQuarantineEnabled())
|
||||
if (!isEnabled())
|
||||
return;
|
||||
|
||||
LOG_ASSERT_MSG(!Mutex.try_lock(), "Quarantine Mutex must be taken");
|
||||
|
@ -208,7 +208,7 @@ void Quarantine::clearOldQuarantineVersions()
|
|||
|
||||
bool Quarantine::quarantineFile(const std::string& docPath)
|
||||
{
|
||||
if (!isQuarantineEnabled())
|
||||
if (!isEnabled())
|
||||
return false;
|
||||
|
||||
const std::string linkedFilePath =
|
||||
|
@ -250,7 +250,7 @@ bool Quarantine::quarantineFile(const std::string& docPath)
|
|||
|
||||
std::string Quarantine::lastQuarantinedFilePath() const
|
||||
{
|
||||
if (!isQuarantineEnabled())
|
||||
if (!isEnabled())
|
||||
return std::string();
|
||||
|
||||
std::lock_guard<std::mutex> lock(Mutex);
|
||||
|
|
|
@ -25,6 +25,8 @@ public:
|
|||
|
||||
static void initialize(const std::string& path);
|
||||
|
||||
bool isEnabled() const { return !QuarantinePath.empty(); }
|
||||
|
||||
/// Quarantines a new version of the document.
|
||||
bool quarantineFile(const std::string& docName);
|
||||
|
||||
|
@ -35,8 +37,6 @@ public:
|
|||
void removeQuarantinedFiles();
|
||||
|
||||
private:
|
||||
bool isQuarantineEnabled() const { return !QuarantinePath.empty(); }
|
||||
|
||||
/// Returns quarantine directory size in bytes.
|
||||
std::size_t quarantineSize();
|
||||
|
||||
|
|
Loading…
Reference in New Issue