graphql-engine-1.0.0: GraphQL API over Postgres
Safe HaskellSafe-Inferred
LanguageHaskell2010

Hasura.Backends.Postgres.DDL.EventTrigger

Description

Postgres DDL EventTrigger

Used for creating event triggers for metadata changes.

See Backend.

Synopsis

Documentation

addCleanupSchedules :: (MonadIO m, MonadError QErr m) => PGSourceConfig -> [(TriggerName, AutoTriggerLogCleanupConfig)] -> m () Source #

Add cleanup logs for given trigger names and cleanup configs. This will perform the following steps:

  1. Get last scheduled cleanup event and count.
  2. If count is less than 5, then add add more cleanup logs, else do nothing

deleteAllScheduledCleanups :: (MonadIO m, MonadError QErr m) => PGSourceConfig -> TriggerName -> m () Source #

deleteAllScheduledCleanups deletes all scheduled cleanup logs for a given event trigger

getCleanupEventsForDeletion :: (MonadIO m, MonadError QErr m) => PGSourceConfig -> m [(Text, TriggerName)] Source #

getCleanupEventsForDeletion returns the cleanup logs that are to be deleted. This will perform the following steps:

  1. Get the scheduled cleanup events that were scheduled before current time.
  2. If there are multiple entries for the same trigger name with different scheduled time, then fetch the latest entry and mark others as dead.

updateCleanupEventStatusToPaused :: (MonadIO m, MonadError QErr m) => PGSourceConfig -> Text -> m () Source #

updateCleanupEventStatusToPaused updates the cleanup log status to paused if the event trigger configuration is paused.

updateCleanupEventStatusToCompleted :: (MonadIO m, MonadError QErr m) => PGSourceConfig -> Text -> DeletedEventLogStats -> m () Source #

updateCleanupEventStatusToCompleted updates the cleanup log status after the event logs are deleted. This will perform the following steps:

  1. Updates the cleanup config status to completed.
  2. Updates the number of event logs and event invocation logs that were deleted for a trigger name

deleteEventTriggerLogs :: (MonadIO m, MonadError QErr m) => PGSourceConfig -> TriggerLogCleanupConfig -> IO (Maybe (TriggerLogCleanupConfig, EventTriggerCleanupStatus)) -> m DeletedEventLogStats Source #

deleteEventTriggerLogs deletes the event logs (and event invocation logs) based on the cleanup configuration given This will perform the following steps:

  1. Select all the dead events based on criteria set in the cleanup config.
  2. Lock the events in the database so that other HGE instances don't pick them up for deletion.
  3. Based on the config, perform the delete action.