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

Hasura.GraphQL.Execute.Subscription.State

Description

Top-level management of subscription poller threads. The implementation of the polling itself is in Hasura.GraphQL.Execute.Subscription.Poll. See Hasura.GraphQL.Execute.Subscription for high-level details.

Synopsis

Documentation

data SubscriptionsState Source #

The top-level datatype that holds the state for all active subscriptions.

NOTE!: This must be kept consistent with a websocket connection's OperationMap, in onClose and onStart.

dumpSubscriptionsState :: Bool -> LiveQueriesOptions -> StreamQueriesOptions -> SubscriptionsState -> IO Value Source #

For dev debugging, output subject to change.

data SubscriberDetails a Source #

SubscriberDetails contains the data required to locate a subscriber in the correct cohort within the correct poller in the operation map.

Instances

Instances details
Show a => Show (SubscriberDetails a) Source # 
Instance details

Defined in Hasura.GraphQL.Execute.Subscription.State

type StreamingSubscriberDetails = SubscriberDetails (CohortKey, TVar CursorVariableValues) Source #

The CohortKey contains the variables with which the subscription was started and which will remain unchanged. The second type contains the mutable reference through which we can get the latest value of the cursor and using both the CohortKey and the latest cursor value, we locate the subscriber in the operation map to find its details and then stop it.

addLiveQuery Source #

Fork a thread handling a regular (live query) subscription

addStreamSubscriptionQuery Source #

Arguments

:: forall b. BackendTransport b 
=> Logger Hasura 
-> ServerMetrics 
-> PrometheusMetrics 
-> SubscriberMetadata 
-> SubscriptionsState 
-> IO (LiveQueriesOptions, StreamQueriesOptions) 
-> SourceName 
-> ParameterizedQueryHash 
-> Maybe OperationName

operation name of the query

-> RequestId 
-> Name

root field name

-> SubscriptionQueryPlan b (MultiplexedQuery b) 
-> IO GranularPrometheusMetricsState 
-> OnChange

the action to be executed when result changes

-> Maybe (Endo Value)

the modifier for adding typename for namespaced queries

-> IO StreamingSubscriberDetails 

Fork a thread handling a streaming subscription

data LiveAsyncActionQueryOnSource Source #

An async action query whose relationships are referred to table in a source. We need to generate an SQL statement with the action response and execute it in the source database so as to fetch response joined with relationship rows. For more details see Note [Resolving async action query]

Constructors

LiveAsyncActionQueryOnSource 

Fields

data LiveAsyncActionQueryWithNoRelationships Source #

Constructors

LiveAsyncActionQueryWithNoRelationships 

Fields

data AsyncActionQueryLive Source #

Constructors

AsyncActionQueryLive 

Fields

type AsyncActionSubscriptionState = TMap OperationId AsyncActionQueryLive Source #

A share-able state map which stores an async action live query with it's subscription operation id