mirror of
https://github.com/haskell-nix/hnix-store.git
synced 2024-09-11 18:05:56 +03:00
remote: pretty doReq, add haddock
This commit is contained in:
parent
b506f1a2d7
commit
2443d3859f
@ -93,6 +93,7 @@ runOpArgsIO op encoder = do
|
||||
|
||||
processOutput
|
||||
|
||||
-- | Perform @StoreRequest@
|
||||
doReq
|
||||
:: forall m a
|
||||
. ( MonadIO m
|
||||
@ -104,7 +105,13 @@ doReq
|
||||
-> m a
|
||||
doReq = \case
|
||||
x -> do
|
||||
sockPutS (mapErrorS RemoteStoreError_SerializerPut storeRequest) (Some x)
|
||||
sockPutS
|
||||
(mapErrorS
|
||||
RemoteStoreError_SerializerPut
|
||||
storeRequest
|
||||
)
|
||||
(Some x)
|
||||
|
||||
case x of
|
||||
AddToStore {} -> do
|
||||
|
||||
@ -112,14 +119,20 @@ doReq = \case
|
||||
case ms of
|
||||
Just (stream :: NarSource IO) -> do
|
||||
soc <- getStoreSocket
|
||||
liftIO $ stream $ Network.Socket.ByteString.sendAll soc
|
||||
Nothing -> throwError RemoteStoreError_NoNarSourceProvided
|
||||
liftIO
|
||||
$ stream
|
||||
$ Network.Socket.ByteString.sendAll soc
|
||||
Nothing ->
|
||||
throwError
|
||||
RemoteStoreError_NoNarSourceProvided
|
||||
|
||||
_ -> pure ()
|
||||
|
||||
processOutput
|
||||
sockGetS (mapErrorS RemoteStoreError_SerializerGet (getReply @a))
|
||||
|
||||
sockGetS
|
||||
(mapErrorS RemoteStoreError_SerializerGet
|
||||
$ getReply @a
|
||||
)
|
||||
|
||||
class StoreReply a where
|
||||
getReply
|
||||
|
Loading…
Reference in New Issue
Block a user