Documentation ¶
Overview ¶
Package util contains the common utility functions shared by RunManager.
Index ¶
Constants ¶
const StaleCLAgeThreshold = 10 * time.Second
StaleCLAgeThreshold is the window that CL entity in datastore should be considered latest if refreshed within the threshold.
Large values increase the chance of returning false result on stale Change info while low values increase load on Gerrit.
Variables ¶
This section is empty.
Functions ¶
func IsActionTakenOnGerritCL ¶
func IsActionTakenOnGerritCL(ctx context.Context, gf gerrit.Factory, rcl *run.RunCL, gerritQueryOpts []gerritpb.QueryOption, evalFn ActionTakeEvalFn) (time.Time, error)
IsActionTakenOnGerritCL checks whether an action specified by `evalFn` has been take on a Gerrit CL.
Checks against CV's own cache (CL entity in Datastore) first. If the action is not taken and cache is too old (before `now-StaleCLAgeThreshold“), then fetch the latest change info from Gerrit and check.
func MutateGerritCL ¶
func MutateGerritCL(ctx context.Context, gf gerrit.Factory, rcl *run.RunCL, req *gerritpb.SetReviewRequest, leaseDuration time.Duration, motivation string) error
MutateGerritCL calls SetReview on the given Gerrit CL.
Uses mirror iterator and leases the CL before making the Gerrit call.
Types ¶
type ActionTakeEvalFn ¶
ActionTakeEvalFn is the function signature to evaluate whether certain action has already been taken on the given Gerrit Change.
Returns the time when action is taken. Otherwise, returns zero time.