| Safe Haskell | Safe-Inferred |
|---|---|
| Language | Haskell2010 |
Utxorpc.Client
Description
Create a UTxO RPC client connected to a UTxO RPC service. The provides functions for each of the methods in the UTxO RPC specification.
Provide a UtxorpcClientLogger to perform automated logging.UtxorpcClient
Synopsis
- data UtxorpcInfo m = UtxorpcInfo {
- _hostName :: HostName
- _portNumber :: PortNumber
- _tlsEnabled :: UseTlsOrNot
- _useGzip :: Bool
- _clientHeaders :: [(ByteString, ByteString)]
- _logger :: Maybe (UtxorpcClientLogger m)
- utxorpcClient :: UtxorpcInfo m -> IO (Either ClientError UtxorpcClient)
- simpleUtxorpcClient :: HostName -> PortNumber -> UseTlsOrNot -> IO (Either ClientError UtxorpcClient)
- utxorpcClientWith :: GrpcClientConfig -> Maybe (UtxorpcClientLogger m) -> IO (Either ClientError UtxorpcClient)
- data UtxorpcClientLogger m = UtxorpcClientLogger {
- requestLogger :: RequestLogger m
- replyLogger :: ReplyLogger m
- serverStreamLogger :: ServerStreamLogger m
- serverStreamEndLogger :: ServerStreamEndLogger m
- unlift :: forall x. m x -> IO x
- type RequestLogger m = forall i. (Show i, Message i) => ByteString -> GrpcClient -> UUID -> i -> m ()
- type ReplyLogger m = forall o. (Show o, Message o) => ByteString -> GrpcClient -> UUID -> Either ClientError (Either TooMuchConcurrency (RawReply o)) -> m ()
- type ServerStreamLogger m = forall o. (Show o, Message o) => ByteString -> GrpcClient -> (UUID, Int) -> o -> m ()
- type ServerStreamEndLogger m = ByteString -> GrpcClient -> (UUID, Int) -> (HeaderList, HeaderList) -> m ()
Documentation
data UtxorpcInfo m Source #
Configuration info for a UTxO RPC Client.
For more fine-grained control, use and GrpcClientConfigUtxorpcClientWith
Constructors
| UtxorpcInfo | |
Fields
| |
utxorpcClient :: UtxorpcInfo m -> IO (Either ClientError UtxorpcClient) Source #
Connect to a UTxO RPC service from a .
Provides more configurability than UtxorpcInfo but less than simpleUtxorpcClient.utxorpcClientWith
Arguments
| :: HostName | Host name of the service. |
| -> PortNumber | Port number of the service. |
| -> UseTlsOrNot | Whether or not to use TLS. |
| -> IO (Either ClientError UtxorpcClient) |
Make a connection to a UTxO RPC service with the minimum required information.
No compression is used, no headers are added, and no logging is performed.
For more configurability, use or utxorpcClient.utxorpcClientWith
utxorpcClientWith :: GrpcClientConfig -> Maybe (UtxorpcClientLogger m) -> IO (Either ClientError UtxorpcClient) Source #
Connect to a UTxO RPC from a .
For a simpler interface with less configurability, use GrpcClientConfig or utxorpcClient.simpleUtxorpcClient
data UtxorpcClientLogger m Source #
Logging functions to log requests, replies, server stream messages, and server stream endings. A UUID is generated for each request and passed downstream to the other logging functions.
Constructors
| UtxorpcClientLogger | |
Fields
| |
type RequestLogger m Source #
Arguments
| = forall i. (Show i, Message i) | |
| => ByteString | The RPC path |
| -> GrpcClient | Included because it contains useful information such as the server address. |
| -> UUID | Generated for this request, and passed to other logging functions for other RPC events generated by this request. E.g., A unary request and its reply both have the same UUID. |
| -> i | The request message being sent. |
| -> m () |
Log outgoing requests of all types (i.e., unary requests and server stream requests).
type ReplyLogger m Source #
Arguments
| = forall o. (Show o, Message o) | |
| => ByteString | The RPC path |
| -> GrpcClient | Included because it contains useful information such as the server address. |
| -> UUID | Generated for the request that this reply is associated with. |
| -> Either ClientError (Either TooMuchConcurrency (RawReply o)) | Message received from the service (with headers) or an error. |
| -> m () |
Log unary replies.
type ServerStreamLogger m Source #
Arguments
| = forall o. (Show o, Message o) | |
| => ByteString | The RPC path |
| -> GrpcClient | Included because it contains useful information such as the server address. |
| -> (UUID, Int) | The UUID was generated for the request that caused this reply, the Int is the index of this message in the stream. |
| -> o | Message received from the service. |
| -> m () |
Log server stream messages.
type ServerStreamEndLogger m Source #
Arguments
| = ByteString | The RPC path |
| -> GrpcClient | Included because it contains useful information such as the server address. |
| -> (UUID, Int) | The UUID was generated for the request that caused this reply, the Int is the total number of messages received in the stream. |
| -> (HeaderList, HeaderList) | Headers and Trailers. |
| -> m () |