Nix 2.26.3
Nix, the purely functional package manager; unstable internal interfaces
 
Loading...
Searching...
No Matches
cache.hh
Go to the documentation of this file.
1#pragma once
3
4#include "fetchers.hh"
5#include "path.hh"
6
7namespace nix::fetchers {
8
13struct Cache
14{
15 virtual ~Cache() { }
16
21 using Domain = std::string_view;
22
26 using Key = std::pair<Domain, Attrs>;
27
31 virtual void upsert(
32 const Key & key,
33 const Attrs & value) = 0;
34
38 virtual std::optional<Attrs> lookup(
39 const Key & key) = 0;
40
45 virtual std::optional<Attrs> lookupWithTTL(
46 const Key & key) = 0;
47
48 struct Result
49 {
50 bool expired = false;
51 Attrs value;
52 };
53
58 virtual std::optional<Result> lookupExpired(
59 const Key & key) = 0;
60
66 virtual void upsert(
67 Key key,
68 Store & store,
70 const StorePath & storePath) = 0;
71
73 {
74 StorePath storePath;
75 };
76
81 virtual std::optional<ResultWithStorePath> lookupStorePath(
82 Key key,
83 Store & store) = 0;
84
89 virtual std::optional<ResultWithStorePath> lookupStorePathWithTTL(
90 Key key,
91 Store & store) = 0;
92};
93
94ref<Cache> getCache();
95
96}
std::map< std::string, Attr > Attrs
Definition attrs.hh:22
Definition path.hh:27
Definition store-api.hh:169
Definition ref.hh:15
ChunkedVector< std::string, 8192 > store
Definition lexer.l:1011
const T::key_type & key
Definition lexer.l:2763
const T & value
Definition lexer.l:492
Definition cache.hh:49
Definition cache.hh:14
virtual void upsert(Key key, Store &store, Attrs value, const StorePath &storePath)=0
virtual std::optional< ResultWithStorePath > lookupStorePath(Key key, Store &store)=0
std::string_view Domain
Definition cache.hh:21
virtual std::optional< Attrs > lookup(const Key &key)=0
virtual std::optional< Attrs > lookupWithTTL(const Key &key)=0
virtual std::optional< ResultWithStorePath > lookupStorePathWithTTL(Key key, Store &store)=0
virtual std::optional< Result > lookupExpired(const Key &key)=0
std::pair< Domain, Attrs > Key
Definition cache.hh:26
virtual void upsert(const Key &key, const Attrs &value)=0