mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-21 04:45:31 +08:00
refs #646 Log messages when saving and loading data cache values.
This commit is contained in:
@@ -234,7 +234,9 @@ namespace BlackMisc
|
|||||||
if (! lock) { return; }
|
if (! lock) { return; }
|
||||||
m_cache->m_revision.writeNewRevision(baseline.toTimestampMap());
|
m_cache->m_revision.writeNewRevision(baseline.toTimestampMap());
|
||||||
|
|
||||||
m_cache->saveToFiles(persistentStore(), values);
|
auto msg = m_cache->saveToFiles(persistentStore(), values);
|
||||||
|
msg.setCategories(this);
|
||||||
|
CLogMessage::preformatted(msg);
|
||||||
|
|
||||||
applyDeferredChanges(); // apply changes which we grabbed at the last minute above
|
applyDeferredChanges(); // apply changes which we grabbed at the last minute above
|
||||||
}
|
}
|
||||||
@@ -245,7 +247,9 @@ namespace BlackMisc
|
|||||||
if (lock && m_cache->m_revision.isPendingRead())
|
if (lock && m_cache->m_revision.isPendingRead())
|
||||||
{
|
{
|
||||||
CValueCachePacket newValues;
|
CValueCachePacket newValues;
|
||||||
m_cache->loadFromFiles(persistentStore(), m_cache->m_revision.keysWithNewerTimestamps(), baseline.toVariantMap(), newValues);
|
auto msg = m_cache->loadFromFiles(persistentStore(), m_cache->m_revision.keysWithNewerTimestamps(), baseline.toVariantMap(), newValues);
|
||||||
|
msg.setCategories(this);
|
||||||
|
CLogMessage::preformatted(msg);
|
||||||
m_deferredChanges.insert(newValues);
|
m_deferredChanges.insert(newValues);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -192,6 +192,13 @@ namespace BlackMisc
|
|||||||
//! Implicit conversion to any container of value_type which supports push_back. This will copy elements.
|
//! Implicit conversion to any container of value_type which supports push_back. This will copy elements.
|
||||||
template <class T, class = std::enable_if_t<std::is_convertible<value_type, typename T::value_type>::value>>
|
template <class T, class = std::enable_if_t<std::is_convertible<value_type, typename T::value_type>::value>>
|
||||||
operator T() const
|
operator T() const
|
||||||
|
{
|
||||||
|
return to<T>();
|
||||||
|
}
|
||||||
|
|
||||||
|
//! Explicit conversion to any container of value_type which supports push_back. This will copy elements.
|
||||||
|
template <class T>
|
||||||
|
T to() const
|
||||||
{
|
{
|
||||||
T container;
|
T container;
|
||||||
std::copy(begin(), end(), std::back_inserter(container));
|
std::copy(begin(), end(), std::back_inserter(container));
|
||||||
|
|||||||
@@ -304,7 +304,7 @@ namespace BlackMisc
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
return CStatusMessage(this, CStatusMessage::SeverityInfo,
|
return CStatusMessage(this, CStatusMessage::SeverityInfo,
|
||||||
QString("Written %1 files for value cache in %2").arg(namespaces.size()).arg(dir));
|
QString("Written %1 to value cache in %2").arg(values.keys().to<QStringList>().join(",")).arg(dir));
|
||||||
}
|
}
|
||||||
|
|
||||||
CStatusMessage CValueCache::loadFromFiles(const QString &dir)
|
CStatusMessage CValueCache::loadFromFiles(const QString &dir)
|
||||||
@@ -347,7 +347,7 @@ namespace BlackMisc
|
|||||||
o_values.insert(temp, QFileInfo(file).lastModified().toMSecsSinceEpoch());
|
o_values.insert(temp, QFileInfo(file).lastModified().toMSecsSinceEpoch());
|
||||||
}
|
}
|
||||||
return CStatusMessage(this, CStatusMessage::SeverityInfo,
|
return CStatusMessage(this, CStatusMessage::SeverityInfo,
|
||||||
QString("Loaded value cache from %1 files in %2").arg(entries.size()).arg(dir));
|
QString("Loaded cache values %1 from %2").arg(o_values.keys().to<QStringList>().join(",")).arg(dir));
|
||||||
}
|
}
|
||||||
|
|
||||||
void CValueCache::markAllAsSaved(const QString &keyPrefix)
|
void CValueCache::markAllAsSaved(const QString &keyPrefix)
|
||||||
|
|||||||
Reference in New Issue
Block a user