haskell-nix / hnix-store

Haskell implementation of the Nix store
Apache License 2.0
83 stars 23 forks source link

remote: add NarFromPath client #279

Closed squalus closed 7 months ago

squalus commented 7 months ago

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 commented 7 months ago

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 commented 7 months ago

Thanks!