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

Hasura.GraphQL.Transport.HTTP

Description

Execution of GraphQL queries over HTTP transport

Synopsis

Documentation

newtype ResponseCacher Source #

Encapsulates a function that stores a query response in the cache. cacheLookup decides when such an invitation to store is generated.

Constructors

ResponseCacher 

data CacheStoreResponse Source #

Constructors

CacheStoreSuccess

Cache storage is unconditional, just not always available.

CacheStoreLimitReached 
CacheStoreNotEnoughCapacity 
CacheStoreBackendError String 

data CacheResult Source #

Constructors

ResponseCached EncJSON

We have a cached response for this query

ResponseUncached (Maybe ResponseCacher)

We don't have a cached response. The ResponseCacher can be used to store the response in the cache after a fresh execution.

class Monad m => MonadExecuteQuery m where Source #

Minimal complete definition

Nothing

Methods

cacheLookup Source #

Arguments

:: ExecutionPlan

How we _would've_ executed the query. Ideally we'd use this as a caching key, but it's not serializable... [cont'd]

-> [QueryRootField UnpreparedValue]

Somewhat less processed plan of how we _would've_ executed the query.

-> Maybe CachedDirective

`@cached` directive from the query AST

-> GQLReqParsed
cont'd
... which is why we additionally pass serializable structures from earlier in the query processing pipeline. This includes the query AST, which additionally specifies the `@cached` directive with TTL info...
-> UserInfo

... and the UserInfo

-> [Header]

Used for remote schemas and actions

-> m (Either QErr (ResponseHeaders, CacheResult))

Non-empty response headers instruct the client to store the response locally.

This method does two things: it looks up a query result in the server-side cache, if a cache is used, and it additionally returns HTTP headers that can instruct a client how long a response can be cached locally (i.e. client-side).

data AnnotatedResponsePart Source #

A partial response, e.g. from a remote schema call or postgres postgres query, which we'll assemble into the final response for the client. It is annotated with timing metadata.

data SessVarPred Source #

A predicate on session variables. The Monoid instance makes it simple to combine several predicates disjunctively. | The definition includes Maybe which allows us to short-circuit calls like mempty <> m and m <> mempty, which otherwise might build up long repeated chains of calls to _ _ -> False.