| Safe Haskell | Safe-Inferred |
|---|---|
| Language | Haskell2010 |
Hasura.GraphQL.Execute.Subscription.Poll.Common
Description
Multiplexed subscription poller threads; see Hasura.GraphQL.Execute.Subscription for details.
Synopsis
- data SubscriberId
- newSubscriberId :: IO SubscriberId
- data SubscriberMetadata
- mkSubscriberMetadata :: WSId -> OperationId -> Maybe OperationName -> RequestId -> SubscriberMetadata
- data Subscriber = Subscriber {}
- data SubscriptionMetadata = SubscriptionMetadata {}
- data SubscriptionResponse = SubscriptionResponse {}
- type SubscriptionGQResponse = GQResult SubscriptionResponse
- type OnChange = SubscriptionGQResponse -> IO ()
- type SubscriberMap = TMap SubscriberId Subscriber
- data PollerResponseState
- data Cohort streamCursorVars = Cohort {
- _cCohortId :: CohortId
- _cPreviousResponse :: TVar (Maybe ResponseHash)
- _cExistingSubscribers :: SubscriberMap
- _cNewSubscribers :: SubscriberMap
- _cStreamCursorVariables :: streamCursorVars
- newtype BatchId = BatchId {
- _unBatchId :: Int
- newtype ResponseHash = ResponseHash {}
- mkRespHash :: ByteString -> ResponseHash
- type CohortKey = CohortVariables
- type CohortMap streamCursor = TMap CohortKey (Cohort streamCursor)
- data CohortSnapshot = CohortSnapshot {}
- data Poller streamCursor = Poller {}
- data PollerIOState = PollerIOState {}
- data PollerKey b = PollerKey {}
- newtype BackendPollerKey = BackendPollerKey {}
- type PollerMap streamCursor = Map BackendPollerKey (Poller streamCursor)
- dumpPollerMap :: Bool -> PollerMap streamCursor -> IO Value
- newtype PollerId = PollerId {
- unPollerId :: UUID
- data SubscriberExecutionDetails = SubscriberExecutionDetails {}
- data CohortExecutionDetails = CohortExecutionDetails {}
- data BatchExecutionDetails = BatchExecutionDetails {}
- data PollDetailsError = PollDetailsError {}
- data PollDetails = PollDetails {
- _pdPollerId :: PollerId
- _pdKind :: SubscriptionType
- _pdGeneratedSql :: Text
- _pdSnapshotTime :: DiffTime
- _pdBatches :: [BatchExecutionDetails]
- _pdTotalTime :: DiffTime
- _pdLiveQueryOptions :: SubscriptionsOptions
- _pdSource :: SourceName
- _pdRole :: RoleName
- _pdParameterizedQueryHash :: ParameterizedQueryHash
- _pdLogLevel :: LogLevel
- _pdErrors :: Maybe [PollDetailsError]
- type SubscriptionPostPollHook = PollDetails -> IO ()
- defaultSubscriptionPostPollHook :: Logger Hasura -> SubscriptionPostPollHook
Documentation
data SubscriberId Source #
Instances
data SubscriberMetadata Source #
Allows a user of the live query subsystem (currently websocket transport) to attach arbitrary metadata about a subscriber. This information is available as part of Subscriber in CohortExecutionDetails and can be logged by customizing in pollerlog
Instances
| ToJSON SubscriberMetadata Source # | |
Defined in Hasura.GraphQL.Execute.Subscription.Poll.Common Methods toJSON :: SubscriberMetadata -> Value Source # toEncoding :: SubscriberMetadata -> Encoding Source # toJSONList :: [SubscriberMetadata] -> Value Source # toEncodingList :: [SubscriberMetadata] -> Encoding Source # | |
| Show SubscriberMetadata Source # | |
Defined in Hasura.GraphQL.Execute.Subscription.Poll.Common Methods showsPrec :: Int -> SubscriberMetadata -> ShowS # show :: SubscriberMetadata -> String # showList :: [SubscriberMetadata] -> ShowS # | |
| Eq SubscriberMetadata Source # | |
Defined in Hasura.GraphQL.Execute.Subscription.Poll.Common Methods (==) :: SubscriberMetadata -> SubscriberMetadata -> Bool # (/=) :: SubscriberMetadata -> SubscriberMetadata -> Bool # | |
mkSubscriberMetadata :: WSId -> OperationId -> Maybe OperationName -> RequestId -> SubscriberMetadata Source #
data Subscriber Source #
Constructors
| Subscriber | |
Fields
| |
data SubscriptionMetadata Source #
Subscription onChange metadata, used for adding more extra analytics data
Constructors
| SubscriptionMetadata | |
Fields | |
data SubscriptionResponse Source #
Constructors
| SubscriptionResponse | |
Fields | |
type OnChange = SubscriptionGQResponse -> IO () Source #
type SubscriberMap = TMap SubscriberId Subscriber Source #
data PollerResponseState Source #
Constructors
| PRSSuccess | |
| PRSError |
Instances
| Eq PollerResponseState Source # | |
Defined in Hasura.GraphQL.Execute.Subscription.Poll.Common Methods (==) :: PollerResponseState -> PollerResponseState -> Bool # (/=) :: PollerResponseState -> PollerResponseState -> Bool # | |
data Cohort streamCursorVars Source #
A batched group of Subscribers who are not only listening to the same query but also have
identical session and query variables. Each result pushed to a Cohort is forwarded along to
each of its Subscribers.
In SQL, each Cohort corresponds to a single row in the laterally-joined _subs table (and
therefore a single row in the query result).
See also CohortMap.
Constructors
| Cohort | |
Fields
| |
The BatchId is a number based ID to uniquely identify a batch in a single poll and
it's used to identify the batch to which a cohort belongs to.
Constructors
| BatchId | |
Fields
| |
newtype ResponseHash Source #
A hash used to determine if the result changed without having to keep the entire result in memory. Using a cryptographic hash ensures that a hash collision is almost impossible: with 256 bits, even if a subscription changes once per second for an entire year, the probability of a hash collision is ~4.294417×10-63. See Note [Blake2b faster than SHA-256].
Constructors
| ResponseHash | |
Fields | |
Instances
| ToJSON ResponseHash Source # | |
Defined in Hasura.GraphQL.Execute.Subscription.Poll.Common Methods toJSON :: ResponseHash -> Value Source # toEncoding :: ResponseHash -> Encoding Source # toJSONList :: [ResponseHash] -> Value Source # toEncodingList :: [ResponseHash] -> Encoding Source # | |
| Show ResponseHash Source # | |
Defined in Hasura.GraphQL.Execute.Subscription.Poll.Common Methods showsPrec :: Int -> ResponseHash -> ShowS # show :: ResponseHash -> String # showList :: [ResponseHash] -> ShowS # | |
| Eq ResponseHash Source # | |
mkRespHash :: ByteString -> ResponseHash Source #
type CohortKey = CohortVariables Source #
A key we use to determine if two Subscribers belong in the same Cohort
(assuming they already meet the criteria to be in the same Poller). Note
the distinction between this and CohortId; the latter is a completely
synthetic key used only to identify the cohort in the generated SQL query.
type CohortMap streamCursor = TMap CohortKey (Cohort streamCursor) Source #
This has the invariant, maintained in removeLiveQuery, that it contains
no Cohort with zero total (existing + new) subscribers.
data CohortSnapshot Source #
Constructors
| CohortSnapshot | |
Fields | |
data Poller streamCursor Source #
A unique, multiplexed query. Each Poller has its own polling thread that
periodically polls Postgres and pushes results to each of its listening
Cohorts.
In SQL, an Poller corresponds to a single, multiplexed query, though in
practice, Pollers with large numbers of Cohorts are batched into
multiple concurrent queries for performance reasons.
Constructors
| Poller | |
Fields
| |
data PollerIOState Source #
Constructors
| PollerKey | |
Instances
newtype BackendPollerKey Source #
Constructors
| BackendPollerKey | |
Fields | |
Instances
| Show BackendPollerKey Source # | |
Defined in Hasura.GraphQL.Execute.Subscription.Poll.Common Methods showsPrec :: Int -> BackendPollerKey -> ShowS # show :: BackendPollerKey -> String # showList :: [BackendPollerKey] -> ShowS # | |
| Eq BackendPollerKey Source # | |
Defined in Hasura.GraphQL.Execute.Subscription.Poll.Common Methods (==) :: BackendPollerKey -> BackendPollerKey -> Bool # (/=) :: BackendPollerKey -> BackendPollerKey -> Bool # | |
| Hashable BackendPollerKey Source # | |
Defined in Hasura.GraphQL.Execute.Subscription.Poll.Common Methods hashWithSalt :: Int -> BackendPollerKey -> Int Source # hash :: BackendPollerKey -> Int Source # | |
dumpPollerMap :: Bool -> PollerMap streamCursor -> IO Value Source #
For dev debugging, output subject to change.
An ID to track unique Pollers, so that we can gather metrics about each
poller
Constructors
| PollerId | |
Fields
| |
data SubscriberExecutionDetails Source #
Constructors
| SubscriberExecutionDetails | |
Fields | |
Instances
| Show SubscriberExecutionDetails Source # | |
Defined in Hasura.GraphQL.Execute.Subscription.Poll.Common Methods showsPrec :: Int -> SubscriberExecutionDetails -> ShowS # show :: SubscriberExecutionDetails -> String # showList :: [SubscriberExecutionDetails] -> ShowS # | |
| Eq SubscriberExecutionDetails Source # | |
Defined in Hasura.GraphQL.Execute.Subscription.Poll.Common Methods (==) :: SubscriberExecutionDetails -> SubscriberExecutionDetails -> Bool # (/=) :: SubscriberExecutionDetails -> SubscriberExecutionDetails -> Bool # | |
data CohortExecutionDetails Source #
Execution information related to a cohort on a poll cycle
Constructors
| CohortExecutionDetails | |
Fields
| |
Instances
| Show CohortExecutionDetails Source # | |
Defined in Hasura.GraphQL.Execute.Subscription.Poll.Common Methods showsPrec :: Int -> CohortExecutionDetails -> ShowS # show :: CohortExecutionDetails -> String # showList :: [CohortExecutionDetails] -> ShowS # | |
| Eq CohortExecutionDetails Source # | |
Defined in Hasura.GraphQL.Execute.Subscription.Poll.Common Methods (==) :: CohortExecutionDetails -> CohortExecutionDetails -> Bool # (/=) :: CohortExecutionDetails -> CohortExecutionDetails -> Bool # | |
data BatchExecutionDetails Source #
Execution information related to a single batched execution
Constructors
| BatchExecutionDetails | |
Fields
| |
Instances
| Show BatchExecutionDetails Source # | |
Defined in Hasura.GraphQL.Execute.Subscription.Poll.Common Methods showsPrec :: Int -> BatchExecutionDetails -> ShowS # show :: BatchExecutionDetails -> String # showList :: [BatchExecutionDetails] -> ShowS # | |
| Eq BatchExecutionDetails Source # | |
Defined in Hasura.GraphQL.Execute.Subscription.Poll.Common Methods (==) :: BatchExecutionDetails -> BatchExecutionDetails -> Bool # (/=) :: BatchExecutionDetails -> BatchExecutionDetails -> Bool # | |
data PollDetailsError Source #
Constructors
| PollDetailsError | |
Fields | |
Instances
| ToJSON PollDetailsError Source # | |
Defined in Hasura.GraphQL.Execute.Subscription.Poll.Common Methods toJSON :: PollDetailsError -> Value Source # toEncoding :: PollDetailsError -> Encoding Source # toJSONList :: [PollDetailsError] -> Value Source # toEncodingList :: [PollDetailsError] -> Encoding Source # | |
| Show PollDetailsError Source # | |
Defined in Hasura.GraphQL.Execute.Subscription.Poll.Common Methods showsPrec :: Int -> PollDetailsError -> ShowS # show :: PollDetailsError -> String # showList :: [PollDetailsError] -> ShowS # | |
| Eq PollDetailsError Source # | |
Defined in Hasura.GraphQL.Execute.Subscription.Poll.Common Methods (==) :: PollDetailsError -> PollDetailsError -> Bool # (/=) :: PollDetailsError -> PollDetailsError -> Bool # | |
data PollDetails Source #
Constructors
| PollDetails | |
Fields
| |
Instances
| Show PollDetails Source # | |
Defined in Hasura.GraphQL.Execute.Subscription.Poll.Common Methods showsPrec :: Int -> PollDetails -> ShowS # show :: PollDetails -> String # showList :: [PollDetails] -> ShowS # | |
| Eq PollDetails Source # | |
| ToEngineLog PollDetails Hasura Source # | |
Defined in Hasura.GraphQL.Execute.Subscription.Poll.Common Methods toEngineLog :: PollDetails -> (LogLevel, EngineLogType Hasura, Value) Source # | |
type SubscriptionPostPollHook = PollDetails -> IO () Source #