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

remote: add NarFromPath client #279

Merged
merged 1 commit into from
Dec 14, 2023
Merged

Conversation

squalus
Copy link
Contributor

@squalus squalus commented Dec 14, 2023

Adds a client for the NarFromPath operation along with a small test.

The NAR size is not provided by the server. The user needs to provide it to the NarFromPath call. It determines how many bytes get read from the server. If the client provides the wrong byte size, the call will fail in a bad way, like hanging open. I don't think there's any way to avoid this.

The size isn't part of the wire protocol so it can't go in the StoreRequest type (roundtrip tests wouldn't work). I elected to put it in RemoteStoreState alongside the sink. This seems unpleasant. There might be a better way to arrange this.

Closes #266

@sorki
Copy link
Member

sorki commented Dec 14, 2023

The size isn't part of the wire protocol so it can't go in the StoreRequest type (roundtrip tests wouldn't work). I elected to put it in RemoteStoreState alongside the sink. This seems unpleasant. There might be a better way to arrange this.

No problem with that, most of the MonadRemoteStore typeclass funs are sort-of internal and I doubt someone will need to override these except for appendLogs which would be helpful to change without also having to boilerplate the rest. (I don't know a good solution to that yet).

@sorki sorki merged commit 4777b21 into haskell-nix:master Dec 14, 2023
10 checks passed
narFromPath path narSize sink = do
setDataSink sink
setDataSinkSize narSize
void $ doReq (NarFromPath path)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you always need to do queryPathInfo to figure out the size before, you might just add it here and possibly return its result as well.

@sorki
Copy link
Member

sorki commented Dec 14, 2023

Thanks!

@squalus squalus deleted the narfrompath branch December 15, 2023 18:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implement NarFromPath operation
2 participants