|
@@ -2,11 +2,11 @@
|
|
|
|
|
|
module Walrus.Backend (
|
|
|
Backend(..),
|
|
|
- BackendHandler,
|
|
|
+ LazyHandler,
|
|
|
module Walrus.Backend.Metadata,
|
|
|
parseBackend,
|
|
|
callBackend,
|
|
|
- runBackendOnce
|
|
|
+ runLazyOnce
|
|
|
) where
|
|
|
|
|
|
import qualified Data.Attoparsec.ByteString.Char8 as A
|
|
@@ -31,7 +31,7 @@ import qualified System.Process as P
|
|
|
data Backend = TCPBackend String Int |
|
|
|
ExecBackend String [String] deriving (Show, Read, Ord, Eq)
|
|
|
|
|
|
-type BackendHandler = Metadata -> LBS.ByteString -> IO (Either String (Metadata, LBS.ByteString))
|
|
|
+type LazyHandler = Metadata -> LBS.ByteString -> IO (Either String (Metadata, LBS.ByteString))
|
|
|
|
|
|
parseBackend :: A.Parser Backend
|
|
|
parseBackend = A.choice [
|
|
@@ -79,8 +79,8 @@ callBackend b (m, qdt) = do
|
|
|
intBk (ExecBackend f aa) = runExec f aa
|
|
|
repParse = parseMetadata
|
|
|
|
|
|
-runBackendOnce :: UniformIO u => u -> BackendHandler -> IO (Either String ())
|
|
|
-runBackendOnce u f = withTarget u $ do
|
|
|
+runLazyOnce :: UniformIO u => u -> LazyHandler -> IO (Either String ())
|
|
|
+runLazyOnce u f = withTarget u $ do
|
|
|
m' <- runAttoparsec parseMetadata
|
|
|
case m' of
|
|
|
Left e -> return . Left . show $ e
|