| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Hasura.Server.SchemaCacheRef
Synopsis
- data SchemaCacheRef = SchemaCacheRef {
- _scrLock :: MVar ()
- _scrCache :: IORef (RebuildableSchemaCache, SchemaCacheVer)
- _scrMetadataVersionGauge :: Gauge
- initialiseSchemaCacheRef :: MonadIO m => ServerMetrics -> RebuildableSchemaCache -> m SchemaCacheRef
- withSchemaCacheUpdate :: (MonadIO m, MonadBaseControl IO m) => SchemaCacheRef -> Logger Hasura -> Maybe (TVar Bool) -> m (a, RebuildableSchemaCache) -> m a
- readSchemaCacheRef :: SchemaCacheRef -> IO (RebuildableSchemaCache, SchemaCacheVer)
- getSchemaCache :: SchemaCacheRef -> IO SchemaCache
- logInconsistentMetadata :: Logger Hasura -> [InconsistentMetadata] -> IO ()
- updateMetadataVersionGauge :: MonadIO m => Gauge -> RebuildableSchemaCache -> m ()
Documentation
data SchemaCacheRef Source #
A mutable reference to a RebuildableSchemaCache, plus
- a write lock,
- update version tracking, and
- a gauge metric that tracks the metadata version of the
SchemaCache.
Constructors
| SchemaCacheRef | |
Fields
| |
initialiseSchemaCacheRef :: MonadIO m => ServerMetrics -> RebuildableSchemaCache -> m SchemaCacheRef Source #
Build a new SchemaCacheRef
withSchemaCacheUpdate :: (MonadIO m, MonadBaseControl IO m) => SchemaCacheRef -> Logger Hasura -> Maybe (TVar Bool) -> m (a, RebuildableSchemaCache) -> m a Source #
Set the SchemaCacheRef to the RebuildableSchemaCache produced by the
given action.
An internal lock ensures that at most one update to the SchemaCacheRef may
proceed at a time.
readSchemaCacheRef :: SchemaCacheRef -> IO (RebuildableSchemaCache, SchemaCacheVer) Source #
Read the contents of the SchemaCacheRef
getSchemaCache :: SchemaCacheRef -> IO SchemaCache Source #
Utility function. Read the latest SchemaCache from the SchemaCacheRef.
getSchemaCache == fmap (lastBuiltSchemaCache . fst) . readSchemaCacheRef
logInconsistentMetadata :: Logger Hasura -> [InconsistentMetadata] -> IO () Source #
Utility function
updateMetadataVersionGauge :: MonadIO m => Gauge -> RebuildableSchemaCache -> m () Source #