storage

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Aug 9, 2018 License: GPL-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNotExist = errors.New("does not exist")

ErrNotExist indicates that a record does not exist

Functions

This section is empty.

Types

type Application

type Application struct {
	ID   int
	Name string
}

Application stores the name of the Application

func (*Application) NameLower

func (a *Application) NameLower() string

NameLower returns the app of the name in lowercase

type Build

type Build struct {
	ID               int
	Application      Application
	VCSState         VCSState
	StartTimeStamp   time.Time
	StopTimeStamp    time.Time
	TotalInputDigest string
	Outputs          []*Output
	Inputs           []*Input
}

Build represents a stored build

type Input

type Input struct {
	URL    string
	Digest string
}

Input represents a source of an artifact

type Issue

type Issue string

Issue describes an issue in the build database

const (
	// IssueOutputDigestMissing describes that a build didn't produces an
	// output that other builds with the same input digest produced
	IssueOutputDigestMissing Issue = "output with digest missing"
	// IssueUnmatchedDigest describes that a build produced an output with
	// a different digest then other builds with the same inputs
	IssueUnmatchedDigest Issue = "output with different digest"
)

type Output

type Output struct {
	Name      string
	Type      OutputType
	Digest    string
	SizeBytes int64
	Upload    Upload
}

Output represents a build output

type OutputType

type OutputType string

OutputType describes the type of an artifact

const (
	//DockerOutput is a docker container artifact
	DockerOutput OutputType = "docker"
	//S3Output is a file artifact stored on S3
	S3Output OutputType = "s3"
)

type Storer

type Storer interface {
	GetLatestBuildByDigest(appName, totalInputDigest string) (*Build, error)
	Save(b *Build) error
	GetBuildWithoutInputs(id int) (*Build, error)
	GetApps() ([]*Application, error)
	GetSameTotalInputDigestsForAppBuilds(appName string, startTs time.Time) ([]string, error)
	GetAppBuildsByInputDigest(appName, totalInputDigest string) ([]*Build, error)
}

Storer is an interface for persisting informations about builds

type Upload

type Upload struct {
	ID             int
	UploadDuration time.Duration
	URL            string
}

Upload contains informations about an output upload

type VCSState

type VCSState struct {
	CommitID string
	IsDirty  bool
}

VCSState contains informations about the VCS at the time of the build

type VerifyIssue

type VerifyIssue struct {
	Build          *Build
	Output         *Output
	ReferenceBuild *Build
	Issue          Issue
}

VerifyIssue describes a found issue during verification

func VerifySameInputDigestSameOutputs

func VerifySameInputDigestSameOutputs(clt Storer, appName string, startTs time.Time) ([]*VerifyIssue, error)

VerifySameInputDigestSameOutputs if the application has multiple builds with the same total input digest, it finds the most common outputs by digest from those builds and checks if the other builds have the outputs with the same digest. For builds that don't match an Issue description is returned

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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