Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Change ¶
type Change struct {
URL string `json:"url"`
Type ChangeType `json:"type"`
Field string `json:"field,omitempty"`
OldValue string `json:"old_value,omitempty"`
NewValue string `json:"new_value,omitempty"`
Timestamp time.Time `json:"timestamp"`
}
Change represents a detected content change.
type ChangeDetector ¶
type ChangeDetector struct {
// contains filtered or unexported fields
}
ChangeDetector compares crawl results against historical snapshots.
func NewChangeDetector ¶
func NewChangeDetector(snapshotDir string, logger *slog.Logger) *ChangeDetector
NewChangeDetector creates a new change detector.
type ChangeType ¶
type ChangeType string
ChangeType identifies what kind of change occurred.
const ( ChangeAdded ChangeType = "added" ChangeModified ChangeType = "modified" ChangeRemoved ChangeType = "removed" )
type DiffResult ¶
type DiffResult struct {
URL string `json:"url"`
Added []string `json:"added,omitempty"`
Removed []string `json:"removed,omitempty"`
Changed []string `json:"changed,omitempty"`
}
DiffResult holds the result of a content diff.
func DiffText ¶
func DiffText(old, new string) DiffResult
DiffText computes a line-level diff between two text strings.
type NotificationChannel ¶
type NotificationChannel interface {
Send(ctx context.Context, changes []Change) error
Type() NotificationType
}
NotificationChannel is an interface for notification delivery.
type NotificationType ¶
type NotificationType string
NotificationType specifies the notification channel.
const ( NotifyWebhook NotificationType = "webhook" NotifySlack NotificationType = "slack" NotifyEmail NotificationType = "email" )
type Notifier ¶
type Notifier struct {
// contains filtered or unexported fields
}
Notifier sends notifications when changes are detected.
func NewNotifier ¶
NewNotifier creates a new change notifier.
func (*Notifier) AddChannel ¶
func (n *Notifier) AddChannel(ch NotificationChannel)
AddChannel registers a notification channel.
type Schedule ¶
type Schedule struct {
Name string `json:"name"`
URLs []string `json:"urls"`
Interval time.Duration `json:"interval"`
MaxDepth int `json:"max_depth"`
Rules []string `json:"rules,omitempty"`
}
Schedule represents a recurring crawl schedule.
type Scheduler ¶
type Scheduler struct {
// contains filtered or unexported fields
}
Scheduler runs crawls on a schedule.
func NewScheduler ¶
NewScheduler creates a new crawl scheduler.
type WebhookChannel ¶
type WebhookChannel struct {
URL string
// contains filtered or unexported fields
}
WebhookChannel sends notifications via HTTP webhook.
func (*WebhookChannel) Send ¶
func (w *WebhookChannel) Send(ctx context.Context, changes []Change) error
func (*WebhookChannel) Type ¶
func (w *WebhookChannel) Type() NotificationType