Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add withConnection function to hnix-store-remote #280

Open
squalus opened this issue May 21, 2024 · 1 comment
Open

Add withConnection function to hnix-store-remote #280

squalus opened this issue May 21, 2024 · 1 comment
Labels
remote `hnix-store-remote` related

Comments

@squalus
Copy link
Contributor

squalus commented May 21, 2024

Writing an application that connects to several different Nix stores concurrently (with the number variable at runtime) is quite awkward. It would require either:

  1. Create a monad transformer that can store a runtime-variable list of monads and allow the application to access an element by index
  2. Put each RemoteStore monad in a different thread and communicate to it over STM.

It seems that monadic sequencing is not strictly necessary to model the remote store functions. It could be accomplished with a withConnection function, and that would make it much easier to write the application that I described. I'm open to other suggestions. Perhaps there's an alternative I haven't thought of.

@sorki
Copy link
Member

sorki commented Jun 4, 2024

Do you have a proof of concept/example or just a signature of withConnection function?

Might be useful to have some draft to talk about, while current runStore is mostly just a reader monad wrapping underlying connection I haven't actually tried writing a multi-store client with dynamic number of stores (nor static!) so I have no idea tbh.

@sorki sorki added the remote `hnix-store-remote` related label Jun 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
remote `hnix-store-remote` related
Projects
None yet
Development

No branches or pull requests

2 participants