store

package
v0.0.0-...-5782500 Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2024 License: BSD-3-Clause Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BinariesFromCommitOrPatchset

type BinariesFromCommitOrPatchset struct {
	CommitOrPatchset
	Binaries []Binary `json:"binaries" go2ts:"ignorenil"`
}

BinariesFromCommitOrPatchset groups all the binaries produced by a single commit or patchset.

type Binary

type Binary struct {
	Metadata                        common.BloatyOutputMetadata `json:"metadata"`
	BloatyOutputFileGCSPath         string                      `json:"-"`
	BloatySizeDiffOutputFileGCSPath string                      `json:"-"`

	// Timestamp should reflect the "timestamp" field in the JSON metadata.
	Timestamp time.Time `json:"-"`
}

Binary represents a single binary that has been analyzed with Bloaty.

type CommitOrPatchset

type CommitOrPatchset struct {
	Commit     string `json:"commit"`
	PatchIssue string `json:"patch_issue"`
	PatchSet   string `json:"patch_set"`
}

CommitOrPatchset is used to group Bloaty outputs by commit, i.e. those generated by a post-submit task, or by patchset, i.e. those generated by a tryjob.

func (CommitOrPatchset) IsPatchset

func (c CommitOrPatchset) IsPatchset() bool

type DownloadFn

type DownloadFn func(ctx context.Context, path string) ([]byte, error)

DownloadFn is the type of a function that downloads a file from GCS.

Its purpose is to abstract away any interactions with GCS to facilitate testing.

type Store

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

Store keeps track of the Bloaty output files found in GCS, and provides methods to access them.

func New

func New(downloadFn DownloadFn) Store

New builds a new Store.

func (*Store) GetBinary

func (s *Store) GetBinary(commitOrPatchset CommitOrPatchset, binaryName, compileTaskName string) (Binary, bool)

GetBinary returns a specific binary.

func (*Store) GetBloatyOutputFileContents

func (s *Store) GetBloatyOutputFileContents(ctx context.Context, binary Binary) ([]byte, error)

GetBloatyOutputFileContents downloads and returns the raw contents of a Bloaty output file.

func (*Store) GetBloatySizeDiffOutputFileContents

func (s *Store) GetBloatySizeDiffOutputFileContents(ctx context.Context, binary Binary) ([]byte, error)

GetBloatySizeDiffOutputFileContents downloads and returns the raw contents of a Bloaty size diff output file.

func (*Store) GetMostRecentBinaries

func (s *Store) GetMostRecentBinaries(limit int) []BinariesFromCommitOrPatchset

GetMostRecentBinaries gets the most recent binaries grouped by commit or patchset.

func (*Store) Index

func (s *Store) Index(ctx context.Context, bloatyOutputFileGCSPath string) error

Index indexes the given Bloaty output file (*.tsv). It downloads the corresponding JSON metadata file, which is kept in memory, but it does not download the Bloaty output file itself.

Jump to

Keyboard shortcuts

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