Documentation
¶
Overview ¶
Package storage provides an interface for baur data storage implementations.
Index ¶
- Constants
- Variables
- type ArtifactType
- type Field
- type Filter
- type InputEnvVar
- type InputFile
- type InputString
- type InputTaskInfo
- type Inputs
- type Op
- type Order
- type Output
- type ReleaseTaskRunsResult
- type ReleasesDeleteResult
- type Result
- type Sorter
- type Storer
- type TaskRun
- type TaskRunFull
- type TaskRunWithID
- type TaskRunsDeleteResult
- type Upload
- type UploadMethod
Constants ¶
View Source
const (
NoLimit uint = 0
)
Variables ¶
View Source
var ErrExists = errors.New("already exists")
ErrExists indicates that the database or a record already exist.
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 InputEnvVar ¶
type InputString ¶
type InputTaskInfo ¶
type Inputs ¶
type Inputs struct { Files []*InputFile Strings []*InputString EnvironmentVariables []*InputEnvVar TaskInfo []*InputTaskInfo }
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 ReleaseTaskRunsResult ¶
type ReleasesDeleteResult ¶
type ReleasesDeleteResult struct {
DeletedReleases int64
}
type Storer ¶
type Storer interface { Close() error // SchemaVersion returns the version of the schema that the storage is // using. SchemaVersion(ctx context.Context) (int32, error) // MaxSchemaVersion returns the max. supported database schema version. // It is also the version to that [Upgrade] can migrate the current // schema. MaxSchemaVersion() int32 // IsCompatible verifies that the storage is compatible with the baur version IsCompatible(context.Context) error // Upgrade upgrades the schema to RequiredSchemaVersion(). // If the database does not exist ErrNotExist is returned. Upgrade(ctx context.Context) error // Init initializes a storage, e.g. creating the database scheme. // If it already exist, ErrExist is returned. Init(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 TaskRunsDelete(ctx context.Context, before time.Time, pretend bool) (*TaskRunsDeleteResult, 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) // CreateRelease creates a new release called releaseName, that // consists of the passed task runs. Metadata is arbitrary data stored // together with the release, it is optional and can be nil. CreateRelease(_ context.Context, releaseName string, createdAt time.Time, taskRunIDs []int, metadata io.Reader) error ReleaseExists(_ context.Context, name string) (bool, error) // ReleaseTaskRuns the task runs and their outputs for the release // named releaseName. // If a task has no outputs the [ReleaseTaskRunsResult.OutputID] // [ReleaseTaskRunsResult.OutputName], [ReleaseTaskRunsResult.URI], // [ReleaseTaskRunsResult.UploadMethod] fields are unset. // If the release does not exist, ErrNotExist is returned. ReleaseTaskRuns(ctx context.Context, releaseName string) ([]*ReleaseTaskRunsResult, error) // ReleaseMetadata returns the metadata of a release. // If the release does not exist ErrNotExist is returned. // If the release has no metadata the returned []byte is empty. ReleaseMetadata(ctx context.Context, releaseName string) ([]byte, error) ReleasesDelete(ctx context.Context, before time.Time, pretend bool) (*ReleasesDeleteResult, error) }
Storer is an interface for storing and retrieving baur task runs
type TaskRunFull ¶
type TaskRunWithID ¶
type TaskRunsDeleteResult ¶
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.