storage

package
v0.9.1 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2018 License: GPL-2.0 Imports: 6 Imported by: 3

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 BuildWithDuration added in v0.9.0

type BuildWithDuration struct {
	Build
	Duration time.Duration
}

BuildWithDuration adds duration to a Build

type Field added in v0.9.0

type Field int

Field represents data fields that can be used in sort and filter operations

const (
	FieldUndefined Field = iota
	FieldApplicationName
	FieldBuildDuration
	FieldBuildStartTime
)

Defines the available data fields

func (Field) String added in v0.9.0

func (f Field) String() string

type Filter added in v0.9.0

type Filter struct {
	Field    Field
	Operator Op
	Value    interface{}
}

Filter specifies filter operatons for queries

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 Op added in v0.9.0

type Op int

Op describes the filter operator

const (
	// OpEQ represents an equal (=) operator
	OpEQ Op = iota
	// OpGT represents a greater than (>) operator
	OpGT
	// OpLT represents a smaller than (<) operator
	OpLT
)

func (Op) String added in v0.9.0

func (o Op) String() string

type Order added in v0.9.0

type Order int

Order specifies the sort order

const (
	// SortInvalid represents an invalid sort value
	SortInvalid Order = iota
	// OrderAsc sorts ascending
	OrderAsc
	// OrderDesc sorts descending
	OrderDesc
)

func OrderFromStr added in v0.9.0

func OrderFromStr(s string) (Order, error)

OrderFromStr converts a string to an Order

func (Order) String added in v0.9.0

func (s Order) String() string

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 Sorter added in v0.9.0

type Sorter struct {
	Field Field
	Order Order
}

Sorter specifies how the result of queries should be sorted

func (*Sorter) String added in v0.9.0

func (s *Sorter) String() string

String return the string representation

type Storer

type Storer interface {
	GetLatestBuildByDigest(appName, totalInputDigest string) (*Build, error)
	Save(b *Build) error
	GetApps() ([]*Application, error)
	GetSameTotalInputDigestsForAppBuilds(appName string, startTs time.Time) (map[string][]int, error)
	GetBuildWithoutInputs(id int) (*Build, error)
	GetBuildsWithoutInputs(buildIDs []int) ([]*Build, error)
	GetBuildOutputs(buildID int) ([]*Output, error)

	GetBuilds(filters []*Filter, sorters []*Sorter) ([]*BuildWithDuration, 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