Safe Haskell | None |
---|---|
Language | Haskell2010 |
Set of helpers helping with writing gRPC clients with not much exposure of the http2-client complexity.
The GrpcClient handles automatic background connection-level window updates to prevent the connection from starving and pings to force a connection alive.
There is no automatic reconnection, retry, or healthchecking. These features are not planned in this library and should be added at higher-levels.
Synopsis
- data GrpcClient = GrpcClient {}
- data BackgroundTasks = BackgroundTasks {
- backgroundWindowUpdate :: Async ()
- backgroundPing :: Async ()
- data GrpcClientConfig = GrpcClientConfig {
- _grpcClientConfigHost :: !HostName
- _grpcClientConfigPort :: !PortNumber
- _grpcClientConfigHeaders :: ![(ByteString, ByteString)]
- _grpcClientConfigTimeout :: !Timeout
- _grpcClientConfigCompression :: !Compression
- _grpcClientConfigTLS :: !(Maybe ClientParams)
- _grpcClientConfigGoAwayHandler :: GoAwayHandler
- _grpcClientConfigFallbackHandler :: FallBackFrameHandler
- _grpcClientConfigWindowUpdateDelay :: Int
- _grpcClientConfigPingDelay :: Int
- grpcClientConfigSimple :: HostName -> PortNumber -> UseTlsOrNot -> GrpcClientConfig
- type UseTlsOrNot = Bool
- tlsSettings :: UseTlsOrNot -> HostName -> PortNumber -> Maybe ClientParams
- setupGrpcClient :: GrpcClientConfig -> IO GrpcClient
- rawUnary :: (Service s, HasMethod s m) => RPC s m -> GrpcClient -> MethodInput s m -> IO (Either TooMuchConcurrency (RawReply (MethodOutput s m)))
- rawStreamServer :: (Service s, HasMethod s m, MethodStreamingType s m ~ ServerStreaming) => RPC s m -> GrpcClient -> a -> MethodInput s m -> (a -> HeaderList -> MethodOutput s m -> IO a) -> IO (Either TooMuchConcurrency (a, HeaderList, HeaderList))
- rawStreamClient :: (Service s, HasMethod s m, MethodStreamingType s m ~ ClientStreaming) => RPC s m -> GrpcClient -> a -> (a -> IO (a, Either StreamDone (CompressMode, MethodInput s m))) -> IO (Either TooMuchConcurrency (a, RawReply (MethodOutput s m)))
Documentation
data GrpcClient Source #
A simplified gRPC Client connected via an HTTP2Client to a given server. Each call from one client will share similar headers, timeout, compression.
GrpcClient | |
|
data BackgroundTasks Source #
BackgroundTasks | |
|
data GrpcClientConfig Source #
Configuration to setup a GrpcClient.
GrpcClientConfig | |
|
type UseTlsOrNot = Bool Source #
tlsSettings :: UseTlsOrNot -> HostName -> PortNumber -> Maybe ClientParams Source #
rawUnary :: (Service s, HasMethod s m) => RPC s m -> GrpcClient -> MethodInput s m -> IO (Either TooMuchConcurrency (RawReply (MethodOutput s m))) Source #
rawStreamServer :: (Service s, HasMethod s m, MethodStreamingType s m ~ ServerStreaming) => RPC s m -> GrpcClient -> a -> MethodInput s m -> (a -> HeaderList -> MethodOutput s m -> IO a) -> IO (Either TooMuchConcurrency (a, HeaderList, HeaderList)) Source #
rawStreamClient :: (Service s, HasMethod s m, MethodStreamingType s m ~ ClientStreaming) => RPC s m -> GrpcClient -> a -> (a -> IO (a, Either StreamDone (CompressMode, MethodInput s m))) -> IO (Either TooMuchConcurrency (a, RawReply (MethodOutput s m))) Source #