Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- fetchUndeliveredEvents :: (MonadIO m, MonadError QErr m) => SourceConfig ('Postgres pgKind) -> SourceName -> [TriggerName] -> MaintenanceMode () -> FetchBatchSize -> m [Event ('Postgres pgKind)]
- setRetry :: (MonadIO m, MonadError QErr m) => SourceConfig ('Postgres pgKind) -> Event ('Postgres pgKind) -> UTCTime -> MaintenanceMode MaintenanceModeVersion -> m ()
- insertManualEvent :: (MonadIO m, MonadError QErr m) => SourceConfig ('Postgres pgKind) -> TableName ('Postgres pgKind) -> TriggerName -> Value -> UserInfo -> TraceContext -> m EventId
- getMaintenanceModeVersion :: (MonadIO m, MonadError QErr m) => SourceConfig ('Postgres pgKind) -> m MaintenanceModeVersion
- recordSuccess :: MonadIO m => SourceConfig ('Postgres pgKind) -> Event ('Postgres pgKind) -> Invocation 'EventType -> MaintenanceMode MaintenanceModeVersion -> m (Either QErr ())
- recordError :: MonadIO m => SourceConfig ('Postgres pgKind) -> Event ('Postgres pgKind) -> Invocation 'EventType -> ProcessEventError -> MaintenanceMode MaintenanceModeVersion -> m (Either QErr ())
- recordError' :: MonadIO m => SourceConfig ('Postgres pgKind) -> Event ('Postgres pgKind) -> Maybe (Invocation 'EventType) -> ProcessEventError -> MaintenanceMode MaintenanceModeVersion -> m (Either QErr ())
- redeliverEvent :: (MonadIO m, MonadError QErr m) => SourceConfig ('Postgres pgKind) -> EventId -> m ()
- dropTriggerAndArchiveEvents :: (MonadIO m, MonadError QErr m) => SourceConfig ('Postgres pgKind) -> TriggerName -> QualifiedTable -> m ()
- createMissingSQLTriggers :: (MonadIO m, MonadError QErr m, MonadBaseControl IO m, HasServerConfigCtx m, Backend ('Postgres pgKind)) => PGSourceConfig -> TableName ('Postgres pgKind) -> ([ColumnInfo ('Postgres pgKind)], Maybe (PrimaryKey ('Postgres pgKind) (ColumnInfo ('Postgres pgKind)))) -> TriggerName -> TriggerOpsDef ('Postgres pgKind) -> m ()
- createTableEventTrigger :: (Backend ('Postgres pgKind), MonadIO m, MonadBaseControl IO m) => ServerConfigCtx -> PGSourceConfig -> QualifiedTable -> [ColumnInfo ('Postgres pgKind)] -> TriggerName -> TriggerOpsDef ('Postgres pgKind) -> Maybe (PrimaryKey ('Postgres pgKind) (ColumnInfo ('Postgres pgKind))) -> m (Either QErr ())
- dropDanglingSQLTrigger :: (MonadIO m, MonadError QErr m) => SourceConfig ('Postgres pgKind) -> TriggerName -> QualifiedTable -> HashSet Ops -> m ()
- updateColumnInEventTrigger :: QualifiedTable -> PGCol -> PGCol -> QualifiedTable -> EventTriggerConf ('Postgres pgKind) -> EventTriggerConf ('Postgres pgKind)
- unlockEventsInSource :: MonadIO m => SourceConfig ('Postgres pgKind) -> NESet EventId -> m (Either QErr Int)
- checkIfTriggerExists :: (MonadIO m, MonadError QErr m) => PGSourceConfig -> TriggerName -> HashSet Ops -> m Bool
- insertInvocation :: Invocation 'EventType -> TxE QErr ()
- insertPGManualEvent :: QualifiedTable -> TriggerName -> Value -> TxE QErr EventId
- archiveEvents :: TriggerName -> TxE QErr ()
- getMaintenanceModeVersionTx :: TxE QErr MaintenanceModeVersion
- fetchEvents :: SourceName -> [TriggerName] -> FetchBatchSize -> TxE QErr [Event ('Postgres pgKind)]
- fetchEventsMaintenanceMode :: SourceName -> [TriggerName] -> FetchBatchSize -> MaintenanceModeVersion -> TxE QErr [Event ('Postgres pgKind)]
- setSuccessTx :: Event ('Postgres pgKind) -> MaintenanceMode MaintenanceModeVersion -> TxE QErr ()
- setErrorTx :: Event ('Postgres pgKind) -> MaintenanceMode MaintenanceModeVersion -> TxE QErr ()
- setRetryTx :: Event ('Postgres pgKind) -> UTCTime -> MaintenanceMode MaintenanceModeVersion -> TxE QErr ()
- dropTriggerQ :: TriggerName -> TxE QErr ()
- dropTriggerOp :: TriggerName -> Ops -> TxE QErr ()
- checkEvent :: EventId -> TxE QErr ()
- markForDelivery :: EventId -> TxE QErr ()
- redeliverEventTx :: EventId -> TxE QErr ()
- unlockEventsTx :: [EventId] -> TxE QErr Int
- newtype QualifiedTriggerName = QualifiedTriggerName {
- unQualifiedTriggerName :: Text
- pgTriggerName :: Ops -> TriggerName -> QualifiedTriggerName
- pgIdenTrigger :: Ops -> TriggerName -> QualifiedTriggerName
- mkTriggerFunctionQ :: forall pgKind m. (Backend ('Postgres pgKind), MonadTx m, MonadReader ServerConfigCtx m) => TriggerName -> QualifiedTable -> [ColumnInfo ('Postgres pgKind)] -> Ops -> SubscribeOpSpec ('Postgres pgKind) -> m QualifiedTriggerName
- checkIfTriggerExistsForTableQ :: QualifiedTriggerName -> QualifiedTable -> TxE QErr Bool
- checkIfFunctionExistsQ :: TriggerName -> Ops -> TxE QErr Bool
- mkTrigger :: forall pgKind m. (Backend ('Postgres pgKind), MonadTx m, MonadReader ServerConfigCtx m) => TriggerName -> QualifiedTable -> [ColumnInfo ('Postgres pgKind)] -> Ops -> SubscribeOpSpec ('Postgres pgKind) -> m ()
- mkAllTriggersQ :: forall pgKind m. (Backend ('Postgres pgKind), MonadTx m, MonadReader ServerConfigCtx m) => TriggerName -> QualifiedTable -> [ColumnInfo ('Postgres pgKind)] -> TriggerOpsDef ('Postgres pgKind) -> m ()
Documentation
fetchUndeliveredEvents :: (MonadIO m, MonadError QErr m) => SourceConfig ('Postgres pgKind) -> SourceName -> [TriggerName] -> MaintenanceMode () -> FetchBatchSize -> m [Event ('Postgres pgKind)] Source #
setRetry :: (MonadIO m, MonadError QErr m) => SourceConfig ('Postgres pgKind) -> Event ('Postgres pgKind) -> UTCTime -> MaintenanceMode MaintenanceModeVersion -> m () Source #
insertManualEvent :: (MonadIO m, MonadError QErr m) => SourceConfig ('Postgres pgKind) -> TableName ('Postgres pgKind) -> TriggerName -> Value -> UserInfo -> TraceContext -> m EventId Source #
getMaintenanceModeVersion :: (MonadIO m, MonadError QErr m) => SourceConfig ('Postgres pgKind) -> m MaintenanceModeVersion Source #
recordSuccess :: MonadIO m => SourceConfig ('Postgres pgKind) -> Event ('Postgres pgKind) -> Invocation 'EventType -> MaintenanceMode MaintenanceModeVersion -> m (Either QErr ()) Source #
recordError :: MonadIO m => SourceConfig ('Postgres pgKind) -> Event ('Postgres pgKind) -> Invocation 'EventType -> ProcessEventError -> MaintenanceMode MaintenanceModeVersion -> m (Either QErr ()) Source #
recordError' :: MonadIO m => SourceConfig ('Postgres pgKind) -> Event ('Postgres pgKind) -> Maybe (Invocation 'EventType) -> ProcessEventError -> MaintenanceMode MaintenanceModeVersion -> m (Either QErr ()) Source #
redeliverEvent :: (MonadIO m, MonadError QErr m) => SourceConfig ('Postgres pgKind) -> EventId -> m () Source #
dropTriggerAndArchiveEvents :: (MonadIO m, MonadError QErr m) => SourceConfig ('Postgres pgKind) -> TriggerName -> QualifiedTable -> m () Source #
createMissingSQLTriggers :: (MonadIO m, MonadError QErr m, MonadBaseControl IO m, HasServerConfigCtx m, Backend ('Postgres pgKind)) => PGSourceConfig -> TableName ('Postgres pgKind) -> ([ColumnInfo ('Postgres pgKind)], Maybe (PrimaryKey ('Postgres pgKind) (ColumnInfo ('Postgres pgKind)))) -> TriggerName -> TriggerOpsDef ('Postgres pgKind) -> m () Source #
createTableEventTrigger :: (Backend ('Postgres pgKind), MonadIO m, MonadBaseControl IO m) => ServerConfigCtx -> PGSourceConfig -> QualifiedTable -> [ColumnInfo ('Postgres pgKind)] -> TriggerName -> TriggerOpsDef ('Postgres pgKind) -> Maybe (PrimaryKey ('Postgres pgKind) (ColumnInfo ('Postgres pgKind))) -> m (Either QErr ()) Source #
dropDanglingSQLTrigger :: (MonadIO m, MonadError QErr m) => SourceConfig ('Postgres pgKind) -> TriggerName -> QualifiedTable -> HashSet Ops -> m () Source #
updateColumnInEventTrigger :: QualifiedTable -> PGCol -> PGCol -> QualifiedTable -> EventTriggerConf ('Postgres pgKind) -> EventTriggerConf ('Postgres pgKind) Source #
unlockEventsInSource :: MonadIO m => SourceConfig ('Postgres pgKind) -> NESet EventId -> m (Either QErr Int) Source #
checkIfTriggerExists :: (MonadIO m, MonadError QErr m) => PGSourceConfig -> TriggerName -> HashSet Ops -> m Bool Source #
insertInvocation :: Invocation 'EventType -> TxE QErr () Source #
insertPGManualEvent :: QualifiedTable -> TriggerName -> Value -> TxE QErr EventId Source #
archiveEvents :: TriggerName -> TxE QErr () Source #
fetchEvents :: SourceName -> [TriggerName] -> FetchBatchSize -> TxE QErr [Event ('Postgres pgKind)] Source #
Lock and return events not yet being processed or completed, up to some limit. Process events approximately in created_at order, but we make no ordering guarentees; events can and will race. Nevertheless we want to ensure newer change events don't starve older ones.
fetchEventsMaintenanceMode :: SourceName -> [TriggerName] -> FetchBatchSize -> MaintenanceModeVersion -> TxE QErr [Event ('Postgres pgKind)] Source #
setSuccessTx :: Event ('Postgres pgKind) -> MaintenanceMode MaintenanceModeVersion -> TxE QErr () Source #
setErrorTx :: Event ('Postgres pgKind) -> MaintenanceMode MaintenanceModeVersion -> TxE QErr () Source #
setRetryTx :: Event ('Postgres pgKind) -> UTCTime -> MaintenanceMode MaintenanceModeVersion -> TxE QErr () Source #
dropTriggerQ :: TriggerName -> TxE QErr () Source #
dropTriggerOp :: TriggerName -> Ops -> TxE QErr () Source #
checkEvent :: EventId -> TxE QErr () Source #
markForDelivery :: EventId -> TxE QErr () Source #
redeliverEventTx :: EventId -> TxE QErr () Source #
unlockEventsTx :: [EventId] -> TxE QErr Int Source #
unlockEvents takes an array of EventId
and unlocks them. This function is called
when a graceful shutdown is initiated.
newtype QualifiedTriggerName Source #
QualifiedTriggerName is a type to store the name of the SQL trigger.
An example of it is `"notify_hasura_users_all_INSERT"` where users_all
is the name of the event trigger.
pgTriggerName :: Ops -> TriggerName -> QualifiedTriggerName Source #
pgIdenTrigger :: Ops -> TriggerName -> QualifiedTriggerName Source #
mkTriggerFunctionQ :: forall pgKind m. (Backend ('Postgres pgKind), MonadTx m, MonadReader ServerConfigCtx m) => TriggerName -> QualifiedTable -> [ColumnInfo ('Postgres pgKind)] -> Ops -> SubscribeOpSpec ('Postgres pgKind) -> m QualifiedTriggerName Source #
pgIdenTrigger is a method used to construct the name of the pg function used for event triggers which are present in the hdb_catalog schema.
Define the pgSQL trigger functions on database events.
checkIfFunctionExistsQ :: TriggerName -> Ops -> TxE QErr Bool Source #
mkTrigger :: forall pgKind m. (Backend ('Postgres pgKind), MonadTx m, MonadReader ServerConfigCtx m) => TriggerName -> QualifiedTable -> [ColumnInfo ('Postgres pgKind)] -> Ops -> SubscribeOpSpec ('Postgres pgKind) -> m () Source #
mkAllTriggersQ :: forall pgKind m. (Backend ('Postgres pgKind), MonadTx m, MonadReader ServerConfigCtx m) => TriggerName -> QualifiedTable -> [ColumnInfo ('Postgres pgKind)] -> TriggerOpsDef ('Postgres pgKind) -> m () Source #