Files
lincodex/backend/internal/port/outbound/delivery_statistics.go
T

35 lines
1.1 KiB
Go

package outbound
import (
"context"
"time"
"lincodex/backend/internal/domain"
)
// DeliveryStatusCount is the number of stored deliveries of one kind in one
// status.
type DeliveryStatusCount struct {
Kind domain.MailKind
Status domain.DeliveryStatus
Deliveries int64
}
// DeliveryStatistics aggregates all stored deliveries for operators and
// metrics. It holds no recipient, address, content, or delivery ID.
type DeliveryStatistics struct {
// Counts has one entry per kind and status that has deliveries.
Counts []DeliveryStatusCount
// EarliestPendingAttemptAt is the earliest NextAttemptAt of a pending
// service mail delivery (domain.ServiceMailKinds, the kinds a worker
// sends), by the application clock that wrote it; zero without one. A
// notification waits for its sending to be connected (TASK-462) and is
// not counted, so it never looks overdue.
EarliestPendingAttemptAt time.Time
}
// DeliveryStatisticsReader reads the delivery aggregate without locking.
type DeliveryStatisticsReader interface {
DeliveryStatistics(ctx context.Context) (DeliveryStatistics, error)
}