Documentation
¶
Index ¶
- type AddCallItemParams
- type BreakGatewayParams
- type BreakGatewayRow
- type CallContactParams
- type CallContactRow
- type ClaimDueCallsParams
- type ClaimDueCallsRow
- type ClaimGatewayProbesParams
- type ClaimGatewayProbesRow
- type ConfirmContactParams
- type ConfirmedContactParams
- type CountContactCodesParams
- type CountContactCodesRow
- type CountUserCodesParams
- type CountUserCodesRow
- type CountUserContactCodesParams
- type CountUserContactCodesRow
- type DBTX
- type DeleteCodeParams
- type DeleteContactParams
- type DeleteReplacedContactsParams
- type DeleteReplacedContactsRow
- type DeleteUnconfirmedContactsParams
- type DeleteUnconfirmedContactsRow
- type DeleteUserCodesParams
- type DeleteUserContactsParams
- type DeleteUserContactsRow
- type DropCallItemsParams
- type EndCallParams
- type EndGatewayBrokenParams
- type EndGatewayBrokenRow
- type FailGatewayProbeParams
- type GetAcknowledgedCallParams
- type GetAcknowledgedCallRow
- type GetGatewayByIDParams
- type GetGatewayByIDRow
- type GetGatewayParams
- type GetGatewayRow
- type GetGatewayStateParams
- type GetGatewayStateRow
- type GetLeasedCallParams
- type GetLeasedCallRow
- type GetPageGroupIDParams
- type GetPageParams
- type GetPageRow
- type GetUserByPublicIDParams
- type GetUserByPublicIDRow
- type InsertCodeParams
- type InsertContactParams
- type InsertWaitingCallParams
- type ListCallGroupsParams
- type ListCallGroupsRow
- type ListCallableUsersParams
- type ListContactsOfUserParams
- type ListContactsOfUserRow
- type ListGatewayHealthRow
- type ListGatewaysRow
- type ListUnmarkedFailuresParams
- type ListUnmarkedFailuresRow
- type LockCallPersonParams
- type LockContactOfUserParams
- type LockContactOfUserRow
- type LockContactTextParams
- type LockContactUserParams
- type LockContactUserRow
- type LockGatewayStateParams
- type LockNewestCodeParams
- type LockNewestCodeRow
- type LockWaitingCallParams
- type LockWaitingCallRow
- type MarkCallCriticalParams
- type MarkCodeSentParams
- type NextCallWorkParams
- type NextCallWorkRow
- type NextGatewayProbeParams
- type NextGatewayProbeRow
- type PreviousCallParams
- type PreviousCallRow
- type PruneCodesParams
- type PruneEndedCallsParams
- type Queries
- func (q *Queries) AddCallItem(ctx context.Context, arg AddCallItemParams) error
- func (q *Queries) BreakGateway(ctx context.Context, arg BreakGatewayParams) (BreakGatewayRow, error)
- func (q *Queries) CallContact(ctx context.Context, arg CallContactParams) (CallContactRow, error)
- func (q *Queries) ClaimDueCalls(ctx context.Context, arg ClaimDueCallsParams) ([]ClaimDueCallsRow, error)
- func (q *Queries) ClaimGatewayProbes(ctx context.Context, arg ClaimGatewayProbesParams) ([]ClaimGatewayProbesRow, error)
- func (q *Queries) ConfirmContact(ctx context.Context, arg ConfirmContactParams) error
- func (q *Queries) ConfirmedContact(ctx context.Context, arg ConfirmedContactParams) (string, error)
- func (q *Queries) CountContactCodes(ctx context.Context, arg CountContactCodesParams) (CountContactCodesRow, error)
- func (q *Queries) CountUserCodes(ctx context.Context, arg CountUserCodesParams) (CountUserCodesRow, error)
- func (q *Queries) CountUserContactCodes(ctx context.Context, arg CountUserContactCodesParams) (CountUserContactCodesRow, error)
- func (q *Queries) DeleteCode(ctx context.Context, arg DeleteCodeParams) error
- func (q *Queries) DeleteContact(ctx context.Context, arg DeleteContactParams) (int64, error)
- func (q *Queries) DeleteReplacedContacts(ctx context.Context, arg DeleteReplacedContactsParams) ([]DeleteReplacedContactsRow, error)
- func (q *Queries) DeleteUnconfirmedContacts(ctx context.Context, arg DeleteUnconfirmedContactsParams) ([]DeleteUnconfirmedContactsRow, error)
- func (q *Queries) DeleteUserCodes(ctx context.Context, arg DeleteUserCodesParams) (int64, error)
- func (q *Queries) DeleteUserContacts(ctx context.Context, arg DeleteUserContactsParams) ([]DeleteUserContactsRow, error)
- func (q *Queries) DropCallItems(ctx context.Context, arg DropCallItemsParams) error
- func (q *Queries) EndCall(ctx context.Context, arg EndCallParams) (bool, error)
- func (q *Queries) EndGatewayBroken(ctx context.Context, arg EndGatewayBrokenParams) (EndGatewayBrokenRow, error)
- func (q *Queries) FailGatewayProbe(ctx context.Context, arg FailGatewayProbeParams) (int64, error)
- func (q *Queries) GetAcknowledgedCall(ctx context.Context, arg GetAcknowledgedCallParams) (GetAcknowledgedCallRow, error)
- func (q *Queries) GetGateway(ctx context.Context, arg GetGatewayParams) (GetGatewayRow, error)
- func (q *Queries) GetGatewayByID(ctx context.Context, arg GetGatewayByIDParams) (GetGatewayByIDRow, error)
- func (q *Queries) GetGatewayState(ctx context.Context, arg GetGatewayStateParams) (GetGatewayStateRow, error)
- func (q *Queries) GetLeasedCall(ctx context.Context, arg GetLeasedCallParams) (GetLeasedCallRow, error)
- func (q *Queries) GetPage(ctx context.Context, arg GetPageParams) (GetPageRow, error)
- func (q *Queries) GetPageGroupID(ctx context.Context, arg GetPageGroupIDParams) (int64, error)
- func (q *Queries) GetUserByPublicID(ctx context.Context, arg GetUserByPublicIDParams) (GetUserByPublicIDRow, error)
- func (q *Queries) InsertCode(ctx context.Context, arg InsertCodeParams) (int64, error)
- func (q *Queries) InsertContact(ctx context.Context, arg InsertContactParams) (int64, error)
- func (q *Queries) InsertWaitingCall(ctx context.Context, arg InsertWaitingCallParams) (int64, error)
- func (q *Queries) ListCallGroups(ctx context.Context, arg ListCallGroupsParams) ([]ListCallGroupsRow, error)
- func (q *Queries) ListCallableUsers(ctx context.Context, arg ListCallableUsersParams) ([]int64, error)
- func (q *Queries) ListContactsOfUser(ctx context.Context, arg ListContactsOfUserParams) ([]ListContactsOfUserRow, error)
- func (q *Queries) ListGatewayHealth(ctx context.Context, orgID int64) ([]ListGatewayHealthRow, error)
- func (q *Queries) ListGateways(ctx context.Context, orgID int64) ([]ListGatewaysRow, error)
- func (q *Queries) ListUnmarkedFailures(ctx context.Context, arg ListUnmarkedFailuresParams) ([]ListUnmarkedFailuresRow, error)
- func (q *Queries) LockCallPerson(ctx context.Context, arg LockCallPersonParams) error
- func (q *Queries) LockContactOfUser(ctx context.Context, arg LockContactOfUserParams) (LockContactOfUserRow, error)
- func (q *Queries) LockContactText(ctx context.Context, arg LockContactTextParams) error
- func (q *Queries) LockContactUser(ctx context.Context, arg LockContactUserParams) (LockContactUserRow, error)
- func (q *Queries) LockGatewayState(ctx context.Context, arg LockGatewayStateParams) error
- func (q *Queries) LockNewestCode(ctx context.Context, arg LockNewestCodeParams) (LockNewestCodeRow, error)
- func (q *Queries) LockWaitingCall(ctx context.Context, arg LockWaitingCallParams) (LockWaitingCallRow, error)
- func (q *Queries) MarkCallCritical(ctx context.Context, arg MarkCallCriticalParams) error
- func (q *Queries) MarkCodeSent(ctx context.Context, arg MarkCodeSentParams) error
- func (q *Queries) NextCallWork(ctx context.Context, arg NextCallWorkParams) (NextCallWorkRow, error)
- func (q *Queries) NextGatewayProbe(ctx context.Context, arg NextGatewayProbeParams) (NextGatewayProbeRow, error)
- func (q *Queries) NotifyCalls(ctx context.Context, channel string) error
- func (q *Queries) PreviousCall(ctx context.Context, arg PreviousCallParams) (PreviousCallRow, error)
- func (q *Queries) PruneCodes(ctx context.Context, arg PruneCodesParams) (int64, error)
- func (q *Queries) PruneEndedCalls(ctx context.Context, arg PruneEndedCallsParams) (int64, error)
- func (q *Queries) RecordCallRetry(ctx context.Context, arg RecordCallRetryParams) (int64, error)
- func (q *Queries) RecordWrongCode(ctx context.Context, arg RecordWrongCodeParams) (int64, error)
- func (q *Queries) ReleaseWaitingCall(ctx context.Context, arg ReleaseWaitingCallParams) error
- func (q *Queries) RenewCallLease(ctx context.Context, arg RenewCallLeaseParams) (int64, error)
- func (q *Queries) RescheduleCall(ctx context.Context, arg RescheduleCallParams) (int64, error)
- func (q *Queries) StartCall(ctx context.Context, arg StartCallParams) (int64, error)
- func (q *Queries) UnstartCall(ctx context.Context, arg UnstartCallParams) (int64, error)
- func (q *Queries) UpdateGatewayBrokenReason(ctx context.Context, arg UpdateGatewayBrokenReasonParams) (int64, error)
- func (q *Queries) UseCode(ctx context.Context, arg UseCodeParams) (int64, error)
- func (q *Queries) VoidCode(ctx context.Context, arg VoidCodeParams) error
- func (q *Queries) VoidEarlierCodes(ctx context.Context, arg VoidEarlierCodesParams) (int64, error)
- func (q *Queries) WithTx(tx pgx.Tx) *Queries
- type RecordCallRetryParams
- type RecordWrongCodeParams
- type ReleaseWaitingCallParams
- type RenewCallLeaseParams
- type RescheduleCallParams
- type StartCallParams
- type UnstartCallParams
- type UpdateGatewayBrokenReasonParams
- type UseCodeParams
- type VoidCodeParams
- type VoidEarlierCodesParams
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AddCallItemParams ¶
type BreakGatewayParams ¶
type BreakGatewayRow ¶
type CallContactParams ¶
type CallContactRow ¶
type ClaimDueCallsParams ¶
type ClaimDueCallsRow ¶
type ClaimGatewayProbesRow ¶
type ConfirmedContactParams ¶
type CountContactCodesParams ¶
type CountContactCodesRow ¶
type CountUserCodesParams ¶
type CountUserCodesRow ¶
type DeleteCodeParams ¶
type DeleteContactParams ¶
type DeleteUserCodesParams ¶
type DeleteUserContactsRow ¶
type DropCallItemsParams ¶
type EndCallParams ¶
type EndGatewayBrokenParams ¶
type EndGatewayBrokenRow ¶
type FailGatewayProbeParams ¶
type GetAcknowledgedCallRow ¶
type GetGatewayByIDParams ¶
type GetGatewayByIDRow ¶
type GetGatewayParams ¶
type GetGatewayRow ¶
type GetGatewayStateParams ¶
type GetGatewayStateRow ¶
type GetLeasedCallParams ¶
type GetLeasedCallRow ¶
type GetLeasedCallRow struct {
ID int64
PublicID string
ConnectionID int64
UserID int64
State string
Critical bool
Language pgtype.Text
Text pgtype.Text
Attempts int64
FirstFailedAt pgtype.Timestamptz
FirstAttemptAt pgtype.Timestamptz
ActionData pgtype.Text
ConnectionPublicID string
ConnectionName string
Gateway bool
GatewayBroken bool
UserPublicID string
UserName string
UserLogin string
UserLanguage pgtype.Text
Contact pgtype.Text
}
type GetPageGroupIDParams ¶
type GetPageParams ¶
type GetPageRow ¶
type GetUserByPublicIDParams ¶
type GetUserByPublicIDRow ¶
type InsertCodeParams ¶
type InsertContactParams ¶
type InsertWaitingCallParams ¶
type ListCallGroupsParams ¶
type ListCallGroupsRow ¶
type ListCallableUsersParams ¶
type ListContactsOfUserRow ¶
type ListGatewayHealthRow ¶
type ListGatewaysRow ¶
type ListUnmarkedFailuresRow ¶
type LockCallPersonParams ¶
type LockContactOfUserParams ¶
type LockContactOfUserRow ¶
type LockContactTextParams ¶
type LockContactUserParams ¶
type LockContactUserRow ¶
type LockGatewayStateParams ¶
type LockNewestCodeParams ¶
type LockNewestCodeRow ¶
type LockWaitingCallParams ¶
type LockWaitingCallRow ¶
type MarkCallCriticalParams ¶
type NextCallWorkParams ¶
type NextGatewayProbeParams ¶
type PreviousCallParams ¶
type PreviousCallRow ¶
type PreviousCallRow struct {
State string
EndedAt pgtype.Timestamptz
}
type PruneCodesParams ¶
type PruneEndedCallsParams ¶
type Queries ¶
type Queries struct {
// contains filtered or unexported fields
}
func (*Queries) AddCallItem ¶
func (q *Queries) AddCallItem(ctx context.Context, arg AddCallItemParams) error
AddCallItem adds an Alert Group to a waiting call with the Page that queued it and the stop check that Page passed: the run of its chain and the rule run of a call action, none for the hook of muster dev. One it is about already takes the Page and the stop check of this later Page, as a chain that started over and Paged again — a later Page of the hook, without them, keeps those of the last Page that had them; one dropped from it while it waited — a preparation that dropped it and then found no limiter token — is queued again.
func (*Queries) BreakGateway ¶
func (q *Queries) BreakGateway(ctx context.Context, arg BreakGatewayParams) (BreakGatewayRow, error)
The Broken state of Notification gateways (C-30.FR-8, broken.go): a call answered with a Fatal error, or one that used up delivery.transient_budget, makes its gateway's Connection Broken; any replica probes it through info every delivery.broken_probe_interval, claimed with a lease, and a successful probe or Connection check ends the state. BreakGateway makes the Connection of a Notification gateway Broken with reason, probed first at @next_probe. With @failed_at, the end of the call that failed, only when its last Broken state, if any, ended before it, so that the reconciliation never breaks it again for a call that the end of the state followed. No row when it is Broken already, deleted, not a Bridge Connection or recovered since the call failed.
func (*Queries) CallContact ¶
func (q *Queries) CallContact(ctx context.Context, arg CallContactParams) (CallContactRow, error)
CallContact reads the confirmed contact of a User at a Notification gateway that is not deleted, the one a call's first attempt goes to.
func (*Queries) ClaimDueCalls ¶
func (q *Queries) ClaimDueCalls(ctx context.Context, arg ClaimDueCallsParams) ([]ClaimDueCallsRow, error)
ClaimDueCalls leases the due calls that wait for their first attempt or are being retried, whose lease is free or ran out, critical first, then by when they are due. The choice is a materialized CTE, run once, as in ClaimDueDeliveries.
func (*Queries) ClaimGatewayProbes ¶
func (q *Queries) ClaimGatewayProbes(ctx context.Context, arg ClaimGatewayProbesParams) ([]ClaimGatewayProbesRow, error)
ClaimGatewayProbes leases the Broken gateways that are not deleted whose probe is due and whose lease is free or ran out, and moves their next probe to @next_probe, so that a probe that a replica dies in is made again after delivery.broken_probe_interval. The choice is a materialized CTE, run once, as in ClaimDueCalls.
func (*Queries) ConfirmContact ¶
func (q *Queries) ConfirmContact(ctx context.Context, arg ConfirmContactParams) error
func (*Queries) ConfirmedContact ¶
ConfirmedContact reads the confirmed contact of a User at a Notification gateway that is not deleted, the one that is called.
func (*Queries) CountContactCodes ¶
func (q *Queries) CountContactCodes(ctx context.Context, arg CountContactCodesParams) (CountContactCodesRow, error)
CountContactCodes counts the codes for one contact text asked for after since, by any User, with the oldest of them.
func (*Queries) CountUserCodes ¶
func (q *Queries) CountUserCodes(ctx context.Context, arg CountUserCodesParams) (CountUserCodesRow, error)
CountUserCodes counts the codes a User asked for after since, with the oldest of them.
func (*Queries) CountUserContactCodes ¶
func (q *Queries) CountUserContactCodes(ctx context.Context, arg CountUserContactCodesParams) (CountUserContactCodesRow, error)
CountUserContactCodes counts the codes a User asked for to one contact text after since, with the oldest of them.
func (*Queries) DeleteCode ¶
func (q *Queries) DeleteCode(ctx context.Context, arg DeleteCodeParams) error
DeleteCode deletes a code that was never sent, since no limiter token was free: it does not count.
func (*Queries) DeleteContact ¶
func (*Queries) DeleteReplacedContacts ¶
func (q *Queries) DeleteReplacedContacts(ctx context.Context, arg DeleteReplacedContactsParams) ([]DeleteReplacedContactsRow, error)
DeleteReplacedContacts deletes the confirmed contacts of a User at a gateway other than keep, which the confirmation of keep replaces.
func (*Queries) DeleteUnconfirmedContacts ¶
func (q *Queries) DeleteUnconfirmedContacts(ctx context.Context, arg DeleteUnconfirmedContactsParams) ([]DeleteUnconfirmedContactsRow, error)
DeleteUnconfirmedContacts deletes the unconfirmed contacts of a User at a gateway, which a new contact replaces; the codes keep counting toward the limits without them.
func (*Queries) DeleteUserCodes ¶
func (*Queries) DeleteUserContacts ¶
func (q *Queries) DeleteUserContacts(ctx context.Context, arg DeleteUserContactsParams) ([]DeleteUserContactsRow, error)
DeleteUserContacts deletes every contact of a User and returns them with their gateways (C-03.FR-13).
func (*Queries) DropCallItems ¶
func (q *Queries) DropCallItems(ctx context.Context, arg DropCallItemsParams) error
DropCallItems drops from a call, before its first attempt, the Alert Groups that stopped.
func (*Queries) EndCall ¶
EndCall ends a call — accepted, Not delivered with its reason, or dropped — counting the attempt that ended it, if one did, and clears its text, which names its Alert Groups, and its action data, which are never sent again; the language and the id of the key that signed the data stay. It returns whether the call went, which starts the combine window of the next one.
func (*Queries) EndGatewayBroken ¶
func (q *Queries) EndGatewayBroken(ctx context.Context, arg EndGatewayBrokenParams) (EndGatewayBrokenRow, error)
EndGatewayBroken ends the Broken state of a gateway at @recovered_at and frees the lease of its probe, and tells when it became Broken and whether the Connection is deleted; it locks the row once, by the update, after the gateway's advisory lock (LockGatewayState). A probe passes its owner: then only while this replica still holds the probe's lease at the real time @now. No row when it is not Broken, or the probe's lease is not held.
func (*Queries) FailGatewayProbe ¶
FailGatewayProbe records the error of a failed probe as the reason of the Broken gateway and frees its lease, while this replica still holds it at the real time @now; no row changes when the lease ran out or went to another replica, or the state ended.
func (*Queries) GetAcknowledgedCall ¶
func (q *Queries) GetAcknowledgedCall(ctx context.Context, arg GetAcknowledgedCallParams) (GetAcknowledgedCallRow, error)
GetAcknowledgedCall reads the call public_id of a Notification gateway's Connection, whatever its state, with the notification_id the gateway accepted it under and when it ended, and with the User it was for — Role, state, name and profile language — for the Acknowledge of a notification_acknowledged event (C-30.FR-6). No row for a call of another Connection or Organization, or none.
func (*Queries) GetGateway ¶
func (q *Queries) GetGateway(ctx context.Context, arg GetGatewayParams) (GetGatewayRow, error)
GetGateway reads the Notification gateway public_id, which is not deleted.
func (*Queries) GetGatewayByID ¶
func (q *Queries) GetGatewayByID(ctx context.Context, arg GetGatewayByIDParams) (GetGatewayByIDRow, error)
GetGatewayByID reads the Notification gateway by internal id, which is not deleted and still declares the role gateway: the gateway of a call step.
func (*Queries) GetGatewayState ¶
func (q *Queries) GetGatewayState(ctx context.Context, arg GetGatewayStateParams) (GetGatewayStateRow, error)
GetGatewayState reads the Connection public_id, deleted ones included, with whether it is a Broken gateway, for the resolve of an open MusterNotificationGatewayBroken of a gateway that is not Broken, under the gateway's advisory lock. No row when no Connection of the Organization has the public_id.
func (*Queries) GetLeasedCall ¶
func (q *Queries) GetLeasedCall(ctx context.Context, arg GetLeasedCallParams) (GetLeasedCallRow, error)
GetLeasedCall reads, and locks, a call whose lease this replica still holds at the real time now, with its gateway and whether it is still a Notification gateway, not deleted, and whether the call came due while the gateway was Broken — it is Broken, or the call's due time lies before the end of its last Broken state, which another replica ended after this one claimed the call (P-68); this holds within the replicas' clock skew, so a Page made on a replica whose clock is behind by δ, within δ after the end, may be ended too, accepted as NTP keeps δ to milliseconds and MusterClockSkew fires above 2 s — its User and, from its first attempt, its contact while that is still confirmed and its signed action data, null for a call that a replica of an earlier version started. No row when the lease ran out or went to another replica, or the call ended.
func (*Queries) GetPage ¶
func (q *Queries) GetPage(ctx context.Context, arg GetPageParams) (GetPageRow, error)
The calls through Notification gateways (C-30.FR-4): a row per call to a person through a gateway, the Alert Groups it is about, claimed with a lease by any replica's gateway sender (sender.go, calls.go). GetPage reads what a Page names: the Alert Group, with whether it is critical, which puts its call first; the Notification gateway, not deleted; and the User, not deleted. No row when one of them is not so.
func (*Queries) GetPageGroupID ¶
GetPageGroupID reads the internal id of the Alert Group public_id, for the hook of muster dev.
func (*Queries) GetUserByPublicID ¶
func (q *Queries) GetUserByPublicID(ctx context.Context, arg GetUserByPublicIDParams) (GetUserByPublicIDRow, error)
GetUserByPublicID reads a User an Admin names, deleted ones included.
func (*Queries) InsertCode ¶
func (*Queries) InsertContact ¶
func (*Queries) InsertWaitingCall ¶
func (q *Queries) InsertWaitingCall(ctx context.Context, arg InsertWaitingCallParams) (int64, error)
InsertWaitingCall creates the call that waits for its first attempt, due at not_before, never while it is null.
func (*Queries) ListCallGroups ¶
func (q *Queries) ListCallGroups(ctx context.Context, arg ListCallGroupsParams) ([]ListCallGroupsRow, error)
ListCallGroups lists the Alert Groups a call is about, without those dropped before its first attempt, by number, each with whether the chain or the rule that Paged has stopped on it (C-30.FR-4), the stop check its item keeps: the Alert Group is no longer firing — acknowledged, snoozed or resolved —; the run of its chain stopped, or is of an earlier start of its chains, which a start-over left as it was when it had run out; or the rule run of a call action stopped.
func (*Queries) ListCallableUsers ¶
func (q *Queries) ListCallableUsers(ctx context.Context, arg ListCallableUsersParams) ([]int64, error)
ListCallableUsers lists those of the Users user_ids who have a confirmed contact at the Notification gateway, whom a Page through it may call.
func (*Queries) ListContactsOfUser ¶
func (q *Queries) ListContactsOfUser(ctx context.Context, arg ListContactsOfUserParams) ([]ListContactsOfUserRow, error)
ListContactsOfUser lists the contacts of a User with their gateway, by gateway and creation, each unconfirmed one with the confirmed contact it replaces once confirmed.
func (*Queries) ListGatewayHealth ¶
func (q *Queries) ListGatewayHealth(ctx context.Context, orgID int64) ([]ListGatewayHealthRow, error)
ListGatewayHealth lists the Notification gateways that are not deleted, and the Broken ones whose stored info no longer declares the role gateway, each with whether it is Broken, for muster_notification_gateway_broken.
func (*Queries) ListGateways ¶
SPDX-License-Identifier: AGPL-3.0-only Copyright The Muster Authors Notification gateways (C-30): the Bridge Connections whose stored info declares the role gateway, the contacts of people at them and the confirmation codes of the contacts, hashed. ListGateways lists the Notification gateways that are not deleted, by name.
func (*Queries) ListUnmarkedFailures ¶
func (q *Queries) ListUnmarkedFailures(ctx context.Context, arg ListUnmarkedFailuresParams) ([]ListUnmarkedFailuresRow, error)
ListUnmarkedFailures lists the Notification gateways that are not deleted and not Broken whose latest call that failed in a way that breaks a gateway — Not delivered with call_refused after a Fatal outcome that reached the gateway or the outbound policy (the class fatal; Muster's own refusals end gateway_deleted), or with call_budget_used — ended after @since and after the end of their last Broken state, with that call's reason, class, error and end. The Leader's reconciliation makes them Broken: the replica that ended the call stopped before it did.
func (*Queries) LockCallPerson ¶
func (q *Queries) LockCallPerson(ctx context.Context, arg LockCallPersonParams) error
LockCallPerson takes, until the transaction ends, the lock of the calls of a User through a Notification gateway (class db.GatewayCallLockClass): a Page joining or creating the waiting call, the start of a first attempt and the end of a call serialize. A collision of the hash only serializes two people.
func (*Queries) LockContactOfUser ¶
func (q *Queries) LockContactOfUser(ctx context.Context, arg LockContactOfUserParams) (LockContactOfUserRow, error)
LockContactOfUser locks the contact public_id of a User, with its gateway, whether that is still a Notification gateway, and the confirmed contact it replaces once confirmed.
func (*Queries) LockContactText ¶
func (q *Queries) LockContactText(ctx context.Context, arg LockContactTextParams) error
LockContactText takes, until the transaction ends, the lock of the code requests for one contact text (class db.GatewayContactLockClass), so that the count of its requests and the new one of concurrent requests of several Users serialize. A collision of the hash only serializes two texts.
func (*Queries) LockContactUser ¶
func (q *Queries) LockContactUser(ctx context.Context, arg LockContactUserParams) (LockContactUserRow, error)
LockContactUser locks the User whose contacts change, so that the contacts and codes of one User change one at a time.
func (*Queries) LockGatewayState ¶
func (q *Queries) LockGatewayState(ctx context.Context, arg LockGatewayStateParams) error
LockGatewayState takes, until the transaction ends, the advisory lock of the Broken state of the gateway's Connection id (class db.GatewayStateLockClass), which every transaction of the state takes before the row.
func (*Queries) LockNewestCode ¶
func (q *Queries) LockNewestCode(ctx context.Context, arg LockNewestCodeParams) (LockNewestCodeRow, error)
LockNewestCode locks the newest code of a contact that the gateway accepted, for checking it, with whether the web session that asked for it ended; a code whose sending failed, or that is still being sent, is never the one checked. Newest is by id, as VoidEarlierCodes counts earlier, not by created_at, which replicas may set with skewed clocks.
func (*Queries) LockWaitingCall ¶
func (q *Queries) LockWaitingCall(ctx context.Context, arg LockWaitingCallParams) (LockWaitingCallRow, error)
LockWaitingCall locks the call of a User through a gateway that waits for its first attempt.
func (*Queries) MarkCallCritical ¶
func (q *Queries) MarkCallCritical(ctx context.Context, arg MarkCallCriticalParams) error
MarkCallCritical makes a waiting call critical once a critical Alert Group joins it.
func (*Queries) MarkCodeSent ¶
func (q *Queries) MarkCodeSent(ctx context.Context, arg MarkCodeSentParams) error
MarkCodeSent records that the gateway accepted the notification of a code, which makes it the one checked.
func (*Queries) NextCallWork ¶
func (q *Queries) NextCallWork(ctx context.Context, arg NextCallWorkParams) (NextCallWorkRow, error)
NextCallWork is when the next call can be claimed: the earliest due time of a call without a live lease (business clock), and the earliest end of a live lease (real clock), the zero time for none.
func (*Queries) NextGatewayProbe ¶
func (q *Queries) NextGatewayProbe(ctx context.Context, arg NextGatewayProbeParams) (NextGatewayProbeRow, error)
NextGatewayProbe is when the next probe of a Broken gateway that is not deleted is due (business clock), and the earliest end of a live lease of one (real clock), the zero time for none.
func (*Queries) NotifyCalls ¶
NotifyCalls wakes the gateway senders of every replica once the transaction commits.
func (*Queries) PreviousCall ¶
func (q *Queries) PreviousCall(ctx context.Context, arg PreviousCallParams) (PreviousCallRow, error)
PreviousCall reads the latest call of a User through a gateway that went — whose first attempt was made, or tried — with its state and its end, null while it is being sent.
func (*Queries) PruneCodes ¶
PruneCodes deletes up to batch_size codes that expired before @before, used and void ones included. A code being checked is skipped and taken at the next run. The batch is chosen once, in a materialized CTE, as PruneLinkRequests does.
func (*Queries) PruneEndedCalls ¶
PruneEndedCalls deletes up to batch_size calls that ended at or before @now and are about no Alert Group any more: the retention of Alert Groups deleted every one of theirs, and its cascade their items. The batch is chosen once, in a materialized CTE, as PruneCodes does; a call that another transaction holds is taken at the next run.
func (*Queries) RecordCallRetry ¶
RecordCallRetry counts a failed attempt of the budget and makes the call due again at a later time.
func (*Queries) RecordWrongCode ¶
RecordWrongCode counts a wrong code; the attempt that reaches max_attempts voids the code.
func (*Queries) ReleaseWaitingCall ¶
func (q *Queries) ReleaseWaitingCall(ctx context.Context, arg ReleaseWaitingCallParams) error
ReleaseWaitingCall sets when the call that waits behind a call being sent may go, once that call ended.
func (*Queries) RenewCallLease ¶
RenewCallLease renews the lease of a call being retried for its next attempt.
func (*Queries) RescheduleCall ¶
RescheduleCall makes a call due again at a later time without counting an attempt — no limiter token was free, or the gateway asked to wait — and frees its lease. A gateway's RetryAfter passes failed_at, which starts the time budget of delivery.transient_budget when no failure started it yet.
func (*Queries) StartCall ¶
StartCall makes the first attempt of a waiting call: it keeps its contact, its text, its language and its action data, signed by the key button_key_id, from now on, takes no more Alert Groups and is due now, its lease renewed for the attempt.
func (*Queries) UnstartCall ¶
UnstartCall undoes the start of a call that its round stopped before it was made (sender.go, gate): it waits again, due at @at, without its contact, language, text, action data and the id of their key, and frees its lease, so that the Pages that come due join it and its Alert Groups are read again right before its first attempt, as when its preparation had found no limiter token. Only a call this replica holds the lease of, started and never attempted, and only while no call waits behind it: the caller holds the person's lock, and a Page that came due since the start queued a call that waits behind it; the call then stays started (no row).
func (*Queries) UpdateGatewayBrokenReason ¶
func (q *Queries) UpdateGatewayBrokenReason(ctx context.Context, arg UpdateGatewayBrokenReasonParams) (int64, error)
UpdateGatewayBrokenReason keeps a Broken gateway Broken with the error of its last failure as the reason; it returns whether the gateway was Broken.
func (*Queries) VoidCode ¶
func (q *Queries) VoidCode(ctx context.Context, arg VoidCodeParams) error
VoidCode voids a code whose sending failed; it still counts toward the limits.
func (*Queries) VoidEarlierCodes ¶
VoidEarlierCodes voids the codes of a contact asked for before keep that are neither used nor void, which keep replaces once the gateway accepted it.