aboutsummaryrefslogtreecommitdiff
path: root/src/libstore/local-store.hh
diff options
context:
space:
mode:
authorBen Radford <benradf@users.noreply.github.com>2023-07-11 09:38:34 +0100
committerBen Radford <benradf@users.noreply.github.com>2023-07-11 09:38:34 +0100
commit25b20b4ad23d05d9a1e9daf105d33b7b68e4435b (patch)
tree18a5255ce272403ccfd34ab0aaad7135aed50a02 /src/libstore/local-store.hh
parent754ced4a3f6d3d8865ba78a2e503776d7bd6c04f (diff)
parent4a880c3cc085841a1537040405bc142fefffd7ff (diff)
Merge remote-tracking branch 'origin/master' into best-effort-supplementary-groups
Diffstat (limited to 'src/libstore/local-store.hh')
-rw-r--r--src/libstore/local-store.hh23
1 files changed, 21 insertions, 2 deletions
diff --git a/src/libstore/local-store.hh b/src/libstore/local-store.hh
index 55add18dd..8a3b0b43f 100644
--- a/src/libstore/local-store.hh
+++ b/src/libstore/local-store.hh
@@ -46,6 +46,23 @@ struct LocalStoreConfig : virtual LocalFSStoreConfig
"require-sigs",
"Whether store paths copied into this store should have a trusted signature."};
+ Setting<bool> readOnly{(StoreConfig*) this,
+ false,
+ "read-only",
+ R"(
+ Allow this store to be opened when its [database](@docroot@/glossary.md#gloss-nix-database) is on a read-only filesystem.
+
+ Normally Nix will attempt to open the store database in read-write mode, even for querying (when write access is not needed), causing it to fail if the database is on a read-only filesystem.
+
+ Enable read-only mode to disable locking and open the SQLite database with the [`immutable` parameter](https://www.sqlite.org/c3ref/open.html) set.
+
+ > **Warning**
+ > Do not use this unless the filesystem is read-only.
+ >
+ > Using it when the filesystem is writable can cause incorrect query results or corruption errors if the database is changed by another process.
+ > While the filesystem the database resides on might appear to be read-only, consider whether another user or system might have write access to it.
+ )"};
+
const std::string name() override { return "Local Store"; }
std::string doc() override;
@@ -240,8 +257,6 @@ public:
void vacuumDB();
- void repairPath(const StorePath & path) override;
-
void addSignatures(const StorePath & storePath, const StringSet & sigs) override;
/**
@@ -271,6 +286,10 @@ public:
private:
+ /**
+ * Retrieve the current version of the database schema.
+ * If the database does not exist yet, the version returned will be 0.
+ */
int getSchema();
void openDB(State & state, bool create);