Skip to content

Commit

Permalink
remote: delete obsolete funs from Socket
Browse files Browse the repository at this point in the history
  • Loading branch information
sorki committed Dec 7, 2023
1 parent ee7d678 commit 8a74c62
Showing 1 changed file with 1 addition and 68 deletions.
69 changes: 1 addition & 68 deletions hnix-store-remote/src/System/Nix/Store/Remote/Socket.hs
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,11 @@ import Control.Monad.Except (MonadError, throwError)
import Control.Monad.IO.Class (MonadIO(..))
import Control.Monad.Reader (MonadReader, ask, asks)
import Data.ByteString (ByteString)
import Data.HashSet (HashSet)
import Data.Serialize.Get (Get, Result(..))
import Data.Serialize.Put (Put, runPut)
import Network.Socket.ByteString (recv, sendAll)
import System.Nix.StorePath (StorePath)
import System.Nix.Store.Remote.MonadStore (MonadRemoteStore, MonadRemoteStoreR, RemoteStoreError(..), getStoreDir)
import System.Nix.Store.Remote.MonadStore (MonadRemoteStoreR, RemoteStoreError(..))
import System.Nix.Store.Remote.Serializer (NixSerializer, runP, runSerialT)
import System.Nix.Store.Remote.Serialize.Prim (getInt, getByteString, getByteStrings, getPath, getPathsOrFail)
import System.Nix.Store.Remote.Types (HasStoreSocket(..))

import qualified Control.Exception
Expand Down Expand Up @@ -114,67 +111,3 @@ sockGetS s = do
case res of
Right x -> pure x
Left e -> throwError e

-- * Obsolete

getSocketIncremental
:: (MonadRemoteStore m, Show a)
=> Get a
-> m a
getSocketIncremental = genericIncremental sockGet8

sockGet
:: (MonadRemoteStore m, Show a)
=> Get a
-> m a
sockGet = getSocketIncremental

sockGetInt
:: (Integral a, MonadRemoteStore m, Show a)
=> m a
sockGetInt = getSocketIncremental getInt

sockGetBool
:: MonadRemoteStore m
=> m Bool
sockGetBool = (== (1 :: Int)) <$> sockGetInt

sockGetStr
:: MonadRemoteStore m
=> m ByteString
sockGetStr = getSocketIncremental getByteString

sockGetStrings
:: MonadRemoteStore m
=> m [ByteString]
sockGetStrings = getSocketIncremental getByteStrings

sockGetPath
:: MonadRemoteStore m
=> m StorePath
sockGetPath = do
sd <- getStoreDir
pth <- getSocketIncremental (getPath sd)
either
(throwError . RemoteStoreError_Fixme . show)
pure
pth

sockGetPathMay
:: MonadRemoteStore m
=> m (Maybe StorePath)
sockGetPathMay = do
sd <- getStoreDir
pth <- getSocketIncremental (getPath sd)
pure $
either
(const Nothing)
Just
pth

sockGetPaths
:: MonadRemoteStore m
=> m (HashSet StorePath)
sockGetPaths = do
sd <- getStoreDir
getSocketIncremental (getPathsOrFail sd)

0 comments on commit 8a74c62

Please sign in to comment.