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

Issue 2993023002: tokenserver: Boilerplate for loading and serving service_accounts.cfg. (Closed)

Created:
3 years, 4 months ago by Vadim Sh.
Modified:
3 years, 4 months ago
Reviewers:
smut
CC:
chromium-reviews, infra-reviews+luci-go_chromium.org, maruel+w_chromium.org, tandrii+luci-go_chromium.org
Target Ref:
refs/heads/master
Project:
luci-go
Visibility:
Public.

Description

tokenserver: Boilerplate for loading and serving service_accounts.cfg. It closely resembles handling of delegation.cfg config file. In particular, it reuses most of the logic through policy.Policy class. R=smut@google.com BUG=731843 Review-Url: https://codereview.chromium.org/2993023002 Committed: https://github.com/luci/luci-go/commit/944bd62ef8c6c11817b6cb7fccd1a84f5f8af7e8

Patch Set 1 #

Patch Set 2 : fix comments #

Total comments: 4

Patch Set 3 : add test #

Total comments: 3

Messages

Total messages: 10 (4 generated)
Vadim Sh.
https://codereview.chromium.org/2993023002/diff/20001/tokenserver/appengine/impl/serviceaccounts/config.go File tokenserver/appengine/impl/serviceaccounts/config.go (right): https://codereview.chromium.org/2993023002/diff/20001/tokenserver/appengine/impl/serviceaccounts/config.go#newcode1 tokenserver/appengine/impl/serviceaccounts/config.go:1: // Copyright 2017 The LUCI Authors. this file resembles ...
3 years, 4 months ago (2017-08-04 02:25:13 UTC) #1
smut
lgtm https://codereview.chromium.org/2993023002/diff/40001/tokenserver/appengine/impl/serviceaccounts/config.go File tokenserver/appengine/impl/serviceaccounts/config.go (right): https://codereview.chromium.org/2993023002/diff/40001/tokenserver/appengine/impl/serviceaccounts/config.go#newcode101 tokenserver/appengine/impl/serviceaccounts/config.go:101: func prepareRules(cfg policy.ConfigBundle, revision string) (policy.Queryable, error) { ...
3 years, 4 months ago (2017-08-04 22:43:42 UTC) #2
Vadim Sh.
https://codereview.chromium.org/2993023002/diff/40001/tokenserver/appengine/impl/serviceaccounts/config.go File tokenserver/appengine/impl/serviceaccounts/config.go (right): https://codereview.chromium.org/2993023002/diff/40001/tokenserver/appengine/impl/serviceaccounts/config.go#newcode101 tokenserver/appengine/impl/serviceaccounts/config.go:101: func prepareRules(cfg policy.ConfigBundle, revision string) (policy.Queryable, error) { On ...
3 years, 4 months ago (2017-08-04 23:25:29 UTC) #4
commit-bot: I haz the power
CQ is trying da patch. Follow status at: https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2993023002/40001
3 years, 4 months ago (2017-08-04 23:25:55 UTC) #6
commit-bot: I haz the power
Committed patchset #3 (id:40001) as https://github.com/luci/luci-go/commit/944bd62ef8c6c11817b6cb7fccd1a84f5f8af7e8
3 years, 4 months ago (2017-08-04 23:31:12 UTC) #9
smut
3 years, 4 months ago (2017-08-04 23:40:24 UTC) #10
Message was sent while issue was closed.
https://codereview.chromium.org/2993023002/diff/40001/tokenserver/appengine/i...
File tokenserver/appengine/impl/serviceaccounts/config.go (right):

https://codereview.chromium.org/2993023002/diff/40001/tokenserver/appengine/i...
tokenserver/appengine/impl/serviceaccounts/config.go:101: func prepareRules(cfg
policy.ConfigBundle, revision string) (policy.Queryable, error) {
On 2017/08/04 23:25:29, Vadim Sh. wrote:
> On 2017/08/04 22:43:42, smut wrote:
> > Is a pointer to a Rules struct a type of policy.Queryable? I'm not sure I
see
> > how the declared return type matches what is being returned.
> 
> policy.Queryable is defined here:
>
https://github.com/luci/luci-go/blob/18ae6bdbc6652e10610d55e4528d4bb3c624f813...
> 
> Any thing that has 'ConfigRevision() string' method matches this interface.
> 
> *Rules does have 'ConfigRevision() string' method (it's defined on line 114),
> and thus it matches this interface.
> 
> Note that 'Rules{}' by itself (without '&') can't be cast to policy.Queryable,
> because the method is defined with the pointer as the receiver. Go doesn't
allow
> automatic type cast in this case: https://play.golang.org/p/MdP-wR1tNp (I
think
> because generally non-pointer values don't even guaranteed to have a stable
> address, though not sure).
> 
> It does allow the reverse though: methods with non-pointer receivers "apply"
to
> pointer entities: https://play.golang.org/p/yihRcb0YvZ (generally because Go
can
> always copy the value pointed by the pointer and pass it as the receiver).
> 
> Not the best explanation evar, I know...

Got it, thanks. I did't expect that interfaces would be implemented implicitly
like this.

Powered by Google App Engine
This is Rietveld 408576698