graphql-engine-1.0.0: GraphQL API over Postgres
Safe HaskellNone
LanguageHaskell2010

Hasura.RQL.Types.SchemaCache.Build

Description

Types and functions used in the process of building the schema cache from metadata information stored in the hdb_catalog schema in Postgres.

Synopsis

Documentation

data CollectedInfo Source #

Constructors

CIInconsistency InconsistentMetadata 
CIDependency 

Fields

Instances

Instances details
Eq CollectedInfo Source # 
Instance details

Defined in Hasura.RQL.Types.SchemaCache.Build

withRecordInconsistency :: (ArrowChoice arr, ArrowWriter (Seq w) arr, AsInconsistentMetadata w) => ErrorA QErr arr (e, s) a -> arr (e, (MetadataObject, s)) (Maybe a) Source #

Record any errors resulting from a computation as inconsistencies

class CacheRM m => CacheRWM m where Source #

Instances

Instances details
CacheRWM m => CacheRWM (TraceT m) Source # 
Instance details

Defined in Hasura.RQL.Types.SchemaCache.Build

CacheRWM m => CacheRWM (MetadataT m) Source # 
Instance details

Defined in Hasura.RQL.Types.SchemaCache.Build

(MonadIO m, MonadError QErr m, HasHttpManagerM m, MonadResolveSource m, HasServerConfigCtx m) => CacheRWM (CacheRWT m) Source # 
Instance details

Defined in Hasura.RQL.DDL.Schema.Cache

CacheRWM m => CacheRWM (ReaderT r m) Source # 
Instance details

Defined in Hasura.RQL.Types.SchemaCache.Build

CacheRWM m => CacheRWM (StateT s m) Source # 
Instance details

Defined in Hasura.RQL.Types.SchemaCache.Build

CacheRWM m => CacheRWM (TxET QErr m) Source # 
Instance details

Defined in Hasura.RQL.Types.SchemaCache.Build

data BuildReason Source #

Constructors

CatalogUpdate (Maybe (HashSet SourceName))

The build was triggered by an update this instance made to the catalog (in the currently-active transaction), so information in Postgres that needs to be kept in sync with the catalog (i.e. table event triggers in hdb_catalog schema) should be updated.

CatalogSync

The build was triggered by a notification that some other currently-running Hasura instance updated the catalog. Since that instance already updated table event triggers in hdb_catalog, this build should be read-only.

Instances

Instances details
Eq BuildReason Source # 
Instance details

Defined in Hasura.RQL.Types.SchemaCache.Build

Show BuildReason Source # 
Instance details

Defined in Hasura.RQL.Types.SchemaCache.Build

data CacheInvalidations Source #

Constructors

CacheInvalidations 

Fields

  • ciMetadata :: Bool

    Force reloading of all database information, including information not technically stored in metadata (currently just enum values). Set by the reload_metadata API.

  • ciRemoteSchemas :: HashSet RemoteSchemaName

    Force refetching of the given remote schemas, even if their definition has not changed. Set by the reload_remote_schema API.

  • ciSources :: HashSet SourceName

    Force re-establishing connections of the given data sources, even if their configuration has not changed. Set by the pg_reload_source API.

newtype MetadataT m a Source #

Constructors

MetadataT 

Fields

Instances

Instances details
MonadTrans MetadataT Source # 
Instance details

Defined in Hasura.RQL.Types.SchemaCache.Build

Methods

lift :: Monad m => m a -> MetadataT m a #

MonadReader r m => MonadReader r (MetadataT m) Source # 
Instance details

Defined in Hasura.RQL.Types.SchemaCache.Build

Methods

ask :: MetadataT m r #

local :: (r -> r) -> MetadataT m a -> MetadataT m a #

reader :: (r -> a) -> MetadataT m a #

MonadError e m => MonadError e (MetadataT m) Source # 
Instance details

Defined in Hasura.RQL.Types.SchemaCache.Build

Methods

throwError :: e -> MetadataT m a #

catchError :: MetadataT m a -> (e -> MetadataT m a) -> MetadataT m a #

MonadBaseControl b m => MonadBaseControl b (MetadataT m) Source # 
Instance details

Defined in Hasura.RQL.Types.SchemaCache.Build

Associated Types

type StM (MetadataT m) a

Methods

liftBaseWith :: (RunInBase (MetadataT m) b -> b a) -> MetadataT m a

restoreM :: StM (MetadataT m) a -> MetadataT m a

MonadBase b m => MonadBase b (MetadataT m) Source # 
Instance details

Defined in Hasura.RQL.Types.SchemaCache.Build

Methods

liftBase :: b α -> MetadataT m α

TableCoreInfoRM b m => TableCoreInfoRM b (MetadataT m) Source # 
Instance details

Defined in Hasura.RQL.Types.SchemaCache.Build

Monad m => Monad (MetadataT m) Source # 
Instance details

Defined in Hasura.RQL.Types.SchemaCache.Build

Methods

(>>=) :: MetadataT m a -> (a -> MetadataT m b) -> MetadataT m b #

(>>) :: MetadataT m a -> MetadataT m b -> MetadataT m b #

return :: a -> MetadataT m a #

Functor m => Functor (MetadataT m) Source # 
Instance details

Defined in Hasura.RQL.Types.SchemaCache.Build

Methods

fmap :: (a -> b) -> MetadataT m a -> MetadataT m b #

(<$) :: a -> MetadataT m b -> MetadataT m a #

Monad m => Applicative (MetadataT m) Source # 
Instance details

Defined in Hasura.RQL.Types.SchemaCache.Build

Methods

pure :: a -> MetadataT m a #

(<*>) :: MetadataT m (a -> b) -> MetadataT m a -> MetadataT m b #

liftA2 :: (a -> b -> c) -> MetadataT m a -> MetadataT m b -> MetadataT m c #

(*>) :: MetadataT m a -> MetadataT m b -> MetadataT m b #

(<*) :: MetadataT m a -> MetadataT m b -> MetadataT m a #

MonadIO m => MonadIO (MetadataT m) Source # 
Instance details

Defined in Hasura.RQL.Types.SchemaCache.Build

Methods

liftIO :: IO a -> MetadataT m a #

HasHttpManagerM m => HasHttpManagerM (MetadataT m) Source # 
Instance details

Defined in Hasura.RQL.Types.SchemaCache.Build

Methods

askHttpManager :: MetadataT m Manager Source #

MonadTrace m => MonadTrace (MetadataT m) Source # 
Instance details

Defined in Hasura.RQL.Types.SchemaCache.Build

UserInfoM m => UserInfoM (MetadataT m) Source # 
Instance details

Defined in Hasura.RQL.Types.SchemaCache.Build

HasServerConfigCtx m => HasServerConfigCtx (MetadataT m) Source # 
Instance details

Defined in Hasura.RQL.Types.SchemaCache.Build

MonadTx m => MonadTx (MetadataT m) Source # 
Instance details

Defined in Hasura.RQL.Types.SchemaCache.Build

Methods

liftTx :: TxE QErr a -> MetadataT m a Source #

Monad m => MetadataM (MetadataT m) Source # 
Instance details

Defined in Hasura.RQL.Types.SchemaCache.Build

CacheRM m => CacheRM (MetadataT m) Source # 
Instance details

Defined in Hasura.RQL.Types.SchemaCache.Build

SourceM m => SourceM (MetadataT m) Source # 
Instance details

Defined in Hasura.RQL.Types.SchemaCache.Build

CacheRWM m => CacheRWM (MetadataT m) Source # 
Instance details

Defined in Hasura.RQL.Types.SchemaCache.Build

MonadMetadataStorageQueryAPI m => MonadMetadataStorageQueryAPI (MetadataT m) Source # 
Instance details

Defined in Hasura.Metadata.Class

MonadMetadataStorage m => MonadMetadataStorage (MetadataT m) Source # 
Instance details

Defined in Hasura.Metadata.Class

Methods

fetchMetadataResourceVersion :: MetadataT m MetadataResourceVersion Source #

fetchMetadata :: MetadataT m (Metadata, MetadataResourceVersion) Source #

fetchMetadataNotifications :: MetadataResourceVersion -> InstanceId -> MetadataT m [(MetadataResourceVersion, CacheInvalidations)] Source #

setMetadata :: MetadataResourceVersion -> Metadata -> MetadataT m MetadataResourceVersion Source #

notifySchemaCacheSync :: MetadataResourceVersion -> InstanceId -> CacheInvalidations -> MetadataT m () Source #

getCatalogState :: MetadataT m CatalogState Source #

setCatalogState :: CatalogStateType -> Value -> MetadataT m () Source #

getMetadataDbUid :: MetadataT m MetadataDbId Source #

checkMetadataStorageHealth :: MetadataT m () Source #

getDeprivedCronTriggerStats :: [TriggerName] -> MetadataT m [CronTriggerStats] Source #

getScheduledEventsForDelivery :: MetadataT m ([CronEvent], [OneOffScheduledEvent]) Source #

insertCronEvents :: [CronEventSeed] -> MetadataT m () Source #

insertOneOffScheduledEvent :: OneOffEvent -> MetadataT m EventId Source #

insertScheduledEventInvocation :: Invocation 'ScheduledType -> ScheduledEventType -> MetadataT m () Source #

setScheduledEventOp :: ScheduledEventId -> ScheduledEventOp -> ScheduledEventType -> MetadataT m () Source #

unlockScheduledEvents :: ScheduledEventType -> [ScheduledEventId] -> MetadataT m Int Source #

unlockAllLockedScheduledEvents :: MetadataT m () Source #

clearFutureCronEvents :: ClearCronEvents -> MetadataT m () Source #

getOneOffScheduledEvents :: ScheduledEventPagination -> [ScheduledEventStatus] -> MetadataT m (WithTotalCount [OneOffScheduledEvent]) Source #

getCronEvents :: TriggerName -> ScheduledEventPagination -> [ScheduledEventStatus] -> MetadataT m (WithTotalCount [CronEvent]) Source #

getInvocations :: GetInvocationsBy -> ScheduledEventPagination -> MetadataT m (WithTotalCount [ScheduledEventInvocation]) Source #

deleteScheduledEvent :: ScheduledEventId -> ScheduledEventType -> MetadataT m () Source #

insertAction :: ActionName -> SessionVariables -> [Header] -> Value -> MetadataT m ActionId Source #

fetchUndeliveredActionEvents :: MetadataT m [ActionLogItem] Source #

setActionStatus :: ActionId -> AsyncActionStatus -> MetadataT m () Source #

fetchActionResponse :: ActionId -> MetadataT m ActionLogResponse Source #

clearActionData :: ActionName -> MetadataT m () Source #

setProcessingActionLogsToPending :: LockedActionIdArray -> MetadataT m () Source #

MonadQueryTags m => MonadQueryTags (MetadataT m) Source # 
Instance details

Defined in Hasura.GraphQL.Execute.Backend

MFunctor MetadataT Source # 
Instance details

Defined in Hasura.RQL.Types.SchemaCache.Build

Methods

hoist :: forall m n (b :: k). Monad m => (forall a. m a -> n a) -> MetadataT m b -> MetadataT n b

type StM (MetadataT m) a Source # 
Instance details

Defined in Hasura.RQL.Types.SchemaCache.Build

type StM (MetadataT m) a = StM (StateT Metadata m) a

buildSchemaCacheFor :: (QErrM m, CacheRWM m, MetadataM m) => MetadataObjId -> MetadataModifier -> m () Source #

Rebuilds the schema cache after modifying metadata. If an object with the given object id became newly inconsistent, raises an error about it specifically. Otherwise, raises a generic metadata inconsistency error.

buildSchemaCacheStrict :: (QErrM m, CacheRWM m, MetadataM m) => m () Source #

Like buildSchemaCache, but fails if there is any inconsistent metadata.

withNewInconsistentObjsCheck :: (QErrM m, CacheRM m) => m a -> m a Source #

Executes the given action, and if any new InconsistentMetadatas are added to the schema cache as a result of its execution, raises an error.

getInconsistentQueryCollections :: MonadError QErr m => SchemaIntrospection -> QueryCollections -> ((CollectionName, ListedQuery) -> MetadataObject) -> EndpointTrie GQLQueryWithText -> [NormalizedQuery] -> m [InconsistentMetadata] Source #

getInconsistentQueryCollections is a helper function that runs the static analysis over the saved queries and reports any inconsistenties with the current schema.

validateQuery :: MonadError QErr m => SchemaIntrospection -> (a -> MetadataObject) -> (a -> [Text] -> Text) -> (a, [ExecutableDefinition Name]) -> m (Either (MetadataObject, Text) ()) Source #