manual

package
v0.0.0-...-ace5988 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2024 License: BSD-3-Clause Imports: 13 Imported by: 1

Documentation

Index

Constants

View Source
const (
	// Collection name for ManualRollRequests.
	COLLECTION_REQUESTS = "ManualRollRequests"

	// App name used for Firestore.
	FS_APP = "autoroll"

	// Possible values for ManualRollResult.
	RESULT_UNKNOWN = ManualRollResult("")
	RESULT_FAILURE = ManualRollResult("FAILURE")
	RESULT_SUCCESS = ManualRollResult("SUCCESS")

	// Possible values for ManualRollStatus.
	STATUS_PENDING  = ManualRollStatus("PENDING")
	STATUS_STARTED  = ManualRollStatus("STARTED")
	STATUS_COMPLETE = ManualRollStatus("COMPLETED")

	// Firestore-related constants.
	KEY_ROLLER_NAME = "RollerName"
	KEY_STATUS      = "Status"
	KEY_TIMESTAMP   = "Timestamp"

	DEFAULT_ATTEMPTS = 3

	QUERY_TIMEOUT  = 60 * time.Second
	INSERT_TIMEOUT = 10 * time.Second
)

Variables

View Source
var (
	// All valid results.
	VALID_RESULTS = []ManualRollResult{
		RESULT_UNKNOWN,
		RESULT_FAILURE,
		RESULT_SUCCESS,
	}

	// All valid statuses.
	VALID_STATUSES = []ManualRollStatus{
		STATUS_PENDING,
		STATUS_STARTED,
		STATUS_COMPLETE,
	}

	ErrConcurrentUpdate = errors.New("Concurrent update.")
	ErrNotFound         = errors.New("Request with given ID does not exist.")
)

Functions

This section is empty.

Types

type DB

type DB interface {
	// Close cleans up resources associated with the DB.
	Close() error

	// Returns the ManualRollRequest with the specified rollId.
	Get(ctx context.Context, rollId string) (*ManualRollRequest, error)

	// Return recent ManualRollRequests for the given roller, up to the
	// given limit, in reverse chronological order.
	GetRecent(rollerName string, limit int) ([]*ManualRollRequest, error)

	// Return all incomplete ManualRollRequests for the given roller.
	GetIncomplete(rollerName string) ([]*ManualRollRequest, error)

	// Insert the given ManualRollRequest. The DB implementation is
	// responsible for calling req.Validate(). If the request has an ID,
	// the existing entry in the DB is updated. Otherwise, a new entry is
	// inserted. If the entry already exist, the version in the DB must have
	// the same DbModified timestamp, or ErrConcurrentUpdate is returned.
	Put(req *ManualRollRequest) error
}

DB provides methods for interacting with a database of ManualRollRequests.

func NewDB

func NewDB(ctx context.Context, client *firestore.Client) (DB, error)

NewDB returns a DB instance backed by the given firestore.Client.

func NewDBWithParams

func NewDBWithParams(ctx context.Context, project, instance string, ts oauth2.TokenSource) (DB, error)

NewDB returns a DB instance backed by Firestore, using the given params.

func NewInMemoryDB

func NewInMemoryDB() DB

NewInMemoryDB returns an in-memory DB instance.

type ManualRollRequest

type ManualRollRequest struct {
	Id            string           `json:"id"`
	DbModified    time.Time        `json:"-"`
	Requester     string           `json:"requester"`
	Result        ManualRollResult `json:"result,omitempty"`
	ResultDetails string           `json:"resultDetails,omitempty"`
	Revision      string           `json:"revision"`
	RollerName    string           `json:"rollerName"`
	Status        ManualRollStatus `json:"status"`
	Timestamp     time.Time        `json:"timestamp"`
	Url           string           `json:"url,omitempty"`

	DryRun bool `json:"dry_run"`
	// Do not email the requester and reviewers if this is true. Eg: for
	// canaries.
	NoEmail bool `json:"no_email"`
	// Do not call rm.GetRevision(Revision) if this is true. Use
	// Revision{Id: Revision} instead.
	NoResolveRevision bool `json:"no_resolve_revision"`
	// Constructs a canary-specific commit msg if this is true.
	Canary bool `json:"canary"`
	// The external change ID, if specified, is included as part of the manual
	// roll. The ID is defined by the repo_manager.
	// Eg: CL num for Chromium, PR num for Github, Topic name for Android.
	ExternalChangeId string `json:"external_change_id,omitempty"`
}

ManualRollRequest represents a request for a manual roll. Note: This struct is directly used from the canary.go task driver in the Skia repo to interact with firestore. Please update that task driver if this struct changes significantly.

func (*ManualRollRequest) Copy

Return a copy of the ManualRollRequest.

func (*ManualRollRequest) Validate

func (r *ManualRollRequest) Validate() error

Validate the ManualRollRequest.

type ManualRollResult

type ManualRollResult string

ManualRollResult represents the result of a manual roll.

func (ManualRollResult) Validate

func (r ManualRollResult) Validate() error

Validate the ManualRollResult.

type ManualRollStatus

type ManualRollStatus string

ManualRollStatus represents the status of a manual roll.

func (ManualRollStatus) Validate

func (r ManualRollStatus) Validate() error

Validate the ManualRollStatus.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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