scrape

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Aug 4, 2026 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GroupStats

type GroupStats struct {
	Low        int64
	High       int64
	ProviderID string
}

type NNTPAdapter

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

func NewNNTPAdapter

func NewNNTPAdapter(p nntpClient) *NNTPAdapter

func (*NNTPAdapter) GroupStats

func (a *NNTPAdapter) GroupStats(ctx context.Context, group string) (GroupStats, error)

func (*NNTPAdapter) ID

func (a *NNTPAdapter) ID() string

func (*NNTPAdapter) XOver

func (a *NNTPAdapter) XOver(ctx context.Context, group string, from, to int64) ([]OverviewHeader, error)

func (*NNTPAdapter) XOverOnProvider added in v0.9.0

func (a *NNTPAdapter) XOverOnProvider(ctx context.Context, providerID, group string, from, to int64) ([]OverviewHeader, string, error)

func (*NNTPAdapter) XOverWithProvider added in v0.8.0

func (a *NNTPAdapter) XOverWithProvider(ctx context.Context, group string, from, to int64) ([]OverviewHeader, string, error)

type Options

type Options struct {
	Newsgroups               []string
	BatchSize                int64
	Concurrency              int
	MaxBatches               int
	MaxNewSourceDaysPerPass  int
	BackfillUntilDateByGroup map[string]time.Time
	RangeCoordinator         RangeCoordinator
	RunObserver              func(context.Context, map[string]any, error)
	Timeframes               []Timeframe
	DeferredClaimOwner       string
	DeferredClaimLease       time.Duration
	DeferredMaxAttempts      int
}

type OverviewHeader

type OverviewHeader struct {
	ArticleNumber int64
	MessageID     string
	Subject       string
	Poster        string
	DateUTC       *time.Time
	Bytes         int64
	Lines         int
	Xref          string
	RawOverview   map[string]any
}

type RangeCoordinator added in v0.9.0

type RangeCoordinator interface {
	BeginScrapeRange(ctx context.Context, request RangeRequest) (RangeDecision, error)
	CompleteScrapeRange(ctx context.Context, decision RangeDecision, result RangeResult) error
	FailScrapeRange(ctx context.Context, decision RangeDecision, cause error) error
}

type RangeDecision added in v0.9.0

type RangeDecision struct {
	PoolID            string
	ClaimID           string
	AssignmentID      string
	Group             string
	RangeStart        int64
	RangeEnd          int64
	WindowStart       *time.Time
	WindowEnd         *time.Time
	Skipped           bool
	AdvanceCheckpoint bool
	Reason            string
}

type RangeRequest added in v0.9.0

type RangeRequest struct {
	PoolID       string
	Mode         string
	AssignmentID string
	Group        string
	RangeStart   int64
	RangeEnd     int64
	WindowStart  *time.Time
	WindowEnd    *time.Time
}

type RangeResult added in v0.9.0

type RangeResult struct {
	Mode             string
	Group            string
	RangeStart       int64
	RangeEnd         int64
	ArticleHeaders   int
	ArticlesInserted int64
}

type Service

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

func NewService

func NewService(repo repository, p provider, log logger, opts Options) *Service

func (*Service) RunBackfillOnce

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

backfill mode walks backward from the most recent known boundary.

func (*Service) RunBackfillOnceWithMetrics added in v0.7.0

func (s *Service) RunBackfillOnceWithMetrics(ctx context.Context) (map[string]any, error)

func (*Service) RunDeferredOnceWithMetrics added in v0.9.0

func (s *Service) RunDeferredOnceWithMetrics(ctx context.Context) (map[string]any, error)

func (*Service) RunLatestOnce

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

latest mode prioritizes the head of the group and continues forward.

func (*Service) RunLatestOnceWithMetrics added in v0.7.0

func (s *Service) RunLatestOnceWithMetrics(ctx context.Context) (map[string]any, error)

func (*Service) RunOnce

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

backward-compatible alias. Default scrape mode is latest.

func (*Service) RunTimeframesOnceWithMetrics added in v0.9.0

func (s *Service) RunTimeframesOnceWithMetrics(ctx context.Context) (map[string]any, error)

type Timeframe added in v0.9.0

type Timeframe struct {
	ID    string
	Group string
	Start time.Time
	End   time.Time
}

Jump to

Keyboard shortcuts

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