cleanup

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Aug 9, 2026 License: AGPL-3.0 Imports: 17 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package cleanup runs the server-side near-duplicate scanner and its Telegram notifier: on a fixed interval, walk every tenant, upsert pending queue entries. Merging happens client-side in a scheduled agent — this package calls no LLMs.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Notifier

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

Notifier posts cleanup summaries to a Telegram chat. Both token and chat ID must be set; if either is empty, pass nil (Scanner treats nil as silent).

func NewNotifier

func NewNotifier(botToken, chatID string) *Notifier

NewNotifier returns a Notifier, or nil if either credential is empty (pass the nil to Scanner unchanged — it treats nil as silent mode).

func (*Notifier) SendScanSummary

func (n *Notifier) SendScanSummary(ctx context.Context, stats ScanStats) error

SendScanSummary posts a human-readable summary of one scan sweep.

type ScanStats

type ScanStats struct {
	TenantsScanned int
	PairsFound     int
	PairsInserted  int
	PairsSkipped   int // already enqueued
	Errors         int
	DocsArchived   int
	DocsDeleted    int
}

ScanStats summarises one sweep across all tenants.

type Scanner

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

Scanner runs the near-duplicate scan and keeps cleanup_queue populated.

func NewScanner

func NewScanner(
	lint *repository.LintRepository,
	tenants *repository.TenantRepository,
	queue *repository.CleanupQueueRepository,
	retentionRepo *repository.RetentionRepository,
	thresholds *staleness.ThresholdStore,
	multiplier int,
	graceDays int,
	notifier *Notifier,
	logger *slog.Logger,
) *Scanner

NewScanner constructs the scanner. A nil notifier means silent scans.

func (*Scanner) RunOnce

func (s *Scanner) RunOnce(ctx context.Context) (ScanStats, error)

RunOnce performs a single sweep. Returns stats even on partial failure; per-tenant errors are counted, not fatal.

func (*Scanner) Start

func (s *Scanner) Start(ctx context.Context, interval time.Duration)

Start launches a goroutine calling RunOnce every `interval` until ctx is cancelled. The first sweep fires immediately.

Jump to

Keyboard shortcuts

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