Nix
2.36.0
Nix, the purely functional package manager; unstable internal interfaces
Toggle main menu visibility
Loading...
Searching...
No Matches
nar-info-disk-cache.hh
Go to the documentation of this file.
1
#pragma once
3
4
#include "
nix/util/ref.hh
"
5
#include "
nix/store/nar-info.hh
"
6
#include "
nix/store/realisation.hh
"
7
8
namespace
nix {
9
10
struct
SQLiteSettings
;
11
struct
NarInfoDiskCacheSettings
;
12
13
struct
NarInfoDiskCache
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
using
Settings =
NarInfoDiskCacheSettings
;
21
22
const
Settings & settings;
23
24
NarInfoDiskCache(
const
Settings & settings)
25
: settings(settings)
26
{
27
}
28
29
typedef
enum
{ oValid, oInvalid, oUnknown } Outcome;
30
31
virtual
~NarInfoDiskCache() {}
32
33
struct
CacheInfo
34
{
35
int
id
= 0;
36
bool
wantMassQuery =
false
;
37
int
priority = 0;
38
};
39
44
virtual
int
createCache
(
const
std::string & uri,
const
std::string & storeDir,
const
CacheInfo
& info) = 0;
45
46
virtual
std::optional<CacheInfo> upToDateCacheExists(
const
std::string & uri) = 0;
47
48
virtual
std::pair<Outcome, std::shared_ptr<NarInfo>>
49
lookupNarInfo(
const
std::string & uri,
const
std::string & hashPart) = 0;
50
51
virtual
void
52
upsertNarInfo(
const
std::string & uri,
const
std::string & hashPart, std::shared_ptr<const ValidPathInfo> info) = 0;
53
54
virtual
void
upsertRealisation(
const
std::string & uri,
const
Realisation
& realisation) = 0;
55
virtual
void
upsertAbsentRealisation(
const
std::string & uri,
const
DrvOutput
&
id
) = 0;
56
virtual
std::pair<Outcome, std::shared_ptr<Realisation>>
57
lookupRealisation(
const
std::string & uri,
const
DrvOutput
&
id
) = 0;
58
69
static
ref<NarInfoDiskCache>
get
(
const
Settings & settings,
SQLiteSettings
);
70
71
static
ref<NarInfoDiskCache>
getTest(
const
Settings & settings,
SQLiteSettings
, std::filesystem::path dbPath);
72
};
73
74
}
// namespace nix
nix::ref
Definition
ref.hh:58
nar-info.hh
realisation.hh
ref.hh
nix::DrvOutput
Definition
realisation.hh:26
nix::NarInfoDiskCacheSettings
Definition
globals.hh:51
nix::NarInfoDiskCache::CacheInfo
Definition
nar-info-disk-cache.hh:34
nix::NarInfoDiskCache::get
static ref< NarInfoDiskCache > get(const Settings &settings, SQLiteSettings)
Definition
nar-info-disk-cache.cc:424
nix::NarInfoDiskCache::createCache
virtual int createCache(const std::string &uri, const std::string &storeDir, const CacheInfo &info)=0
nix::Realisation
Definition
realisation.hh:103
nix::SQLiteSettings
Definition
sqlite.hh:37
libstore
include
nix
store
nar-info-disk-cache.hh
Generated by
1.18.0