lix/src/libfetchers/cache.hh

35 lines
642 B
C++
Raw Normal View History

2020-03-17 19:54:36 +00:00
#pragma once
#include "fetchers.hh"
2020-03-17 19:54:36 +00:00
namespace nix::fetchers {
struct Cache
{
virtual void add(
ref<Store> store,
const Attrs & inAttrs,
const Attrs & infoAttrs,
const StorePath & storePath,
bool immutable) = 0;
virtual std::optional<std::pair<Attrs, StorePath>> lookup(
ref<Store> store,
const Attrs & inAttrs) = 0;
2020-03-18 14:14:23 +00:00
struct Result
{
bool expired = false;
Attrs infoAttrs;
StorePath storePath;
};
virtual std::optional<Result> lookupExpired(
ref<Store> store,
const Attrs & inAttrs) = 0;
2020-03-17 19:54:36 +00:00
};
ref<Cache> getCache();
}