arbiter-core-0.1.0.0
arbiter-core
Safe HaskellNone
LanguageGHC2024

Arbiter.Core.Sql.Groups

Description

Groups SQL templates.

Synopsis

Documentation

Source #groupsWindowSQL :: Text -> Text -> Int -> Maybe Text -> Query Text

At most limit groups keys past cursor, in the database's key order, unlocked. Its last key is the caller's resume cursor.

Source #emptiedWindowSQL :: Text -> Text -> Int -> Maybe Text -> Query Text

At most limit keys past cursor the maintenance triggers emptied in place, in the database's key order. Its last key is the caller's resume cursor.

Source #lockGroupsSQL :: Text -> Text -> Maybe Text -> Maybe Text -> [Text] -> Query Text

FOR UPDATE SKIP LOCKED over the window groupsWindowSQL returned plus the keys emptiedWindowSQL returned, one ascending pass in the key order the maintenance triggers use. Returns the keys this transaction holds.

Source #refreshGroupsSQL :: Text -> Text -> [Text] -> Query Int64

Recompute the groups table, scoped to the locked keys from lockGroupsSQL. Returns the count of rows it rewrote. A separate statement whose snapshot post-dates the lock.

Source #insertMissingGroupsSQL :: Text -> Text -> Int -> Maybe Text -> Maybe Text -> Query (Text, Bool)

Insert summary rows for grouped jobs the triggers left without one, at most limit keys per call in key order, bounded to the lower to upper key window its caller locked. Returns each key it covered and whether the insert landed.