status

package
v0.0.0-...-34cbb95 Latest Latest
Warning

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

Go to latest
Published: Dec 26, 2024 License: BSD-3-Clause Imports: 15 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AutoRollMiniStatus

type AutoRollMiniStatus struct {
	// Revision of the current roll, if any.
	CurrentRollRev string `json:"currentRollRev"`

	// Revision of the last successful roll.
	LastRollRev string `json:"lastRollRev"`

	// The current mode of the roller.
	// Note: This duplicates what is stored in the modes DB but is more
	// convenient for users like status.skia.org.
	Mode string `json:"mode"`

	// The number of failed rolls since the last successful roll.
	NumFailedRolls int `json:"numFailed"`

	// The number of commits which have not been rolled.
	NumNotRolledCommits int `json:"numBehind"`

	// Timestamp is the time at which the roller last reported its status.
	Timestamp time.Time `json:"timestamp"`

	// LastSuccessfulRollTimestamp is the time at which the last successful roll
	// was performed. If there have not been any recent successful rolls, the
	// timestamp will be an empty time.Time{}.
	LastSuccessfulRollTimestamp time.Time `json:"lastRollTimestamp"`
}

AutoRollMiniStatus is a struct which provides a minimal amount of status information about the AutoRoll Bot. TODO(borenet): Some of this duplicates things in AutoRollStatus. Revisit and either don't include AutoRollMiniStatus in AutoRollStatus or de-dupe the fields after revamping the UI.

type AutoRollStatus

type AutoRollStatus struct {
	AutoRollMiniStatus
	ChildHead          string                    `json:"childHead"`
	ChildName          string                    `json:"childName"`
	CurrentRoll        *autoroll.AutoRollIssue   `json:"currentRoll"`
	Error              string                    `json:"error"`
	FullHistoryUrl     string                    `json:"fullHistoryUrl"`
	IssueUrlBase       string                    `json:"issueUrlBase"`
	LastRoll           *autoroll.AutoRollIssue   `json:"lastRoll"`
	NotRolledRevisions []*revision.Revision      `json:"notRolledRevs"`
	ParentName         string                    `json:"parentName"`
	Recent             []*autoroll.AutoRollIssue `json:"recent"`
	Status             string                    `json:"status"`
	ThrottledUntil     int64                     `json:"throttledUntil"`
	ValidModes         []string                  `json:"validModes"`
	ValidStrategies    []string                  `json:"validStrategies"`
}

AutoRollStatus is a struct which provides roll-up status information about the AutoRoll Bot.

func (*AutoRollStatus) Copy

func (s *AutoRollStatus) Copy() *AutoRollStatus

type Cache

type Cache struct {
	DB
	// contains filtered or unexported fields
}

Cache stores the most recent AutoRollStatus.

func NewCache

func NewCache(ctx context.Context, db DB, rollerName string) (*Cache, error)

NewCache returns an Cache instance.

func (*Cache) Get

func (c *Cache) Get() *AutoRollStatus

Get returns the AutoRollStatus as of the last call to Update().

func (*Cache) GetMini

func (c *Cache) GetMini() *AutoRollMiniStatus

GetMini returns the AutoRollMiniStatus as of the last call to Update().

func (*Cache) Update

func (c *Cache) Update(ctx context.Context) error

Update updates the cached status information.

type DB

type DB interface {
	// Get the most recent AutoRollStatus for the given roller.
	Get(ctx context.Context, rollerName string) (*AutoRollStatus, error)
	// Set a new AutoRollStatus for the given roller.
	Set(ctx context.Context, rollerName string, st *AutoRollStatus) error
	// Close cleans up resources used by the DB.
	Close() error
}

DB tracks the status of the autoroller.

func NewDB

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

NewDB returns a MultiDB which uses Datastore as the primary DB and also writes to Firestore.

type DatastoreDB

type DatastoreDB struct{}

DatastoreDB is a DB which uses Datastore.

func NewDatastoreDB

func NewDatastoreDB() *DatastoreDB

NewDatastoreDB returns a DatastoreDB instance.

func (*DatastoreDB) Close

func (d *DatastoreDB) Close() error

Close implements DB.

func (*DatastoreDB) Get

func (d *DatastoreDB) Get(ctx context.Context, rollerName string) (*AutoRollStatus, error)

Get the AutoRollStatus for the given roller from the datastore.

func (*DatastoreDB) Set

func (d *DatastoreDB) Set(ctx context.Context, rollerName string, st *AutoRollStatus) error

Set the AutoRollStatus for the given roller in the datastore.

type DsStatusWrapper

type DsStatusWrapper struct {
	Data   []byte `datastore:"data,noindex"`
	Roller string `datastore:"roller"`
}

DsStatusWrapper is a helper struct used for storing an AutoRollStatus in the datastore.

type FirestoreDB

type FirestoreDB struct {
	// contains filtered or unexported fields
}

FirestoreDB implements DB using Firestore.

func NewFirestoreDB

func NewFirestoreDB(ctx context.Context, client *firestore.Client) (*FirestoreDB, error)

NewFirestoreDB returns a FirestoreDB instance using the given Client.

func NewFirestoreDBWithParams

func NewFirestoreDBWithParams(ctx context.Context, project, namespace, instance string, ts oauth2.TokenSource) (*FirestoreDB, error)

NewFirestoreDBWithParams returns a FirestoreDB instance using the given params.

func (*FirestoreDB) Close

func (d *FirestoreDB) Close() error

Close the DB.

func (*FirestoreDB) Get

func (d *FirestoreDB) Get(ctx context.Context, rollerID string) (*AutoRollStatus, error)

Get implements DB.

func (*FirestoreDB) Set

func (d *FirestoreDB) Set(ctx context.Context, rollerID string, st *AutoRollStatus) error

Set implements DB.

type MultiDB

type MultiDB []DB

MultiDB combines two more more DBs.

func NewMultiDB

func NewMultiDB(dbs []DB) (MultiDB, error)

NewMultiDB returns a MultiDB instance. The first DB instance is used for all retrievals.

func (MultiDB) Close

func (d MultiDB) Close() error

Close implements DB.

func (MultiDB) Get

func (d MultiDB) Get(ctx context.Context, rollerID string) (*AutoRollStatus, error)

Get implements DB.

func (MultiDB) Set

func (d MultiDB) Set(ctx context.Context, rollerID string, st *AutoRollStatus) error

Set implements DB.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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