Nix
2.36.0
Nix, the purely functional package manager; unstable internal interfaces
Toggle main menu visibility
Loading...
Searching...
No Matches
dummy-store.hh
Go to the documentation of this file.
1
#pragma once
3
4
#include "
nix/store/store-api.hh
"
5
#include "
nix/util/json-impls.hh
"
6
7
#include <boost/unordered/concurrent_flat_map.hpp>
8
9
namespace
nix {
10
11
struct
DummyStore
;
12
13
struct
DummyStoreConfig :
public
std::enable_shared_from_this<DummyStoreConfig>,
virtual
StoreConfig
14
{
15
private
:
16
void
anchor()
override
;
17
18
public
:
19
DummyStoreConfig(
const
Params & params)
20
: StoreConfig(params,
FilePathType::Unix
)
21
{
22
// Disable caching since this a temporary in-memory store.
23
pathInfoCacheSize = 0;
24
}
25
26
DummyStoreConfig(std::string_view scheme, std::string_view authority,
const
Params & params)
27
: DummyStoreConfig(params)
28
{
29
if
(!authority.empty())
30
throw
UsageError
(
"`%s` store URIs must not contain an authority part %s"
, scheme, authority);
31
}
32
33
Setting<bool>
readOnly{
34
this
,
35
true
,
36
"read-only"
,
37
R
"(
38
Make any sort of write fail instead of succeeding.
39
No additional memory will be used, because no information needs to be stored.
40
)"};
41
42
bool
getReadOnly
()
const override
;
43
44
static
const
std::string name()
45
{
46
return
"Dummy Store"
;
47
}
48
49
static
std::string doc();
50
51
static
StringSet
uriSchemes()
52
{
53
return
{
"dummy"
};
54
}
55
59
ref<DummyStore>
openDummyStore
()
const
;
60
61
ref<Store>
openStore
()
const override
;
62
63
StoreReference
getReference
()
const override
64
{
65
return
{
66
.variant =
67
StoreReference::Specified{
68
.scheme = *uriSchemes().begin(),
69
},
70
.params =
getQueryParams
(),
71
};
72
}
73
};
74
75
template
<>
76
struct
json_avoids_null<nix::DummyStoreConfig> : std::true_type
77
{};
78
79
template
<>
80
struct
json_avoids_null<
ref
<nix::
DummyStoreConfig
>> : std::true_type
81
{};
82
83
template
<>
84
struct
json_avoids_null<nix::
DummyStore
> : std::true_type
85
{};
86
87
template
<>
88
struct
json_avoids_null<
ref
<nix::
DummyStore
>> : std::true_type
89
{};
90
91
}
// namespace nix
92
93
namespace
nlohmann {
94
95
template
<>
96
JSON_IMPL_INNER_TO(nix::DummyStoreConfig);
97
template
<>
98
JSON_IMPL_INNER_FROM(nix::ref<nix::DummyStoreConfig>);
99
template
<>
100
JSON_IMPL_INNER_TO(nix::DummyStore);
101
template
<>
102
JSON_IMPL_INNER_FROM(nix::ref<nix::DummyStore>);
103
104
}
// namespace nlohmann
nix::Setting
Definition
configuration.hh:476
nix::UsageError
Definition
error.hh:311
nix::ref
Definition
ref.hh:58
json-impls.hh
store-api.hh
nix::DummyStoreConfig
Definition
dummy-store.hh:14
nix::DummyStoreConfig::openDummyStore
ref< DummyStore > openDummyStore() const
Definition
dummy-store.cc:398
nix::DummyStoreConfig::openStore
ref< Store > openStore() const override
Definition
dummy-store.cc:128
nix::DummyStoreConfig::getReference
StoreReference getReference() const override
Definition
dummy-store.hh:63
nix::DummyStoreConfig::getReadOnly
bool getReadOnly() const override
Definition
dummy-store.cc:133
nix::DummyStore
Definition
dummy-store-impl.hh:17
nix::StoreConfigBase::FilePathType::Unix
@ Unix
Definition
store-api.hh:131
nix::StoreConfig::getQueryParams
StringMap getQueryParams() const
Definition
store-api.hh:266
nix::StringSet
std::set< std::string, std::less<> > StringSet
Definition
types.hh:45
libstore
include
nix
store
dummy-store.hh
Generated by
1.18.0