#include <Checksum.hpp>
#include <Config.hpp>
#include <Logging.hpp>
+#include <MiniTrace.hpp>
#include <TemporaryFile.hpp>
#include <Util.hpp>
#include <assertions.hpp>
nonstd::optional<std::string>
Storage::get(const Digest& key, const core::CacheEntryType type)
{
+ MTR_SCOPE("storage", "get");
+
const auto path = primary.get(key, type);
primary.increment_statistic(path ? core::Statistic::primary_storage_hit
: core::Statistic::primary_storage_miss);
const core::CacheEntryType type,
const storage::EntryWriter& entry_writer)
{
+ MTR_SCOPE("storage", "put");
+
const auto path = primary.put(key, type, entry_writer);
if (!path) {
return false;
void
Storage::remove(const Digest& key, const core::CacheEntryType type)
{
+ MTR_SCOPE("storage", "remove");
+
primary.remove(key, type);
remove_from_secondary_storage(key);
}
nonstd::optional<std::pair<std::string, bool>>
Storage::get_from_secondary_storage(const Digest& key)
{
+ MTR_SCOPE("secondary_storage", "get");
+
for (const auto& entry : m_secondary_storages) {
auto backend = get_backend(*entry, key, "getting from", false);
if (!backend) {
const std::string& value,
bool only_if_missing)
{
+ MTR_SCOPE("secondary_storage", "put");
+
for (const auto& entry : m_secondary_storages) {
auto backend = get_backend(*entry, key, "putting in", true);
if (!backend) {
void
Storage::remove_from_secondary_storage(const Digest& key)
{
+ MTR_SCOPE("secondary_storage", "remove");
+
for (const auto& entry : m_secondary_storages) {
auto backend = get_backend(*entry, key, "removing from", true);
if (!backend) {
nonstd::optional<std::string>
PrimaryStorage::get(const Digest& key, const core::CacheEntryType type) const
{
+ MTR_SCOPE("primary_storage", "get");
+
const auto cache_file = look_up_cache_file(key, type);
if (!cache_file.stat) {
LOG("No {} in primary storage", key.to_string());
const core::CacheEntryType type,
const storage::EntryWriter& entry_writer)
{
+ MTR_SCOPE("primary_storage", "put");
+
const auto cache_file = look_up_cache_file(key, type);
switch (type) {
case core::CacheEntryType::manifest:
void
PrimaryStorage::remove(const Digest& key, const core::CacheEntryType type)
{
+ MTR_SCOPE("primary_storage", "remove");
+
const auto cache_file = look_up_cache_file(key, type);
if (cache_file.stat) {
Util::unlink_safe(cache_file.path);