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

Side by Side Diff: tokenserver/appengine/impl/certconfig/rpc_list_cas.go

Issue 2779323002: token-server: Warmup some local caches in /_ah/warmup. (Closed)
Patch Set: also warmup delegation config Created 3 years, 8 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 unified diff | Download patch
OLDNEW
1 // Copyright 2016 The LUCI Authors. All rights reserved. 1 // Copyright 2016 The LUCI Authors. All rights reserved.
2 // Use of this source code is governed under the Apache License, Version 2.0 2 // Use of this source code is governed under the Apache License, Version 2.0
3 // that can be found in the LICENSE file. 3 // that can be found in the LICENSE file.
4 4
5 package certconfig 5 package certconfig
6 6
7 import ( 7 import (
8 "golang.org/x/net/context" 8 "golang.org/x/net/context"
9 "google.golang.org/grpc" 9 "google.golang.org/grpc"
10 "google.golang.org/grpc/codes" 10 "google.golang.org/grpc/codes"
11 11
12 "github.com/golang/protobuf/ptypes/empty" 12 "github.com/golang/protobuf/ptypes/empty"
13 ds "github.com/luci/gae/service/datastore"
14 13
15 "github.com/luci/luci-go/tokenserver/api/admin/v1" 14 "github.com/luci/luci-go/tokenserver/api/admin/v1"
16 ) 15 )
17 16
18 // ListCAsRPC implements CertificateAuthorities.ListCAs RPC method. 17 // ListCAsRPC implements CertificateAuthorities.ListCAs RPC method.
19 type ListCAsRPC struct { 18 type ListCAsRPC struct {
20 } 19 }
21 20
22 // ListCAs returns a list of Common Names of registered CAs. 21 // ListCAs returns a list of Common Names of registered CAs.
23 func (r *ListCAsRPC) ListCAs(c context.Context, _ *empty.Empty) (*admin.ListCAsR esponse, error) { 22 func (r *ListCAsRPC) ListCAs(c context.Context, _ *empty.Empty) (*admin.ListCAsR esponse, error) {
24 » keys := []*ds.Key{} 23 » names, err := ListCAs(c)
25 24 » if err != nil {
26 » q := ds.NewQuery("CA").Eq("Removed", false).KeysOnly(true)
27 » if err := ds.GetAll(c, q, &keys); err != nil {
28 return nil, grpc.Errorf(codes.Internal, "transient datastore err or - %s", err) 25 return nil, grpc.Errorf(codes.Internal, "transient datastore err or - %s", err)
29 } 26 }
30 27 » return &admin.ListCAsResponse{Cn: names}, nil
31 » resp := &admin.ListCAsResponse{
32 » » Cn: make([]string, len(keys)),
33 » }
34 » for i, key := range keys {
35 » » resp.Cn[i] = key.StringID()
36 » }
37 » return resp, nil
38 } 28 }
OLDNEW
« no previous file with comments | « tokenserver/appengine/impl/certconfig/ca_test.go ('k') | tokenserver/appengine/impl/certconfig/warmup.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698