Safe Haskell | None |
---|---|
Language | Haskell2010 |
This module has type class and types which implements the Metadata Storage Abstraction
Synopsis
- data SchemaSyncEventProcessResult = SchemaSyncEventProcessResult {}
- class MonadError QErr m => MonadMetadataStorage m where
- fetchMetadataResourceVersion :: m MetadataResourceVersion
- fetchMetadata :: m (Metadata, MetadataResourceVersion)
- fetchMetadataNotifications :: MetadataResourceVersion -> InstanceId -> m [(MetadataResourceVersion, CacheInvalidations)]
- setMetadata :: MetadataResourceVersion -> Metadata -> m MetadataResourceVersion
- notifySchemaCacheSync :: MetadataResourceVersion -> InstanceId -> CacheInvalidations -> m ()
- getCatalogState :: m CatalogState
- setCatalogState :: CatalogStateType -> Value -> m ()
- getMetadataDbUid :: m MetadataDbId
- checkMetadataStorageHealth :: m ()
- getDeprivedCronTriggerStats :: [TriggerName] -> m [CronTriggerStats]
- getScheduledEventsForDelivery :: m ([CronEvent], [OneOffScheduledEvent])
- insertCronEvents :: [CronEventSeed] -> m ()
- insertOneOffScheduledEvent :: OneOffEvent -> m EventId
- insertScheduledEventInvocation :: Invocation 'ScheduledType -> ScheduledEventType -> m ()
- setScheduledEventOp :: ScheduledEventId -> ScheduledEventOp -> ScheduledEventType -> m ()
- unlockScheduledEvents :: ScheduledEventType -> [ScheduledEventId] -> m Int
- unlockAllLockedScheduledEvents :: m ()
- clearFutureCronEvents :: ClearCronEvents -> m ()
- getOneOffScheduledEvents :: ScheduledEventPagination -> [ScheduledEventStatus] -> m (WithTotalCount [OneOffScheduledEvent])
- getCronEvents :: TriggerName -> ScheduledEventPagination -> [ScheduledEventStatus] -> m (WithTotalCount [CronEvent])
- getInvocations :: GetInvocationsBy -> ScheduledEventPagination -> m (WithTotalCount [ScheduledEventInvocation])
- deleteScheduledEvent :: ScheduledEventId -> ScheduledEventType -> m ()
- insertAction :: ActionName -> SessionVariables -> [Header] -> Value -> m ActionId
- fetchUndeliveredActionEvents :: m [ActionLogItem]
- setActionStatus :: ActionId -> AsyncActionStatus -> m ()
- fetchActionResponse :: ActionId -> m ActionLogResponse
- clearActionData :: ActionName -> m ()
- setProcessingActionLogsToPending :: LockedActionIdArray -> m ()
- newtype MetadataStorageT m a = MetadataStorageT {
- unMetadataStorageT :: ExceptT QErr m a
- runMetadataStorageT :: MetadataStorageT m a -> m (Either QErr a)
- class MonadMetadataStorage m => MonadMetadataStorageQueryAPI m where
- createOneOffScheduledEvent :: OneOffEvent -> m EventId
- createCronEvents :: [CronEventSeed] -> m ()
- dropFutureCronEvents :: ClearCronEvents -> m ()
- deleteActionData :: ActionName -> m ()
- fetchInvocations :: GetInvocationsBy -> ScheduledEventPagination -> m (WithTotalCount [ScheduledEventInvocation])
- fetchScheduledEvents :: GetScheduledEvents -> m Value
- dropEvent :: ScheduledEventId -> ScheduledEventType -> m ()
- fetchCatalogState :: m CatalogState
- updateCatalogState :: CatalogStateType -> Value -> m ()
Documentation
class MonadError QErr 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 MySQL, MSSQL etc.
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 MetadataResourceVersion Source #
fetchMetadata :: m (Metadata, MetadataResourceVersion) Source #
fetchMetadataNotifications :: MetadataResourceVersion -> InstanceId -> m [(MetadataResourceVersion, CacheInvalidations)] Source #
setMetadata :: MetadataResourceVersion -> Metadata -> m MetadataResourceVersion Source #
notifySchemaCacheSync :: MetadataResourceVersion -> InstanceId -> CacheInvalidations -> m () Source #
getCatalogState :: m CatalogState Source #
setCatalogState :: CatalogStateType -> Value -> m () Source #
getMetadataDbUid :: m MetadataDbId Source #
checkMetadataStorageHealth :: m () Source #
getDeprivedCronTriggerStats :: [TriggerName] -> m [CronTriggerStats] Source #
getScheduledEventsForDelivery :: m ([CronEvent], [OneOffScheduledEvent]) Source #
insertCronEvents :: [CronEventSeed] -> m () Source #
insertOneOffScheduledEvent :: OneOffEvent -> m EventId Source #
insertScheduledEventInvocation :: Invocation 'ScheduledType -> ScheduledEventType -> m () Source #
setScheduledEventOp :: ScheduledEventId -> ScheduledEventOp -> ScheduledEventType -> m () Source #
unlockScheduledEvents :: ScheduledEventType -> [ScheduledEventId] -> m Int Source #
unlockAllLockedScheduledEvents :: m () Source #
clearFutureCronEvents :: ClearCronEvents -> m () Source #
getOneOffScheduledEvents :: ScheduledEventPagination -> [ScheduledEventStatus] -> m (WithTotalCount [OneOffScheduledEvent]) Source #
getCronEvents :: TriggerName -> ScheduledEventPagination -> [ScheduledEventStatus] -> m (WithTotalCount [CronEvent]) Source #
getInvocations :: GetInvocationsBy -> ScheduledEventPagination -> m (WithTotalCount [ScheduledEventInvocation]) Source #
deleteScheduledEvent :: ScheduledEventId -> ScheduledEventType -> m () Source #
insertAction :: ActionName -> SessionVariables -> [Header] -> Value -> m ActionId Source #
fetchUndeliveredActionEvents :: m [ActionLogItem] Source #
setActionStatus :: ActionId -> AsyncActionStatus -> m () Source #
fetchActionResponse :: ActionId -> m ActionLogResponse Source #
clearActionData :: ActionName -> m () Source #
setProcessingActionLogsToPending :: LockedActionIdArray -> m () Source #
Instances
newtype MetadataStorageT m a Source #
The MetadataStorageT
transformer adds ability to throw exceptions
for monads deriving @MonadMetadataStorage
instance.
For more details see Note [Generic MetadataStorageT transformer]
Instances
runMetadataStorageT :: MetadataStorageT m a -> m (Either QErr a) Source #
class MonadMetadataStorage m => MonadMetadataStorageQueryAPI m where Source #
Operations from @MonadMetadataStorage
used in 'v1query' and 'v1metadata' APIs
Nothing
createOneOffScheduledEvent :: OneOffEvent -> m EventId Source #
Record a one-off event
createCronEvents :: [CronEventSeed] -> m () Source #
Record a cron event
dropFutureCronEvents :: ClearCronEvents -> m () Source #
Clear cron events
deleteActionData :: ActionName -> m () Source #
Delete async action logs
fetchInvocations :: GetInvocationsBy -> ScheduledEventPagination -> m (WithTotalCount [ScheduledEventInvocation]) Source #
Fetch cron/oneoff scheduled event invocations
fetchScheduledEvents :: GetScheduledEvents -> m Value Source #
Fetch cron/oneoff scheduled events
dropEvent :: ScheduledEventId -> ScheduledEventType -> m () Source #
Drop a cron/oneoff scheduled event
fetchCatalogState :: m CatalogState Source #
Retrieve the state from metadata storage catalog
updateCatalogState :: CatalogStateType -> Value -> m () Source #
Update the state from metadata storage catalog