feat(notification): add Resend quota gate and waiting-for-reset state
This commit is contained in:
1 parent
3b917befa9
commit
b856d4ff54
40 files changed
+4116
-48
No files matched your search
@@ -3,6 +3,7 @@ package outbound
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"time"
|
||||
|
||||
"github.com/google/uuid"
|
||||
|
||||
@@ -66,6 +67,11 @@ type DeliveryRepository interface {
|
||||
// next.Version() - 1. Otherwise it returns ErrDeliveryVersionConflict.
|
||||
WaitForQuota(ctx context.Context, next domain.Delivery) error
|
||||
|
||||
// LatestForRecipient returns the status of the newest delivery of kind
|
||||
// addressed to the account, by creation time, or ErrDeliveryNotFound
|
||||
// when there is none. It reads no address and no content.
|
||||
LatestForRecipient(ctx context.Context, recipientUserID uuid.UUID, kind domain.MailKind) (DeliveryStatusSnapshot, error)
|
||||
|
||||
// Rebind stores the provider account of next as returned by
|
||||
// domain.Delivery.Rebind under the same version rule as WaitForQuota. A
|
||||
// delivery that has an attempt meanwhile fails with
|
||||
@@ -74,6 +80,17 @@ type DeliveryRepository interface {
|
||||
Rebind(ctx context.Context, next domain.Delivery) error
|
||||
}
|
||||
|
||||
// DeliveryStatusSnapshot is the state of a delivery without its recipient
|
||||
// address or content. A zero NextAttemptAt means none is scheduled.
|
||||
type DeliveryStatusSnapshot struct {
|
||||
DeliveryID uuid.UUID
|
||||
Kind domain.MailKind
|
||||
Status domain.DeliveryStatus
|
||||
NextAttemptAt time.Time
|
||||
CreatedAt time.Time
|
||||
UpdatedAt time.Time
|
||||
}
|
||||
|
||||
// MailRequestRepository stores mail requests between the producer
|
||||
// transaction and the consumer transaction that turns them into deliveries.
|
||||
// Errors never quote the request text.
|
||||
|
||||
Reference in new issue
Block a user