Nix 2.36.0
Nix, the purely functional package manager; unstable internal interfaces
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"
7
8namespace nix {
9
10struct SQLiteSettings;
12
13struct NarInfoDiskCache
14{
15private:
16 /* VTable anchor to avoid weak linkage of the vtable - it breaks
17 dynamic_cast across shared libraries on Darwin. */
18 virtual void anchor();
19public:
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
Definition ref.hh:58
Definition realisation.hh:26
Definition globals.hh:51
Definition nar-info-disk-cache.hh:34
static ref< NarInfoDiskCache > get(const Settings &settings, SQLiteSettings)
Definition nar-info-disk-cache.cc:424
virtual int createCache(const std::string &uri, const std::string &storeDir, const CacheInfo &info)=0
Definition realisation.hh:103
Definition sqlite.hh:37