scan

package
v2.3.0 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2026 License: Apache-2.0 Imports: 15 Imported by: ? 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 scan ports Scanner of contracts/solana/reporter/scan.ts. A pass lists the open transfers and one audit page, reviews them in concurrent chunks, each decided from one Akash height and one finalized Solana snapshot, writes the review events and hands the planned messages to a Queuer (spec §5.2). It also runs the broadcaster's follow-up reviews (spec §6.6).

Index

Constants

This section is empty.

Variables

View Source
var ErrPassAborted = errors.New("follow-up review skipped: the pass ended on a light-client pin mismatch")

ErrPassAborted is what Review and ReviewRefundHead return, without writing an alert or counting anything, once a pass has found a light-client pin mismatch: at once until the next pass begins, and before the next review or {id, error} event of a follow-up already running, which never resumes. The pass's own alert and error stay its last output (spec §5.6).

Functions

func WithQueuer

func WithQueuer(ctx context.Context, q Queuer) context.Context

WithQueuer returns a context under which the reviews of a broadcasting scanner hand their plans to q instead of the scanner's Queuer, so that the broadcaster can tell which review filled a batch (spec §6.2).

Types

type Options

type Options struct {
	Reporter string
	// Broadcast marks review events "broadcast" instead of "preview".
	Broadcast    bool
	Workers      int
	PageSize     int
	AuditPerScan int
	// Clock times the follow-up reviews' height retries; nil means the system clock.
	Clock clock.Clock
	// RetryInterval is how long a follow-up review waits before asking again for a high enough snapshot; zero means
	// one second, the tracker's refresh rate.
	RetryInterval time.Duration
	Metrics       *metrics.Metrics
}

Options configures a Scanner.

type Queuer

type Queuer interface {
	Queue(policy.Planned) bool
}

Queuer takes the messages a review planned. Queue reports whether the message was taken; false means it was skipped or deferred.

type Scanner

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

Scanner runs passes and follow-up reviews. Pass must not run concurrently with itself; Review and ReviewRefundHead may run alongside a pass.

func New

func New(a *akash.Client, o *observe.Observer, ev *events.Writer, opts Options, q Queuer) *Scanner

New returns a scanner. q is nil in preview.

func (*Scanner) OnChange

func (s *Scanner) OnChange(c observe.Change)

OnChange writes the light-client-changed alert. The observer calls it under its follow lock, before any review decided under the new client; it must not call back into the observer.

func (*Scanner) Pass

func (s *Scanner) Pass(ctx context.Context, settle func() int) int

Pass runs one pass and returns its failures. ctx bounds the reviews: once it ends, no new chunk or transfer review starts. Once the reviews end, settle, when set, runs once and its failures count; then the summary is written if the pass reached its reviews, or else the pass error.

func (*Scanner) Review

func (s *Scanner) Review(ctx context.Context, ids []sinkid.ID, minHeight int64) error

Review reviews ids in chunks of up to 96, each from a snapshot at least minHeight high, writing the normal review events and queuing what it plans. IDs that are no longer open are skipped. After a pass that ended on a pin mismatch, it returns ErrPassAborted.

func (*Scanner) ReviewRefundHead

func (s *Scanner) ReviewRefundHead(ctx context.Context, minHeight int64) error

ReviewRefundHead reviews the refund head of a snapshot at least minHeight high as a one-transfer chunk. A snapshot without a refund head reviews nothing. After a pass that ended on a pin mismatch, it returns ErrPassAborted.

Jump to

Keyboard shortcuts

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