graphql-engine-1.0.0: GraphQL API over Postgres
Safe HaskellSafe-Inferred
LanguageHaskell2010

Hasura.GraphQL.Execute.Subscription.Poll.Common

Description

Multiplexed subscription poller threads; see Hasura.GraphQL.Execute.Subscription for details.

Synopsis

Documentation

data SubscriberId Source #

Instances

Instances details
ToJSON SubscriberId Source # 
Instance details

Defined in Hasura.GraphQL.Execute.Subscription.Poll.Common

Generic SubscriberId Source # 
Instance details

Defined in Hasura.GraphQL.Execute.Subscription.Poll.Common

Associated Types

type Rep SubscriberId :: Type -> Type #

Show SubscriberId Source # 
Instance details

Defined in Hasura.GraphQL.Execute.Subscription.Poll.Common

Eq SubscriberId Source # 
Instance details

Defined in Hasura.GraphQL.Execute.Subscription.Poll.Common

Hashable SubscriberId Source # 
Instance details

Defined in Hasura.GraphQL.Execute.Subscription.Poll.Common

type Rep SubscriberId Source # 
Instance details

Defined in Hasura.GraphQL.Execute.Subscription.Poll.Common

type Rep SubscriberId = D1 ('MetaData "SubscriberId" "Hasura.GraphQL.Execute.Subscription.Poll.Common" "graphql-engine-1.0.0-inplace" 'True) (C1 ('MetaCons "SubscriberId" 'PrefixI 'True) (S1 ('MetaSel ('Just "unSubscriberId") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 UUID)))

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

data SubscriptionMetadata Source #

Subscription onChange metadata, used for adding more extra analytics data

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

  • _cCohortId :: CohortId

    a unique identifier used to identify the cohort in the generated query

  • _cPreviousResponse :: TVar (Maybe ResponseHash)

    Contains a hash of the previous poll's DB query result, if any, used to determine if we need to push an updated result to the subscribers or not.

  • _cExistingSubscribers :: SubscriberMap

    the subscribers we’ve already pushed a result to; we push new results to them if the response changes

  • _cNewSubscribers :: SubscriberMap

    subscribers we haven’t yet pushed any results to; we push results to them regardless if the result changed, then merge them in the map of existing subscribers

  • _cStreamCursorVariables :: streamCursorVars

    a mutable type which holds the latest value of the subscription stream cursor. In case of live query subscription, this field is ignored by setting streamCursorVars to ()

newtype BatchId Source #

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].

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 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

PollerIOState 

Fields

data PollerKey b Source #

Instances

Instances details
ToJSON (PollerKey b) Source # 
Instance details

Defined in Hasura.GraphQL.Execute.Subscription.Poll.Common

Generic (PollerKey b) Source # 
Instance details

Defined in Hasura.GraphQL.Execute.Subscription.Poll.Common

Associated Types

type Rep (PollerKey b) :: Type -> Type #

Methods

from :: PollerKey b -> Rep (PollerKey b) x #

to :: Rep (PollerKey b) x -> PollerKey b #

Backend b => Show (PollerKey b) Source # 
Instance details

Defined in Hasura.GraphQL.Execute.Subscription.Poll.Common

Backend b => Eq (PollerKey b) Source # 
Instance details

Defined in Hasura.GraphQL.Execute.Subscription.Poll.Common

Methods

(==) :: PollerKey b -> PollerKey b -> Bool #

(/=) :: PollerKey b -> PollerKey b -> Bool #

Backend b => Hashable (PollerKey b) Source # 
Instance details

Defined in Hasura.GraphQL.Execute.Subscription.Poll.Common

type Rep (PollerKey b) Source # 
Instance details

Defined in Hasura.GraphQL.Execute.Subscription.Poll.Common

type Rep (PollerKey b) = D1 ('MetaData "PollerKey" "Hasura.GraphQL.Execute.Subscription.Poll.Common" "graphql-engine-1.0.0-inplace" 'False) (C1 ('MetaCons "PollerKey" 'PrefixI 'True) ((S1 ('MetaSel ('Just "_lgSource") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 SourceName) :*: S1 ('MetaSel ('Just "_lgRole") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 RoleName)) :*: (S1 ('MetaSel ('Just "_lgQuery") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Text) :*: (S1 ('MetaSel ('Just "_lgConnectionKey") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (ResolvedConnectionTemplate b)) :*: S1 ('MetaSel ('Just "_lgParameterizedQueryHash") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 ParameterizedQueryHash)))))

type PollerMap streamCursor = Map BackendPollerKey (Poller streamCursor) Source #

dumpPollerMap :: Bool -> PollerMap streamCursor -> IO Value Source #

For dev debugging, output subject to change.

newtype PollerId Source #

An ID to track unique Pollers, so that we can gather metrics about each poller

Constructors

PollerId 

Fields

Instances

Instances details
ToJSON PollerId Source # 
Instance details

Defined in Hasura.GraphQL.Execute.Subscription.Poll.Common

Generic PollerId Source # 
Instance details

Defined in Hasura.GraphQL.Execute.Subscription.Poll.Common

Associated Types

type Rep PollerId :: Type -> Type #

Methods

from :: PollerId -> Rep PollerId x #

to :: Rep PollerId x -> PollerId #

Show PollerId Source # 
Instance details

Defined in Hasura.GraphQL.Execute.Subscription.Poll.Common

Eq PollerId Source # 
Instance details

Defined in Hasura.GraphQL.Execute.Subscription.Poll.Common

type Rep PollerId Source # 
Instance details

Defined in Hasura.GraphQL.Execute.Subscription.Poll.Common

type Rep PollerId = D1 ('MetaData "PollerId" "Hasura.GraphQL.Execute.Subscription.Poll.Common" "graphql-engine-1.0.0-inplace" 'True) (C1 ('MetaCons "PollerId" 'PrefixI 'True) (S1 ('MetaSel ('Just "unPollerId") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 UUID)))

data CohortExecutionDetails Source #

Execution information related to a cohort on a poll cycle

Constructors

CohortExecutionDetails 

Fields

data BatchExecutionDetails Source #

Execution information related to a single batched execution

Constructors

BatchExecutionDetails 

Fields

data PollDetails Source #

Constructors

PollDetails 

Fields