Documentation
¶
Overview ¶
Package storage provides an interface for baur data storage implementations.
Index ¶
Constants ¶
View Source
const (
NoLimit uint = 0
)
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 ArtifactType ¶
type ArtifactType string
const ( ArtifactTypeDocker ArtifactType = "docker" ArtifactTypeFile ArtifactType = "file" )
type Field ¶
type Field int
Field represents data fields that can be used in sort and filter operations
type InputString ¶
type Inputs ¶
type Inputs struct {
Files []*InputFile
Strings []*InputString
}
type Op ¶
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 // OpIN represents a In operator, works like the SQL IN operator, the // corresponding Value field in The filter struct must be a slice OpIN )
type Order ¶
type Order int
Order specifies the sort order
func OrderFromStr ¶
OrderFromStr converts a string to an Order
type Output ¶
type Output struct {
Name string
Type ArtifactType
Digest string
SizeBytes uint64
Uploads []*Upload
}
type Storer ¶
type Storer interface {
Close() error
// Init initializes a storage, e.g. creating the database scheme
Init(context.Context) error
// IsCompatible verifies that the storage is compatible with the baur version
IsCompatible(context.Context) error
SaveTaskRun(context.Context, *TaskRunFull) (id int, err error)
LatestTaskRunByDigest(ctx context.Context, appName, taskName, totalInputDigest string) (*TaskRunWithID, error)
TaskRun(ctx context.Context, id int) (*TaskRunWithID, error)
// TaskRuns queries the storage for runs that match the filters.
// A limit value of 0 will return all results.
// The found results are passed in iterative manner to the callback
// function. When the callback function returns an error, the iteration
// stops.
// When no matching records exist, the method returns ErrNotExist.
TaskRuns(ctx context.Context,
filters []*Filter,
sorters []*Sorter,
limit uint,
callback func(*TaskRunWithID) error,
) error
// Inputs returns the inputs of a task run. If no records were found,
// the method returns ErrNotExist.
Inputs(ctx context.Context, taskRunID int) (*Inputs, error)
Outputs(ctx context.Context, taskRunID int) ([]*Output, error)
}
Storer is an interface for storing and retrieving baur task runs
type TaskRunFull ¶
type TaskRunWithID ¶
type UploadMethod ¶
type UploadMethod string
UploadMethod is the method that was used to upload the object
const ( UploadMethodS3 UploadMethod = "s3" UploadMethodDockerRegistry UploadMethod = "docker" UploadMethodFileCopy UploadMethod = "filecopy" )
Click to show internal directories.
Click to hide internal directories.