Documentation
¶
Overview ¶
Package sweep implements M4's bounded-staleness reconciliation, resumable authoritative listings, disappearance verification, delivery-gap healing, and retention work on River's sweep queue.
Index ¶
- Constants
- func PrunerPeriodicJobs(config *Config) []*river.PeriodicJob
- func ReconciliationPeriodicJobs(config *Config) []*river.PeriodicJob
- type Config
- type GapHealArgs
- type KickoffArgs
- type ListPageArgs
- type LogObserver
- type Observer
- type Observers
- type Options
- type PruneArgs
- type PruneHook
- type SchedulePlan
- type Service
- func (s *Service) HealDeliveryGaps(ctx context.Context, args GapHealArgs) error
- func (s *Service) Kickoff(ctx context.Context, args KickoffArgs) error
- func (s *Service) Prune(ctx context.Context) (int64, int64, error)
- func (s *Service) PrunerPeriodicJobs() []*river.PeriodicJob
- func (s *Service) ReconcilePage(ctx context.Context, args ListPageArgs) error
- func (s *Service) ReconciliationPeriodicJobs() []*river.PeriodicJob
- func (s *Service) RegisterPrunerWorker(workers *river.Workers)
- func (s *Service) RegisterReconciliationWorkers(workers *river.Workers)
- func (s *Service) SetRiverClient(client *river.Client[pgx.Tx])
Constants ¶
View Source
const ( KindRepositories = "repositories" KindStacks = "stacks" KindPullRequests = "pull_requests" KindRepoRules = "repo_rules" KindClosed = "closed_tracked" )
Variables ¶
This section is empty.
Functions ¶
func PrunerPeriodicJobs ¶
func PrunerPeriodicJobs(config *Config) []*river.PeriodicJob
func ReconciliationPeriodicJobs ¶
func ReconciliationPeriodicJobs(config *Config) []*river.PeriodicJob
Types ¶
type Config ¶
type Config struct {
// InstallationID selects the GitHub installation reconciled by this service.
InstallationID int64
// OpenStackMaxStaleness bounds how long an open stack may go unchecked.
OpenStackMaxStaleness time.Duration
// OpenPRMaxStaleness bounds how long an open pull request may go unchecked.
OpenPRMaxStaleness time.Duration
// RepoRulesMaxStaleness bounds repository-rules cache staleness.
RepoRulesMaxStaleness time.Duration
// ClosedMaxStaleness bounds checks of tracked closed entities.
ClosedMaxStaleness time.Duration
// RepositoryListPeriod controls authoritative installation listings.
RepositoryListPeriod time.Duration
// PageSize bounds authoritative GitHub list pages.
PageSize int
// GapHealPeriod controls delivery-gap scan scheduling.
GapHealPeriod time.Duration
// GapWindow is the delivery-history interval inspected by each scan.
GapWindow time.Duration
// GapPageSize bounds one deliveries API page.
GapPageSize int
// GapMaxPages bounds pages inspected before scheduling a continuation.
GapMaxPages int
// GapLeaseTTL bounds failover after a gap-heal worker stops making progress.
GapLeaseTTL time.Duration
// GapContinuationDelay paces page-cap continuations.
GapContinuationDelay time.Duration
// GapDeepScanPeriod bounds detection of deliveries behind the cheap cursor.
GapDeepScanPeriod time.Duration
// RetentionPeriod controls payload-pruner scheduling.
RetentionPeriod time.Duration
// RetentionAge determines when bulky retained data becomes eligible.
RetentionAge time.Duration
// RetentionBatchSize bounds deletes per transaction.
RetentionBatchSize int
// Now supplies service time; it defaults to time.Now.
Now func() time.Time
// Observer receives sweep-overrun and gap-healing signals.
Observer Observer
// OnPrune receives per-kind deletion totals after a prune pass.
OnPrune PruneHook
}
type GapHealArgs ¶
type GapHealArgs struct {
Installation int64 `json:"installation_id"`
Cursor string `json:"cursor,omitempty"`
LeaseToken string `json:"lease_token,omitempty"`
}
func (GapHealArgs) Kind ¶
func (GapHealArgs) Kind() string
type KickoffArgs ¶
type KickoffArgs struct {
SweepKind string `json:"sweep_kind"`
Installation int64 `json:"installation_id"`
}
func (KickoffArgs) Kind ¶
func (KickoffArgs) Kind() string
type ListPageArgs ¶
type ListPageArgs struct {
SweepKind string `json:"sweep_kind"`
Installation int64 `json:"installation_id"`
ScopeKey string `json:"scope_key"`
Cursor string `json:"cursor"`
}
func (ListPageArgs) Kind ¶
func (ListPageArgs) Kind() string
type LogObserver ¶
type LogObserver struct{}
func (LogObserver) GapRedelivery ¶
func (LogObserver) GapRedelivery( _ context.Context, deliveryID int64, guid string, )
func (LogObserver) GapWindowIncomplete ¶
func (LogObserver) GapWindowIncomplete( _ context.Context, cursor string, pages int, )
func (LogObserver) SweepOverrun ¶
type Observers ¶
type Observers []Observer
func (Observers) GapRedelivery ¶
func (Observers) GapWindowIncomplete ¶
type Options ¶
type Options struct {
Pool *pgxpool.Pool
REST *gh.RESTClient
Deliveries *gh.DeliveriesClient
Config Config
}
type SchedulePlan ¶
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
func (*Service) HealDeliveryGaps ¶
func (s *Service) HealDeliveryGaps( ctx context.Context, args GapHealArgs, ) error
func (*Service) Prune ¶
Prune enforces the decided 90-day bulky-data policy. Delivery skeleton rows remain for C-R4; M5 alone owns change_events retention.
func (*Service) PrunerPeriodicJobs ¶
func (s *Service) PrunerPeriodicJobs() []*river.PeriodicJob
func (*Service) ReconcilePage ¶
func (s *Service) ReconcilePage( ctx context.Context, args ListPageArgs, ) error
func (*Service) ReconciliationPeriodicJobs ¶
func (s *Service) ReconciliationPeriodicJobs() []*river.PeriodicJob
func (*Service) RegisterPrunerWorker ¶
func (*Service) RegisterReconciliationWorkers ¶
Click to show internal directories.
Click to hide internal directories.