Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2773)

Unified Diff: scheduler/appengine/engine/engine.go

Issue 2993933002: scheduler ACLs: improve ACL-related error handling in UI and API. (Closed)
Patch Set: rebase Created 3 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « scheduler/appengine/apiservers/scheduler_test.go ('k') | scheduler/appengine/ui/invocation.go » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: scheduler/appengine/engine/engine.go
diff --git a/scheduler/appengine/engine/engine.go b/scheduler/appengine/engine/engine.go
index 68316c21ebb1b3b360821a0b06733cc218ccef9f..c85184b0a6bc1bbfbb00a5f3fb1c3110cdccd60b 100644
--- a/scheduler/appengine/engine/engine.go
+++ b/scheduler/appengine/engine/engine.go
@@ -78,15 +78,18 @@ type Engine interface {
// project in no particular order.
GetVisibleProjectJobs(c context.Context, projectID string) ([]*Job, error)
- // GetVisibleJob returns single scheduler job given its full ID or nil if no such
- // job or if not visible.
+ // GetVisibleJob returns single scheduler job given its full ID.
+ // ErrNoSuchJob error is returned if job doesn't exist OR isn't visible.
GetVisibleJob(c context.Context, jobID string) (*Job, error)
// ListVisibleInvocations returns invocations of a visible job, most recent first.
// Returns fetched invocations and cursor string if there's more.
+ // error is ErrNoSuchJob if job doesn't exist or isn't visible.
ListVisibleInvocations(c context.Context, jobID string, pageSize int, cursor string) ([]*Invocation, string, error)
// GetVisibleInvocation returns single invocation of some job given its ID.
+ // ErrNoSuchInvocation is returned if either job or invocation doesn't exist
+ // or job and hence invocation isn't visible.
GetVisibleInvocation(c context.Context, jobID string, invID int64) (*Invocation, error)
// GetVisibleInvocationsByNonce returns a list of Invocations with given nonce.
@@ -728,11 +731,8 @@ func (e *engineImpl) PublicAPI() Engine {
}
func (e *engineImpl) ListVisibleInvocations(c context.Context, jobID string, pageSize int, cursor string) ([]*Invocation, string, error) {
- if job, err := e.GetVisibleJob(c, jobID); err != nil {
+ if _, err := e.GetVisibleJob(c, jobID); err != nil {
return nil, "", err
- } else if job == nil {
- // Either no Job or no access, both imply returning no invocations.
- return nil, "", ErrNoSuchInvocation
}
if pageSize == 0 || pageSize > 500 {
« no previous file with comments | « scheduler/appengine/apiservers/scheduler_test.go ('k') | scheduler/appengine/ui/invocation.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698