ingest

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2026 License: Apache-2.0 Imports: 9 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 ingest drives a source: discovery, change detection by object version, detail reads of what moved, and saves through the source's store.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RunJob

func RunJob(ctx context.Context, j Job, now time.Time) (summary, skipped string, err error)

RunJob is one run of j: Prepare, Run, After.

Types

type Job

type Job struct {
	Every time.Duration
	// Prepare builds one run's registration; a non-empty skip, such as a
	// low budget, runs nothing and is the job's skipped text.
	Prepare func(ctx context.Context, now time.Time) (p Plan, skip string, err error)
}

Job is a source's ingestion job: the daemon runs it every Every with RunJob.

type Plan

type Plan struct {
	Registration
	// After runs once Run returns, with its report and error, and gives the
	// job's outcome; nil summarizes the report and returns Run's error.
	After func(ctx context.Context, rep Report, err error) (summary, skipped string, _ error)
}

Plan is one run of a Job.

type Registration

type Registration struct {
	Source port.Source
	Store  port.SourceStore
	Codec  unit.Codec
	// Units holds every registered codec, disabled plugins' included; a link's To is checked against it.
	Units *unit.Registry
	// Links stores the links the read facts name; nil drops them.
	Links port.LinkStore
}

Registration is one source with its store and its unit codec.

type Report

type Report struct {
	Provider          unit.ProviderID
	Discovered, Moved int
	Read              []unit.Unit // units of the read facts, distinct, sorted by Unit.Less
	Cursor            string      // the cursor saved by this pass
	// Links are the links saved by this pass; LinksDropped those whose To did not parse.
	Links, LinksDropped int
}

Report is what one pass did.

func Run

func Run(ctx context.Context, r Registration, now time.Time) (Report, error)

Run is one two-phase pass: Discover from the stored cursor, Stubs of Watched (minus discovered), compare each object's Version with Versions, Read what moved or is unknown, Save (light facts of every stub, read facts, cursor), See every object returned. It spends no budget itself: the source's client does. Passes of one provider never interleave.

func Touch

func Touch(ctx context.Context, r Registration, objects []string, now time.Time) (Report, error)

Touch is the push entry: a source that hears of changed objects calls it; it reads and saves those objects as Run would, keeping the stored cursor. Passes of one provider never interleave.

Directories

Path Synopsis
Package ingesttest is a fake "thread" provider for driving ingest: a conversation service, a budgeted client, its Source and its SourceStore.
Package ingesttest is a fake "thread" provider for driving ingest: a conversation service, a budgeted client, its Source and its SourceStore.

Jump to

Keyboard shortcuts

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