Safe Haskell | None |
---|---|
Language | Haskell2010 |
Types and functions used in the process of building the schema cache from metadata information
stored in the hdb_catalog
schema in Postgres.
Synopsis
- data CollectedInfo
- _CIDependency :: Prism' CollectedInfo (MetadataObject, SchemaObjId, SchemaDependency)
- _CIInconsistency :: Prism' CollectedInfo InconsistentMetadata
- class AsInconsistentMetadata s where
- _InconsistentMetadata :: Prism' s InconsistentMetadata
- partitionCollectedInfo :: Seq CollectedInfo -> ([InconsistentMetadata], [(MetadataObject, SchemaObjId, SchemaDependency)])
- recordInconsistency :: (ArrowWriter (Seq w) arr, AsInconsistentMetadata w) => ((Maybe Value, MetadataObject), Text) `arr` ()
- recordInconsistencyM :: (MonadWriter (Seq w) m, AsInconsistentMetadata w) => Maybe Value -> MetadataObject -> Text -> m ()
- recordInconsistencies :: (ArrowWriter (Seq w) arr, AsInconsistentMetadata w) => ([MetadataObject], Text) `arr` ()
- recordInconsistenciesM' :: (MonadWriter (Seq w) m, AsInconsistentMetadata w) => [(Maybe Value, MetadataObject)] -> Text -> m ()
- recordInconsistencies' :: (ArrowWriter (Seq w) arr, AsInconsistentMetadata w) => ([(Maybe Value, MetadataObject)], Text) `arr` ()
- recordDependencies :: ArrowWriter (Seq CollectedInfo) arr => (MetadataObject, SchemaObjId, [SchemaDependency]) `arr` ()
- recordDependenciesM :: MonadWriter (Seq CollectedInfo) m => MetadataObject -> SchemaObjId -> [SchemaDependency] -> m ()
- withRecordInconsistencyM :: (MonadWriter (Seq w) m, AsInconsistentMetadata w) => MetadataObject -> ExceptT QErr m a -> m (Maybe a)
- withRecordInconsistency :: (ArrowChoice arr, ArrowWriter (Seq w) arr, AsInconsistentMetadata w) => ErrorA QErr arr (e, s) a -> arr (e, (MetadataObject, s)) (Maybe a)
- class CacheRM m => CacheRWM m where
- buildSchemaCacheWithOptions :: BuildReason -> CacheInvalidations -> Metadata -> m ()
- setMetadataResourceVersionInSchemaCache :: MetadataResourceVersion -> m ()
- data BuildReason
- = CatalogUpdate (Maybe (HashSet SourceName))
- | CatalogSync
- data CacheInvalidations = CacheInvalidations {
- ciMetadata :: Bool
- ciRemoteSchemas :: HashSet RemoteSchemaName
- ciSources :: HashSet SourceName
- newtype MetadataT m a = MetadataT {
- unMetadataT :: StateT Metadata m a
- runMetadataT :: Metadata -> MetadataT m a -> m (a, Metadata)
- buildSchemaCacheWithInvalidations :: (MetadataM m, CacheRWM m) => CacheInvalidations -> MetadataModifier -> m ()
- buildSchemaCache :: (MetadataM m, CacheRWM m) => MetadataModifier -> m ()
- buildSchemaCacheFor :: (QErrM m, CacheRWM m, MetadataM m) => MetadataObjId -> MetadataModifier -> m ()
- buildSchemaCacheStrict :: (QErrM m, CacheRWM m, MetadataM m) => m ()
- withNewInconsistentObjsCheck :: (QErrM m, CacheRM m) => m a -> m a
- getInconsistentQueryCollections :: MonadError QErr m => SchemaIntrospection -> QueryCollections -> ((CollectionName, ListedQuery) -> MetadataObject) -> EndpointTrie GQLQueryWithText -> [NormalizedQuery] -> m [InconsistentMetadata]
- validateQuery :: MonadError QErr m => SchemaIntrospection -> (a -> MetadataObject) -> (a -> [Text] -> Text) -> (a, [ExecutableDefinition Name]) -> m (Either (MetadataObject, Text) ())
Documentation
data CollectedInfo Source #
CIInconsistency InconsistentMetadata | |
CIDependency | |
|
Instances
Eq CollectedInfo Source # | |
Defined in Hasura.RQL.Types.SchemaCache.Build (==) :: CollectedInfo -> CollectedInfo -> Bool # (/=) :: CollectedInfo -> CollectedInfo -> Bool # |
_CIDependency :: Prism' CollectedInfo (MetadataObject, SchemaObjId, SchemaDependency) Source #
_CIInconsistency :: Prism' CollectedInfo InconsistentMetadata Source #
class AsInconsistentMetadata s where Source #
_InconsistentMetadata :: Prism' s InconsistentMetadata Source #
partitionCollectedInfo :: Seq CollectedInfo -> ([InconsistentMetadata], [(MetadataObject, SchemaObjId, SchemaDependency)]) Source #
recordInconsistency :: (ArrowWriter (Seq w) arr, AsInconsistentMetadata w) => ((Maybe Value, MetadataObject), Text) `arr` () Source #
recordInconsistencyM :: (MonadWriter (Seq w) m, AsInconsistentMetadata w) => Maybe Value -> MetadataObject -> Text -> m () Source #
recordInconsistencies :: (ArrowWriter (Seq w) arr, AsInconsistentMetadata w) => ([MetadataObject], Text) `arr` () Source #
recordInconsistenciesM' :: (MonadWriter (Seq w) m, AsInconsistentMetadata w) => [(Maybe Value, MetadataObject)] -> Text -> m () Source #
recordInconsistencies' :: (ArrowWriter (Seq w) arr, AsInconsistentMetadata w) => ([(Maybe Value, MetadataObject)], Text) `arr` () Source #
recordDependencies :: ArrowWriter (Seq CollectedInfo) arr => (MetadataObject, SchemaObjId, [SchemaDependency]) `arr` () Source #
recordDependenciesM :: MonadWriter (Seq CollectedInfo) m => MetadataObject -> SchemaObjId -> [SchemaDependency] -> m () Source #
withRecordInconsistencyM :: (MonadWriter (Seq w) m, AsInconsistentMetadata w) => MetadataObject -> ExceptT QErr m a -> m (Maybe a) Source #
Monadic version of withRecordInconsistency
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 #
buildSchemaCacheWithOptions :: BuildReason -> CacheInvalidations -> Metadata -> m () Source #
setMetadataResourceVersionInSchemaCache :: MetadataResourceVersion -> m () Source #
Instances
data BuildReason Source #
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 |
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 |
Instances
Eq BuildReason Source # | |
Defined in Hasura.RQL.Types.SchemaCache.Build (==) :: BuildReason -> BuildReason -> Bool # (/=) :: BuildReason -> BuildReason -> Bool # | |
Show BuildReason Source # | |
Defined in Hasura.RQL.Types.SchemaCache.Build showsPrec :: Int -> BuildReason -> ShowS # show :: BuildReason -> String # showList :: [BuildReason] -> ShowS # |
data CacheInvalidations Source #
CacheInvalidations | |
|
Instances
Semigroup CacheInvalidations Source # | |
Defined in Hasura.RQL.Types.SchemaCache.Build (<>) :: CacheInvalidations -> CacheInvalidations -> CacheInvalidations # sconcat :: NonEmpty CacheInvalidations -> CacheInvalidations # stimes :: Integral b => b -> CacheInvalidations -> CacheInvalidations # | |
Monoid CacheInvalidations Source # | |
FromJSON CacheInvalidations Source # | |
Defined in Hasura.RQL.Types.SchemaCache.Build parseJSON :: Value -> Parser CacheInvalidations parseJSONList :: Value -> Parser [CacheInvalidations] | |
ToJSON CacheInvalidations Source # | |
Defined in Hasura.RQL.Types.SchemaCache.Build toJSON :: CacheInvalidations -> Value toEncoding :: CacheInvalidations -> Encoding toJSONList :: [CacheInvalidations] -> Value toEncodingList :: [CacheInvalidations] -> Encoding |
newtype MetadataT m a Source #
MetadataT | |
|
Instances
buildSchemaCacheWithInvalidations :: (MetadataM m, CacheRWM m) => CacheInvalidations -> MetadataModifier -> m () Source #
buildSchemaCache :: (MetadataM m, CacheRWM m) => MetadataModifier -> m () Source #
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 InconsistentMetadata
s 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 #