manifest

package
v0.0.0-...-ce17a00 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2024 License: Apache-2.0 Imports: 8 Imported by: 29

Documentation

Overview

Package manifest records the git hashes of modules for versions.

Index

Constants

View Source
const Collection = "manifest"

Variables

View Source
var (
	// BSON fields for artifact file structs
	IdKey               = bsonutil.MustHaveTag(Manifest{}, "Id")
	ManifestRevisionKey = bsonutil.MustHaveTag(Manifest{}, "Revision")
	ProjectNameKey      = bsonutil.MustHaveTag(Manifest{}, "ProjectName")
	ModulesKey          = bsonutil.MustHaveTag(Manifest{}, "Modules")
	ManifestBranchKey   = bsonutil.MustHaveTag(Manifest{}, "Branch")
	IsBaseKey           = bsonutil.MustHaveTag(Manifest{}, "IsBase")
	ModuleBranchKey     = bsonutil.MustHaveTag(Module{}, "Branch")
	ModuleRevisionKey   = bsonutil.MustHaveTag(Module{}, "Revision")
	OwnerKey            = bsonutil.MustHaveTag(Module{}, "Owner")
	UrlKey              = bsonutil.MustHaveTag(Module{}, "URL")
)

Functions

func ByBaseProjectAndRevision

func ByBaseProjectAndRevision(project, revision string) db.Q

func ById

func ById(id string) db.Q

ById returns a query that contains an Id selector on the string, id.

Types

type Manifest

type Manifest struct {
	// Identifier for the version.
	Id string `json:"id" bson:"_id"`
	// The revision of the version.
	Revision string `json:"revision" bson:"revision"`
	// The project identifier for the version.
	ProjectName string `json:"project" bson:"project"`
	// The branch of the repository.
	Branch string `json:"branch" bson:"branch"`
	// Map from the GitHub repository name to the module's information.
	Modules map[string]*Module `json:"modules" bson:"modules"`
	// True if the version is a mainline build.
	IsBase          bool              `json:"is_base" bson:"is_base"`
	ModuleOverrides map[string]string `json:"module_overrides,omitempty" bson:"-"`
}

Manifest is a representation of the modules associated with a version. Id is the version id, Revision is the revision of the version on the project ProjectName is the Project Id, Branch is the branch of the repository. Modules is a map of the GitHub repository name to the Module's information associated with the specific version.

func FindFromVersion

func FindFromVersion(versionID, project, revision, requester string) (*Manifest, error)

func FindOne

func FindOne(query db.Q) (*Manifest, error)

FindOne gets one Manifest for the given query.

func (*Manifest) InsertWithContext

func (m *Manifest) InsertWithContext(ctx context.Context) error

InsertWithContext is the same as Insert, but it respects the given context by avoiding the global Anser DB session.

func (*Manifest) TryInsert

func (m *Manifest) TryInsert() (bool, error)

TryInsert writes the manifest to the database if possible. If the document already exists, it returns true and the error If it does not it will return false and the error

type Module

type Module struct {
	// The branch of the repository.
	Branch string `json:"branch" bson:"branch"`
	// The name of the repository.
	Repo string `json:"repo" bson:"repo"`
	// The revision of the head of the branch.
	Revision string `json:"revision" bson:"revision"`
	// The owner of the repository.
	Owner string `json:"owner" bson:"owner"`
	// The url to the GitHub API call to that specific commit.
	URL string `json:"url" bson:"url"`
}

A Module is a snapshot of the module associated with a version. Branch is the branch of the repository, Repo is the name of the repository, Revision is the revision of the head of the branch, Owner is the owner of the repository, URL is the url to the GitHub API call to that specific commit.

Jump to

Keyboard shortcuts

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