diff options
Diffstat (limited to 'src/libfetchers/cache.hh')
-rw-r--r-- | src/libfetchers/cache.hh | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/src/libfetchers/cache.hh b/src/libfetchers/cache.hh new file mode 100644 index 000000000..d76ab1233 --- /dev/null +++ b/src/libfetchers/cache.hh @@ -0,0 +1,34 @@ +#pragma once + +#include "fetchers.hh" + +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; + + struct Result + { + bool expired = false; + Attrs infoAttrs; + StorePath storePath; + }; + + virtual std::optional<Result> lookupExpired( + ref<Store> store, + const Attrs & inAttrs) = 0; +}; + +ref<Cache> getCache(); + +} |