Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
This module has type class and types which implements the Metadata Storage Abstraction
Synopsis
- data SchemaSyncEventProcessResult = SchemaSyncEventProcessResult {}
- class Monad m => MonadMetadataStorage m where
- fetchMetadataResourceVersion :: m (Either QErr MetadataResourceVersion)
- fetchMetadata :: m (Either QErr MetadataWithResourceVersion)
- fetchMetadataNotifications :: MetadataResourceVersion -> InstanceId -> m (Either QErr [(MetadataResourceVersion, CacheInvalidations)])
- setMetadata :: MetadataResourceVersion -> Metadata -> m (Either QErr MetadataResourceVersion)
- notifySchemaCacheSync :: MetadataResourceVersion -> InstanceId -> CacheInvalidations -> m (Either QErr ())
- getCatalogState :: m (Either QErr CatalogState)
- setCatalogState :: CatalogStateType -> Value -> m (Either QErr ())
- fetchSourceIntrospection :: MetadataResourceVersion -> m (Either QErr (Maybe StoredIntrospection))
- storeSourceIntrospection :: StoredIntrospection -> MetadataResourceVersion -> m (Either QErr ())
- getMetadataDbUid :: m (Either QErr MetadataDbId)
- checkMetadataStorageHealth :: m (Either QErr ())
- getDeprivedCronTriggerStats :: [TriggerName] -> m (Either QErr [CronTriggerStats])
- getScheduledEventsForDelivery :: [TriggerName] -> m (Either QErr ([CronEvent], [OneOffScheduledEvent]))
- insertCronEvents :: [CronEventSeed] -> m (Either QErr ())
- insertOneOffScheduledEvent :: OneOffEvent -> m (Either QErr EventId)
- insertScheduledEventInvocation :: Invocation 'ScheduledType -> ScheduledEventType -> m (Either QErr ())
- setScheduledEventOp :: ScheduledEventId -> ScheduledEventOp -> ScheduledEventType -> m (Either QErr ())
- unlockScheduledEvents :: ScheduledEventType -> [ScheduledEventId] -> m (Either QErr Int)
- unlockAllLockedScheduledEvents :: m (Either QErr ())
- clearFutureCronEvents :: ClearCronEvents -> m (Either QErr ())
- getOneOffScheduledEvents :: ScheduledEventPagination -> [ScheduledEventStatus] -> RowsCountOption -> m (Either QErr (WithOptionalTotalCount [OneOffScheduledEvent]))
- getCronEvents :: TriggerName -> ScheduledEventPagination -> [ScheduledEventStatus] -> RowsCountOption -> m (Either QErr (WithOptionalTotalCount [CronEvent]))
- getScheduledEventInvocations :: GetScheduledEventInvocations -> m (Either QErr (WithOptionalTotalCount [ScheduledEventInvocation]))
- deleteScheduledEvent :: ScheduledEventId -> ScheduledEventType -> m (Either QErr ())
- insertAction :: ActionName -> SessionVariables -> [Header] -> Value -> m (Either QErr ActionId)
- fetchUndeliveredActionEvents :: m (Either QErr [ActionLogItem])
- setActionStatus :: ActionId -> AsyncActionStatus -> m (Either QErr ())
- fetchActionResponse :: ActionId -> m (Either QErr ActionLogResponse)
- clearActionData :: ActionName -> m (Either QErr ())
- setProcessingActionLogsToPending :: LockedActionIdArray -> m (Either QErr ())
- createOneOffScheduledEvent :: MonadMetadataStorage m => OneOffEvent -> m (Either QErr EventId)
- createCronEvents :: MonadMetadataStorage m => [CronEventSeed] -> m (Either QErr ())
- dropFutureCronEvents :: MonadMetadataStorage m => ClearCronEvents -> m (Either QErr ())
- deleteActionData :: MonadMetadataStorage m => ActionName -> m (Either QErr ())
- fetchScheduledEventInvocations :: MonadMetadataStorage m => GetScheduledEventInvocations -> m (Either QErr (WithOptionalTotalCount [ScheduledEventInvocation]))
- fetchScheduledEvents :: MonadMetadataStorage m => GetScheduledEvents -> m (Either QErr Value)
- dropEvent :: MonadMetadataStorage m => ScheduledEventId -> ScheduledEventType -> m (Either QErr ())
- fetchCatalogState :: MonadMetadataStorage m => m (Either QErr CatalogState)
- updateCatalogState :: MonadMetadataStorage m => CatalogStateType -> Value -> m (Either QErr ())
- class Monad m => MonadEECredentialsStorage m where
- getEEClientCredentials :: m (Either QErr (Maybe EEClientCredentials))
- setEEClientCredentials :: EEClientCredentials -> m (Either QErr ())
Documentation
class Monad m => MonadMetadataStorage m where Source #
Metadata storage abstraction via a type class.
This type class enables storing and managing Hasura metadata in an isolated database which will not interfere with user's database where tables/functions are defined. Hence, it'll enable support for databases of multiple backends like MSSQL etc.
Error-handling is handled explicitly, with every function returning an `Either QErr`. This is inelegant, but is required: we want the caller to explictly deal with errors, rather than letting them surface to a "lower" monad, because we want to implement this as a Service, on the base monad, so that different implementations of the engine can choose how to implement it; and those base monads do not include error handling, all error handling must be done at the endpoint level. As a result, we choose to make the errors explicit in the return type rather than making assumptions about the stack.
This class has functions broadly related to:
- Metadata Management ---------------------- Basic metadata management functions such as retrieving metadata from storage database and replacing the given metadata. TODO: Console specific operations
- Scheduled Triggers
---------------------
Eventing sub-system for scheduled triggers is implemented via metadata storage.
For more details, refer description in
ScheduledTrigger
module.
TODO: Functions need to be added to the type class - Retrieving invocation logs from storage (console requirement) - Deleting an scheduled event - Creating an one-off scheduled event
- Async Actions
----------------
Operations to implement async actions sub-system. This includes recording an
async action event and retreiving the details of action delivery to the webhook.
For more details see Note [Async action architecture] in
Action
module.
It is believed that all the above three are implemented in a single storage system (ex: a Postgres database). We can split the functions into appropriate and specific type classes in future iterations if required.
fetchMetadataResourceVersion :: m (Either QErr MetadataResourceVersion) Source #
fetchMetadata :: m (Either QErr MetadataWithResourceVersion) Source #
fetchMetadataNotifications :: MetadataResourceVersion -> InstanceId -> m (Either QErr [(MetadataResourceVersion, CacheInvalidations)]) Source #
setMetadata :: MetadataResourceVersion -> Metadata -> m (Either QErr MetadataResourceVersion) Source #
notifySchemaCacheSync :: MetadataResourceVersion -> InstanceId -> CacheInvalidations -> m (Either QErr ()) Source #
getCatalogState :: m (Either QErr CatalogState) Source #
setCatalogState :: CatalogStateType -> Value -> m (Either QErr ()) Source #
fetchSourceIntrospection :: MetadataResourceVersion -> m (Either QErr (Maybe StoredIntrospection)) Source #
storeSourceIntrospection :: StoredIntrospection -> MetadataResourceVersion -> m (Either QErr ()) Source #
getMetadataDbUid :: m (Either QErr MetadataDbId) Source #
checkMetadataStorageHealth :: m (Either QErr ()) Source #
getDeprivedCronTriggerStats :: [TriggerName] -> m (Either QErr [CronTriggerStats]) Source #
getScheduledEventsForDelivery :: [TriggerName] -> m (Either QErr ([CronEvent], [OneOffScheduledEvent])) Source #
insertCronEvents :: [CronEventSeed] -> m (Either QErr ()) Source #
insertOneOffScheduledEvent :: OneOffEvent -> m (Either QErr EventId) Source #
insertScheduledEventInvocation :: Invocation 'ScheduledType -> ScheduledEventType -> m (Either QErr ()) Source #
setScheduledEventOp :: ScheduledEventId -> ScheduledEventOp -> ScheduledEventType -> m (Either QErr ()) Source #
unlockScheduledEvents :: ScheduledEventType -> [ScheduledEventId] -> m (Either QErr Int) Source #
unlockAllLockedScheduledEvents :: m (Either QErr ()) Source #
clearFutureCronEvents :: ClearCronEvents -> m (Either QErr ()) Source #
getOneOffScheduledEvents :: ScheduledEventPagination -> [ScheduledEventStatus] -> RowsCountOption -> m (Either QErr (WithOptionalTotalCount [OneOffScheduledEvent])) Source #
getCronEvents :: TriggerName -> ScheduledEventPagination -> [ScheduledEventStatus] -> RowsCountOption -> m (Either QErr (WithOptionalTotalCount [CronEvent])) Source #
getScheduledEventInvocations :: GetScheduledEventInvocations -> m (Either QErr (WithOptionalTotalCount [ScheduledEventInvocation])) Source #
deleteScheduledEvent :: ScheduledEventId -> ScheduledEventType -> m (Either QErr ()) Source #
insertAction :: ActionName -> SessionVariables -> [Header] -> Value -> m (Either QErr ActionId) Source #
fetchUndeliveredActionEvents :: m (Either QErr [ActionLogItem]) Source #
setActionStatus :: ActionId -> AsyncActionStatus -> m (Either QErr ()) Source #
fetchActionResponse :: ActionId -> m (Either QErr ActionLogResponse) Source #
clearActionData :: ActionName -> m (Either QErr ()) Source #
setProcessingActionLogsToPending :: LockedActionIdArray -> m (Either QErr ()) Source #
Instances
createOneOffScheduledEvent :: MonadMetadataStorage m => OneOffEvent -> m (Either QErr EventId) Source #
Record a one-off event
createCronEvents :: MonadMetadataStorage m => [CronEventSeed] -> m (Either QErr ()) Source #
Record a cron event
dropFutureCronEvents :: MonadMetadataStorage m => ClearCronEvents -> m (Either QErr ()) Source #
Clear cron events
deleteActionData :: MonadMetadataStorage m => ActionName -> m (Either QErr ()) Source #
Delete async action logs
fetchScheduledEventInvocations :: MonadMetadataStorage m => GetScheduledEventInvocations -> m (Either QErr (WithOptionalTotalCount [ScheduledEventInvocation])) Source #
Fetch cron/oneoff scheduled event invocations
fetchScheduledEvents :: MonadMetadataStorage m => GetScheduledEvents -> m (Either QErr Value) Source #
Fetch cron/oneoff scheduled events
dropEvent :: MonadMetadataStorage m => ScheduledEventId -> ScheduledEventType -> m (Either QErr ()) Source #
Drop a cron/oneoff scheduled event
fetchCatalogState :: MonadMetadataStorage m => m (Either QErr CatalogState) Source #
Retrieve the state from metadata storage catalog
updateCatalogState :: MonadMetadataStorage m => CatalogStateType -> Value -> m (Either QErr ()) Source #
Update the state from metadata storage catalog
class Monad m => MonadEECredentialsStorage m where Source #
Metadata database operations for EE credentials storage.
This class is only necessary because we haven't written an implementation for storing EE credentials in Cloud.
getEEClientCredentials :: m (Either QErr (Maybe EEClientCredentials)) Source #
setEEClientCredentials :: EEClientCredentials -> m (Either QErr ()) Source #