Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
// QueueName identifies the queue this Scorer serves.
QueueName string
}
Config carries the per-queue identity handed to a Factory. The system knows only the queue name; everything an implementation needs is injected at construction by the integrator.
type Factory ¶
type Factory interface {
// For returns the Scorer for the given queue.
For(cfg Config) (Scorer, error)
}
Factory builds the Scorer for a queue. Implementations are provided by integrators (and tests) and inject whatever they need at construction.
type Scorer ¶
type Scorer interface {
// Score returns a probability between 0.0 and 1.0 that the given batch
// ultimately succeeds — reaches its terminal Succeeded state with its
// changes landed, rather than Failed or Cancelled. A passing build is
// necessary but not sufficient: a batch whose build already passed can
// still fail to merge, so this is the probability of the final outcome,
// not of the build alone. It is handed the batch identity and resolves the
// batch's changes itself through an injected changeset.Resolver.
//
// Callers may score every batch a queue is waiting on, so implementations
// should be cheap: a speculation run scores each batch at most once, but it
// does not carry results over to the next run, so anything expensive to
// compute belongs behind the implementation's own cache.
Score(ctx context.Context, batch entity.Batch) (float64, error)
}
Scorer computes the probability that a batch ultimately succeeds, based on its changes.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package fake provides a scorer.Scorer that decorates an existing scorer: it delegates to the wrapped implementation for the happy path, but injects an error when a change URI carries a failure marker of the form "sq-fake=<token>":
|
Package fake provides a scorer.Scorer that decorates an existing scorer: it delegates to the wrapped implementation for the happy path, but injects an error when a change URI carries a failure marker of the form "sq-fake=<token>": |
|
Package mock is a generated GoMock package.
|
Package mock is a generated GoMock package. |
Click to show internal directories.
Click to hide internal directories.