Skip to content

Use MemorySourceAccessor in DummyStore so writes work#10915

Merged
roberth merged 3 commits intomasterfrom
dummy-memory
Sep 17, 2025
Merged

Use MemorySourceAccessor in DummyStore so writes work#10915
roberth merged 3 commits intomasterfrom
dummy-memory

Conversation

@Ericson2314
Copy link
Member

Motivation

This makes the dummy store a lot more useful. In particular, it opens the door to running complex integration-ish store tests entirely in memory as part of the units tests so we have a reference implementation to hold against other store implementations.

Context

This was originally made for #10874.

Add read-only setting to dummy:// store for back compat/

Priorities and Process

Add 👍 to pull requests you find important.

The Nix maintainer team uses a GitHub project board to schedule and track reviews.

@Ericson2314 Ericson2314 requested a review from thufschmitt as a code owner June 14, 2024 21:03
@github-actions github-actions bot added the store Issues and pull requests concerning the Nix store label Jun 14, 2024
@Ericson2314
Copy link
Member Author

Note that per #13757,

// TODO: Use dummy:// store with MemorySourceAccessor.
Path storeTmpDir = createTempDir();
auto storeTmpDirAutoDelete = AutoDelete(storeTmpDir, true);
ref<Store> store = openStore(storeTmpDir);
is what we'd like to replace with this.

@github-project-automation github-project-automation bot moved this to Triage in Nix team Aug 21, 2025
@roberth roberth self-assigned this Sep 17, 2025
This will useful for unit tests.
Add `read-only` setting to `dummy://` store for back compat.

Test by changing an existing test to use this instead, fixing a TODO.

Co-Authored-By: HaeNoe <git@haenoe.party>
Co-authored-by: Eelco Dolstra <edolstra@gmail.com>
@roberth roberth merged commit 3eb223f into master Sep 17, 2025
25 checks passed
@roberth roberth deleted the dummy-memory branch September 17, 2025 20:33
@nixos-discourse
Copy link

This pull request has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/2025-09-17-nix-team-meeting-minutes-248/69508/1

@fzakaria
Copy link
Contributor

Sick!

I actually think memory as a store name would be better as an alternative store.....

Dummy being "dumb" was kind of nice -- it was almost like "DevNullStore"

@xokdvium
Copy link
Contributor

it was almost like "DevNullStore"

It still is. You can't actually query store paths from it.

@fzakaria
Copy link
Contributor

@xokdvium maybe I mis read the description but I thought you could now.. that's why it needs "read-only" for back-compat.

You can write to it but not read ? Yet?..... ;P

@xokdvium
Copy link
Contributor

You can write to it but not read

Sort of. You can't query path infos now and some of the stuff breaks. This is enough for the purposes of unit tests though.

@Ericson2314
Copy link
Member Author

Oh oops I meant for it to support querying path infos? Or at least I didn't intentionally make that not work.

If we want to separate memory store from dummy store, that's fine for me too.

@xokdvium
Copy link
Contributor

for it to support querying path infos

Then queryPathInfosUncached needs to be implemented?

@Ericson2314
Copy link
Member Author

Ah yeah I remember now, I wanted a map with the values being pairs of valid path infos and memory source accessors, but the interface still expects a single source accessor for the entire store.

@fzakaria
Copy link
Contributor

@Ericson2314 i'm down to pair on that.
I'd be really up to:

  • add a new Store type "memory://"
  • Remove the write from DummyStore (keep at NullInput and Nulloutput)
  • Add read/write support to memory
  • bonus: if we make memory:// use a sqlite memory database for the store (BLOB), we could trivially have it emit sqlite databases which could be a cool way to ship and reproduce bug.

@Ericson2314
Copy link
Member Author

OH oops @fzakaria, I already started this!

@fzakaria
Copy link
Contributor

@Ericson2314 you even had the sqlite idea too?!
(We are sync'd ?)

@Ericson2314
Copy link
Member Author

Nah not that part. Keeping it it all pure C++

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

store Issues and pull requests concerning the Nix store

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

6 participants