| Safe Haskell | None |
|---|---|
| Language | GHC2021 |
Singular.Provider.Koios.Provider
Description
The shipping generic Koios constructor. The caller supplies scope and observation effects; the shared client owns every HTTP decoder and page.
Synopsis
- koiosProvider :: Monad m => ProviderRuntime m -> Network -> m (Either ReadFailure TimeSource) -> Koios m -> LedgerProvider NoWitness m
- data ProviderRuntime (m :: Type -> Type) = ProviderRuntime {
- scopedSession :: forall a. (SessionId -> m a) -> (SessionId -> m ()) -> m a
- sessionOpen :: SessionId -> m Bool
- recordEvent :: ProviderEvent -> m ()
- measureRead :: forall a. SessionId -> Text -> (a -> ProviderEvent) -> m a -> m a
- data ProviderEvent
- = SessionOpened SessionId Network
- | SessionClosed SessionId
- | RawExchange SessionId RawRequest Exchange
- | RawTime SessionId TimeSource
- | RawTimeFailure SessionId ReadFailure
- data TimeSource = TimeSource NetworkTimeManifest ByteString ByteString
Documentation
koiosProvider :: Monad m => ProviderRuntime m -> Network -> m (Either ReadFailure TimeSource) -> Koios m -> LedgerProvider NoWitness m Source #
Acquire unbound raw sessions over the shared Koios client.
A HoldingPolicy query pages through policy_asset_list, then reads
asset_utxos in batches of at most the configured page size or 1000 names,
whichever is smaller. For positive page size s and page ceiling p,
with batch width b = min(s, 1000), it makes at most
p + ceiling(s*p/b)*p exchanges, each subject to the transport's bounded
retry policy. Every exchange uses the session's normal measurement path;
duplicate output references are merged only when their full outputs agree.
Any incomplete read fails the whole query. Separate reads do not establish
an atomic chain point.
data ProviderRuntime (m :: Type -> Type) Source #
Scope effects are explicit. Pure State implementations keep their open session set and events in State; IO implementations release on exceptions.
Constructors
| ProviderRuntime | |
Fields
| |
data ProviderEvent Source #
Every exchange and local raw time read carries its acquisition identity. Authorization headers are removed before an observation leaves this module.
Constructors
| SessionOpened SessionId Network | |
| SessionClosed SessionId | |
| RawExchange SessionId RawRequest Exchange | |
| RawTime SessionId TimeSource | |
| RawTimeFailure SessionId ReadFailure |
data TimeSource #
Constructors
| TimeSource NetworkTimeManifest ByteString ByteString |