sweep

package
v1.15.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 27, 2026 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Overview

Package sweep implements the subscription lifecycle sweep: marking traffic-exceeded and expired subscriptions finished, then firing the retryable side effects (owner notification, cache invalidation). Only the module facade may reach it.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Deps

Deps declares the subdomain's dependencies; the module facade forwards them from the composition root.

type Notifier

type Notifier interface {
	NotifySubscriptionExpired(ctx context.Context, email string, expiredAt time.Time)
	NotifyTrafficExceeded(ctx context.Context, email string)
}

Notifier delivers the lifecycle notices to the subscription owner. The composition root adapts it to the notification queue until a notification facade owns email delivery.

type OwnerEmailReader

type OwnerEmailReader interface {
	FindUserAuthMethodByUserId(ctx context.Context, method string, userId int64) (*user.AuthMethods, error)
}

OwnerEmailReader is the read-only identity port resolving a user's email binding; the legacy user-auth repository satisfies it structurally.

type Service

type Service struct {
	// contains filtered or unexported fields
}

Service is the lifecycle-sweep entry point used by the subscription facade.

func NewService

func NewService(deps Deps) *Service

func (*Service) CheckSubscriptions

func (s *Service) CheckSubscriptions(ctx context.Context) error

CheckSubscriptions runs both lifecycle sweeps. Each sweep commits its status flip in a subscription-domain transaction; notifications and cache invalidation are retryable side effects that run after the commit (ADR-001 step 2).

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL