Documentation
¶
Overview ¶
Package sending runs campaign sends: it builds the recipient list, applies suppressions, routes each recipient to a sending provider, throttles per provider and per mailbox provider, sends in batches through River jobs, updates live counters and pauses automatically when thresholds trip.
Index ¶
- Variables
- func Retryable(err error) bool
- func Tx(ctx context.Context, pool *pgxpool.Pool, fn func(pgx.Tx) error) error
- func WithRecheck(ctx context.Context, campaignID uuid.UUID, rc Recheck) context.Context
- type Engagement
- type Explained
- type NotReadyError
- type Readiness
- type ReadyAlways
- type Recheck
- type Recorder
- type Segments
- type Starter
- type Unavailable
Constants ¶
This section is empty.
Variables ¶
var ErrNotReady = errors.New("send readiness is blocked")
ErrNotReady is returned when Send Readiness blocks the send at start.
ErrUnavailable is returned by Unavailable, before the sending domain is wired.
Functions ¶
func Tx ¶
Tx runs fn in a transaction and retries it when Postgres aborts it for a deadlock or a serialization failure. Concurrent batches update the same counter rows and can lock them in different orders; an aborted attempt commits nothing, so retrying is safe. fn must not keep state between attempts.
Types ¶
type Engagement ¶
type Engagement struct {
MessageID uuid.UUID
Click bool
Link int
UserAgent string
IP string
Method string
At time.Time
}
Engagement is one open-pixel fetch or link click, as the tracking endpoints (and the demo transport) report it. Link is the click's link position; UserAgent, IP and Method decide human or machine.
type Explained ¶
Explained is an error that says why in a reader's language too, as the engine's state errors do ("Weekly Digest #142 is already sending").
type NotReadyError ¶
NotReadyError is ErrNotReady with what blocked the send.
func (*NotReadyError) Error ¶
func (e *NotReadyError) Error() string
func (*NotReadyError) Is ¶
func (e *NotReadyError) Is(target error) bool
Is makes errors.Is(err, ErrNotReady) hold.
type Readiness ¶
Readiness reruns Send Readiness when a send starts (the send-time recheck, add-on §3.8) and supplies its per-mailbox-provider throttles. The engine falls back to ReadyAlways when none is wired.
type ReadyAlways ¶
type ReadyAlways struct{}
ReadyAlways never blocks and keeps the default throttles.
type Recheck ¶
type Recheck struct {
// Verdict is "ready", "warnings" or "blocked".
Verdict string
// Blocking lists the titles of the checks that block.
Blocking []string
// Throttles are messages per second per mailbox provider ("outlook": 5);
// nil keeps the engine's defaults.
Throttles map[string]float64
// Audience is the final recipient count the recheck counted, and RunID
// its Send Readiness run; a hold records both.
Audience int64
RunID string
}
Recheck is the result of the send-time recheck.
type Recorder ¶
type Recorder interface {
RecordEngagement(ctx context.Context, evs []Engagement) error
}
Recorder records opens and clicks (the tracking domain implements it).
type Segments ¶
type Segments interface {
ContactIDs(ctx context.Context, workspaceID, segmentID uuid.UUID) ([]uuid.UUID, error)
}
Segments resolves saved segments to contact ids (the audience domain).
type Starter ¶
type Starter interface {
Start(ctx context.Context, campaignID uuid.UUID, startedBy uuid.UUID) error
Pause(ctx context.Context, campaignID uuid.UUID, by uuid.UUID, reason string) error
Resume(ctx context.Context, campaignID uuid.UUID, by uuid.UUID) error
Cancel(ctx context.Context, campaignID uuid.UUID, by uuid.UUID) error
}
Starter starts or schedules a campaign send. The review & send screen calls it after confirmation (and after approval, when required).
type Unavailable ¶
type Unavailable struct{}
Unavailable is the Starter used until the sending domain replaces it.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package engine is ReputeCast's sending engine (spec 5.3, 7.6): it builds a campaign's recipient list, routes, renders and hands every message to its sending provider within rate limits and throttles, watches bounce, complaint and outage signals and pauses what they concern, sends automation emails, and serves the live monitor's snapshot and stream.
|
Package engine is ReputeCast's sending engine (spec 5.3, 7.6): it builds a campaign's recipient list, routes, renders and hands every message to its sending provider within rate limits and throttles, watches bounce, complaint and outage signals and pauses what they concern, sends automation emails, and serves the live monitor's snapshot and stream. |