fallback

package
v0.4.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: 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 fallback fetches an existing latest Scorecard result from an upstream Scorecard API (e.g. api.scorecard.dev) over the same /projects GET contract this server exposes (design F8). It is best-effort and read-only: a missing or too-old result, or any transport error, is reported so the orchestrator can fall through to a live scan.

Index

Constants

This section is empty.

Variables

View Source
var ErrFallbackMiss = errors.New("fallback: no usable upstream result")

ErrFallbackMiss means the upstream has no usable result for the repository — either no result at all, or one older than the configured maximum age. The orchestrator treats it as "fall through", distinct from a fetch error.

Functions

This section is empty.

Types

type Client

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

Client fetches results from an upstream Scorecard API over the /projects contract.

func NewClient

func NewClient(baseURL string, timeout, maxAge time.Duration, opts ...Option) *Client

NewClient builds a Client for baseURL (e.g. "https://api.scorecard.dev"). timeout bounds a single fetch; maxAge bounds how old an upstream result may be.

func (*Client) Fetch

func (c *Client) Fetch(ctx context.Context, ref model.RepoRef) (*scan.Result, error)

Fetch retrieves the upstream latest result for ref. It returns ErrFallbackMiss when the upstream has no result (404) or the result is older than maxAge, and a wrapped error for any transport or protocol failure.

type Option

type Option func(*Client)

Option customizes a Client (used mainly by tests).

func WithClock

func WithClock(now func() time.Time) Option

WithClock overrides the time source used for the max-age check.

Jump to

Keyboard shortcuts

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