run

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Jun 24, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Overview

Package run wires the stages together: it streams a seed source through the fetch engine on a large worker pool, then funnels every result to a single pack consumer that writes the captures. Reading the network is the bottleneck, so one writer keeps the output files simple and still keeps up with thousands of concurrent fetches.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FetchBatch added in v0.2.0

func FetchBatch(ctx context.Context, cfg config.Config, urls []string, out chan<- fetch.Result) error

FetchBatch re-fetches a list of URLs using the same engine as Run. Results are written to out as they complete. FetchBatch blocks until all URLs have been attempted or ctx is cancelled, then returns ctx.Err() (nil if the list drained normally).

When cfg.Reorder is on (the default) the URL list is spread across hosts before it reaches the workers, so a host-clustered input (a raw Common Crawl shard arrives SURT-sorted, with long runs of same-host URLs) does not pin the pool against the per-host concurrency cap while most workers sit idle. This makes FetchBatch honor Reorder the way the full Run path does, so a caller no longer has to pre-spread the list itself.

Types

type Runner

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

Runner executes one crawl end to end.

func New

func New(cfg config.Config) *Runner

New returns a Runner for cfg.

func (*Runner) Run

func (r *Runner) Run(ctx context.Context, src seed.Source, onTick func(metrics.Snapshot)) error

Run crawls every seed from src and returns when the source is drained or ctx is cancelled. The OnTick callback, if set, is invoked about once a second with a fresh snapshot for progress display.

func (*Runner) Stats

func (r *Runner) Stats() *metrics.Stats

Stats exposes the live counters (for the display loop).

Jump to

Keyboard shortcuts

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