firestore

package
v0.0.0-...-eaaab9e Latest Latest
Warning

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

Go to latest
Published: Jun 14, 2024 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Overview

Package firestore helps interact with the rebuild results stored in firestore.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DoQuery

func DoQuery[T any](ctx context.Context, q firestore.Query, fn func(*firestore.DocumentSnapshot) T, out chan<- T) <-chan error

DoQuery executes a query, transforming and sending each document to the output channel.

Types

type BenchmarkMode

type BenchmarkMode string
const (
	SmoketestMode BenchmarkMode = "smoketest"
	AttestMode    BenchmarkMode = "attest"
)

type Client

type Client struct {
	Client *firestore.Client
}

Client is a wrapper around the external firestore client.

func NewClient

func NewClient(ctx context.Context, project string) (*Client, error)

NewClient creates a new FirestoreClient.

func (*Client) FetchRebuilds

func (f *Client) FetchRebuilds(ctx context.Context, req *FetchRebuildRequest) (rebuilds map[string]Rebuild, err error)

FetchRebuilds fetches the Rebuild objects out of firestore.

func (*Client) FetchRuns

func (f *Client) FetchRuns(ctx context.Context, opts FetchRunsOpts) ([]Run, error)

FetchRuns fetches Runs out of firestore.

type FetchRebuildOpts

type FetchRebuildOpts struct {
	Clean  bool
	Filter string
}

type FetchRebuildRequest

type FetchRebuildRequest struct {
	Bench     *benchmark.PackageSet
	Executors []string
	Runs      []string
	Opts      FetchRebuildOpts
}

FetchRebuildRequest describes which Rebuild results you would like to fetch from firestore.

type FetchRunsOpts

type FetchRunsOpts struct {
	BenchmarkHash string
}

FetchRunsOpts describes which Runs you would like to fetch from firestore.

type Rebuild

type Rebuild struct {
	Ecosystem string
	Package   string
	Version   string
	Artifact  string
	Success   bool
	Message   string
	Strategy  string
	Executor  string
	Run       string
	Created   time.Time
	Timings   rebuild.Timings
}

Rebuild represents the result of a specific rebuild.

func NewRebuildFromFirestore

func NewRebuildFromFirestore(doc *firestore.DocumentSnapshot) Rebuild

NewRebuildFromFirestore creates a Rebuild instance from a "attempt" collection document.

func (*Rebuild) ID

func (r *Rebuild) ID() string

ID returns a stable, human-readable formatting of the ecosystem, package, and version.

func (Rebuild) Target

func (r Rebuild) Target() rebuild.Target

type Run

type Run struct {
	ID            string
	BenchmarkName string
	BenchmarkHash string
	Type          BenchmarkMode
	Created       time.Time
}

Run represents a group of one or more rebuild executions.

func NewRunFromFirestore

func NewRunFromFirestore(doc *firestore.DocumentSnapshot) Run

NewRunFromFirestore creates a Run instance from a "runs" collection document.

type VerdictGroup

type VerdictGroup struct {
	Msg      string
	Count    int
	Examples []Rebuild
}

VerdictGroup is a collection of Rebuild objects, grouped by the same Message.

func GroupRebuilds

func GroupRebuilds(rebuilds map[string]Rebuild) (byCount []*VerdictGroup)

GroupRebuilds will create VerdictGroup objects, grouping rebuilds by Message.

Jump to

Keyboard shortcuts

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