Nix
2.36.0
Nix, the purely functional package manager; unstable internal interfaces
Toggle main menu visibility
Loading...
Searching...
No Matches
cache.hh
Go to the documentation of this file.
1
#pragma once
3
4
#include "
nix/fetchers/fetchers.hh
"
5
#include "
nix/store/path.hh
"
6
7
namespace
nix::fetchers {
8
13
struct
Cache
14
{
15
private
:
16
/* VTable anchor to avoid weak linkage of the vtable - it breaks
17
dynamic_cast across shared libraries on Darwin. */
18
virtual
void
anchor();
19
public
:
20
virtual
~Cache
() {}
21
26
using
Domain
= std::string_view;
27
31
using
Key
= std::pair<Domain, Attrs>;
32
36
virtual
void
upsert
(
const
Key
& key,
const
Attrs
& value) = 0;
37
41
virtual
std::optional<Attrs>
lookup
(
const
Key
& key) = 0;
42
47
virtual
std::optional<Attrs>
lookupWithTTL
(
const
Key
& key) = 0;
48
49
struct
Result
50
{
51
bool
expired =
false
;
52
Attrs
value;
53
};
54
59
virtual
std::optional<Result>
lookupExpired
(
const
Key
& key) = 0;
60
66
virtual
void
upsert
(
Key
key,
Store
& store,
Attrs
value,
const
StorePath
& storePath) = 0;
67
68
struct
ResultWithStorePath
:
Result
69
{
70
StorePath
storePath;
71
};
72
77
virtual
std::optional<ResultWithStorePath>
lookupStorePath
(
Key
key,
Store
& store) = 0;
78
83
virtual
std::optional<ResultWithStorePath>
lookupStorePathWithTTL
(
Key
key,
Store
& store) = 0;
84
};
85
86
}
// namespace nix::fetchers
nix::fetchers::Attrs
std::map< std::string, Attr > Attrs
Definition
attrs.hh:68
nix::StorePath
Definition
path.hh:33
nix::Store
Definition
store-api.hh:397
fetchers.hh
path.hh
nix::fetchers::Cache::ResultWithStorePath
Definition
cache.hh:69
nix::fetchers::Cache::Result
Definition
cache.hh:50
nix::fetchers::Cache
Definition
cache.hh:14
nix::fetchers::Cache::upsert
virtual void upsert(Key key, Store &store, Attrs value, const StorePath &storePath)=0
nix::fetchers::Cache::lookupStorePath
virtual std::optional< ResultWithStorePath > lookupStorePath(Key key, Store &store)=0
nix::fetchers::Cache::Domain
std::string_view Domain
Definition
cache.hh:26
nix::fetchers::Cache::lookup
virtual std::optional< Attrs > lookup(const Key &key)=0
nix::fetchers::Cache::lookupWithTTL
virtual std::optional< Attrs > lookupWithTTL(const Key &key)=0
nix::fetchers::Cache::lookupStorePathWithTTL
virtual std::optional< ResultWithStorePath > lookupStorePathWithTTL(Key key, Store &store)=0
nix::fetchers::Cache::lookupExpired
virtual std::optional< Result > lookupExpired(const Key &key)=0
nix::fetchers::Cache::Key
std::pair< Domain, Attrs > Key
Definition
cache.hh:31
nix::fetchers::Cache::upsert
virtual void upsert(const Key &key, const Attrs &value)=0
libfetchers
include
nix
fetchers
cache.hh
Generated by
1.18.0