links

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2026 License: Apache-2.0 Imports: 13 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 links resolves linked items from events on the units they link to.

Index

Constants

View Source
const (
	RetryAfter         = time.Hour
	RetryNotFoundAfter = 24 * time.Hour
	ReadEndedEvery     = 24 * time.Hour
)

RetryAfter is how long a target whose read failed waits before the next, RetryNotFoundAfter when its source has no such unit or will not show it. ReadEndedEvery is how often a target that ended, and still settles nothing, is read: only a reopening would change it.

Variables

View Source
var ErrNotReady = errors.New("the source cannot read yet")

ErrNotReady is a Refresher's answer while its source cannot read at all, such as a plugin still starting: Run fails with it, so its units run again soon, and the target waits for nothing.

Functions

This section is empty.

Types

type EventReader

type EventReader interface {
	UnitEvents(ctx context.Context, u unit.Unit, since time.Time) ([]link.Event, error)
}

type Refresher added in v0.4.0

type Refresher interface {
	// Refresh says whether it read u; a unit it holds fresh is not read.
	Refresh(ctx context.Context, u unit.Unit) (read bool, err error)
}

Refresher reads a unit from its source again when what the host holds of it may be stale.

type Resolver

type Resolver struct {
	Links  port.LinkStore
	Events map[unit.ProviderID]EventReader // from source.Module.UnitEvents of enabled plugins
	// Refresh reads a target an open item still waits on again, by provider; nil reads none.
	Refresh map[unit.ProviderID]Refresher
	Ledger  items.Applier
	Clock   port.Clock
	Log     func(string, ...any)
	// Codecs compare an actor's key with an assignee's; nil compares them byte for byte.
	Codecs unit.KeyComparer
	// contains filtered or unexported fields
}

func (*Resolver) Run

func (r *Resolver) Run(ctx context.Context, targets []unit.Unit) (resolved int, err error)

Run resolves the open items linked to a unit of targets once every review and merge link of each settles, reading a target such an item still waits on again through Refresh.

func (*Resolver) Settles added in v0.4.0

func (r *Resolver) Settles(ctx context.Context, ls []link.Link, it ditems.Item) (ditems.Op, bool, error)

Settles is the op that settles it, open, through its review and merge links ls from the events their targets already have, as Run would apply it; ok is false while one of them does not settle. The items ledger calls it once a batch stored its links, so an item linked to pull requests that already ended resolves in the same batch, before any task holds it.

Jump to

Keyboard shortcuts

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