Upgrading dependency to Thrift 0.12.0

This commit is contained in:
Renan DelValle 2018-11-27 18:03:50 -08:00
parent 3e4590dcc0
commit 356978cb42
No known key found for this signature in database
GPG key ID: C240AD6D6F443EC9
1302 changed files with 101701 additions and 26784 deletions

View file

@ -48,6 +48,7 @@ import Thrift.Transport.Framed
import Thrift.Transport.Handle
import Thrift.Protocol.Binary
import Thrift.Protocol.Compact
import Thrift.Protocol.Header
import Thrift.Protocol.JSON
data Options = Options
@ -90,11 +91,13 @@ getTransport t = NoTransport $ "Unsupported transport: " ++ t
data ProtocolType = Binary
| Compact
| JSON
| Header
getProtocol :: String -> ProtocolType
getProtocol "binary" = Binary
getProtocol "compact" = Compact
getProtocol "json" = JSON
getProtocol "header" = Header
getProtocol p = error $"Unsupported Protocol: " ++ p
defaultOptions :: Options
@ -261,13 +264,19 @@ main = do
t <- f socket
return (p t, p t)
headerAcceptor f socket = do
t <- f socket
p <- createHeaderProtocol1 t
return (p, p)
doRunServer p f = do
runThreadedServer (acceptor p f) TestHandler ThriftTest.process . PortNumber . fromIntegral
runServer p f port = case p of
Binary -> do doRunServer BinaryProtocol f port
Compact -> do doRunServer CompactProtocol f port
JSON -> do doRunServer JSONProtocol f port
Binary -> doRunServer BinaryProtocol f port
Compact -> doRunServer CompactProtocol f port
JSON -> doRunServer JSONProtocol f port
Header -> runThreadedServer (headerAcceptor f) TestHandler ThriftTest.process (PortNumber $ fromIntegral port)
parseFlags :: [String] -> Options -> Maybe Options
parseFlags (flag : flags) opts = do