Copyright | © 2018-2020 IOHK |
---|---|
License | Apache-2.0 |
Safe Haskell | None |
Language | Haskell2010 |
HTTP-client(s) for fetching stake pool metadata from remote servers (directly from pool operators, or from smash).
Synopsis
- fetchFromRemote :: Tracer IO StakePoolMetadataFetchLog -> [ UrlBuilder ] -> Manager -> PoolId -> StakePoolMetadataUrl -> StakePoolMetadataHash -> IO ( Maybe StakePoolMetadata )
-
data
StakePoolMetadataFetchLog
- = MsgFetchPoolMetadata StakePoolMetadataHash URI
- | MsgFetchPoolMetadataSuccess StakePoolMetadataHash StakePoolMetadata
- | MsgFetchPoolMetadataFailure StakePoolMetadataHash String
- | MsgFetchPoolMetadataFallback URI Bool
- | MsgFetchSMASH URI
- | MsgFetchDelistedPoolsFailure String
- | MsgFetchDelistedPoolsSuccess [ PoolId ]
- | MsgFetchHealthCheckFailure String
- | MsgFetchHealthCheckSuccess HealthStatusSMASH
- fetchDelistedPools :: Tracer IO StakePoolMetadataFetchLog -> URI -> Manager -> IO ( Maybe [ PoolId ])
- healthCheck :: Tracer IO StakePoolMetadataFetchLog -> URI -> Manager -> IO ( Maybe HealthStatusSMASH )
- isHealthyStatus :: HealthStatusSMASH -> Bool
- toHealthCheckSMASH :: Maybe HealthStatusSMASH -> HealthCheckSMASH
- data HealthStatusSMASH = HealthStatusSMASH { }
- type UrlBuilder = PoolId -> StakePoolMetadataUrl -> StakePoolMetadataHash -> Either HttpException URI
- identityUrlBuilder :: UrlBuilder
- registryUrlBuilder :: URI -> UrlBuilder
- data Manager
- newManager :: MonadIO m => ManagerSettings -> m Manager
- defaultManagerSettings :: ManagerSettings
- newtype SMASHPoolId = SMASHPoolId { }
Fetch
fetchFromRemote :: Tracer IO StakePoolMetadataFetchLog -> [ UrlBuilder ] -> Manager -> PoolId -> StakePoolMetadataUrl -> StakePoolMetadataHash -> IO ( Maybe StakePoolMetadata ) Source #
data StakePoolMetadataFetchLog Source #
Instances
Eq StakePoolMetadataFetchLog Source # | |
Defined in Cardano.Pool.Metadata |
|
Show StakePoolMetadataFetchLog Source # | |
Defined in Cardano.Pool.Metadata |
|
ToText StakePoolMetadataFetchLog Source # | |
Defined in Cardano.Pool.Metadata |
|
HasPrivacyAnnotation StakePoolMetadataFetchLog Source # | |
Defined in Cardano.Pool.Metadata getPrivacyAnnotation :: StakePoolMetadataFetchLog -> PrivacyAnnotation |
|
HasSeverityAnnotation StakePoolMetadataFetchLog Source # | |
Defined in Cardano.Pool.Metadata getSeverityAnnotation :: StakePoolMetadataFetchLog -> Severity |
fetchDelistedPools :: Tracer IO StakePoolMetadataFetchLog -> URI -> Manager -> IO ( Maybe [ PoolId ]) Source #
healthCheck :: Tracer IO StakePoolMetadataFetchLog -> URI -> Manager -> IO ( Maybe HealthStatusSMASH ) Source #
Gets the health status from the SMASH server. Returns
Nothing
if the server is unreachable.
toHealthCheckSMASH :: Maybe HealthStatusSMASH -> HealthCheckSMASH Source #
Convert the result of
healthCheck
, which represents the
server response to our own
HealthCheckSMASH
type, which is a
superset of it.
data HealthStatusSMASH Source #
Parses the SMASH HealthCheck type from the SMASH API.
Instances
Construct URLs
type UrlBuilder = PoolId -> StakePoolMetadataUrl -> StakePoolMetadataHash -> Either HttpException URI Source #
A type-alias to ease signatures
identityUrlBuilder :: UrlBuilder Source #
Simply return a pool metadata url, unchanged
registryUrlBuilder :: URI -> UrlBuilder Source #
Build a URL from a metadata hash compatible with an aggregation registry
re-exports
Keeps track of open connections for keep-alive.
If possible, you should share a single
Manager
between multiple threads and requests.
Since 0.1.0
Instances
HasHttpManager Manager | |
Defined in Network.HTTP.Client.Types getHttpManager :: Manager -> Manager Source # |
newManager :: MonadIO m => ManagerSettings -> m Manager Source #
Create a connection manager that supports TLS connections.
defaultManagerSettings :: ManagerSettings Source #
Some default settings, overriding some of the library's default with stricter values.
Types
newtype SMASHPoolId Source #
TODO: import SMASH types