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

Side by Side Diff: common/config/impl/erroring/erroring.go

Issue 2575383002: Add server/cache support to gaeconfig. (Closed)
Patch Set: Un-collapse. Created 3 years, 11 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
« no previous file with comments | « common/config/filters/caching/doc.go ('k') | common/data/text/templateproto/loader.go » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2015 The LUCI Authors. All rights reserved.
2 // Use of this source code is governed under the Apache License, Version 2.0
3 // that can be found in the LICENSE file.
4
5 // Package erroring implements config.Interface that simply returns an error.
6 //
7 // May be handy as a placeholder in case some more useful implementation is not
8 // available.
9 package erroring
10
11 import (
12 "net/url"
13
14 "golang.org/x/net/context"
15
16 "github.com/luci/luci-go/common/config"
17 )
18
19 // New produces config.Interface instance that returns the given error for all
20 // calls.
21 //
22 // Panics if given err is nil.
23 func New(err error) config.Interface {
24 if err == nil {
25 panic("the error must not be nil")
26 }
27 return erroringImpl{err}
28 }
29
30 type erroringImpl struct {
31 err error
32 }
33
34 func (e erroringImpl) ServiceURL(ctx context.Context) url.URL {
35 return url.URL{
36 Scheme: "error",
37 }
38 }
39
40 func (e erroringImpl) GetConfig(ctx context.Context, configSet, path string, has hOnly bool) (*config.Config, error) {
41 return nil, e.err
42 }
43
44 func (e erroringImpl) GetConfigByHash(ctx context.Context, contentHash string) ( string, error) {
45 return "", e.err
46 }
47
48 func (e erroringImpl) GetConfigSetLocation(ctx context.Context, configSet string ) (*url.URL, error) {
49 return nil, e.err
50 }
51
52 func (e erroringImpl) GetProjectConfigs(ctx context.Context, path string, hashes Only bool) ([]config.Config, error) {
53 return nil, e.err
54 }
55
56 func (e erroringImpl) GetProjects(ctx context.Context) ([]config.Project, error) {
57 return nil, e.err
58 }
59
60 func (e erroringImpl) GetRefConfigs(ctx context.Context, path string, hashesOnly bool) ([]config.Config, error) {
61 return nil, e.err
62 }
63
64 func (e erroringImpl) GetRefs(ctx context.Context, projectID string) ([]string, error) {
65 return nil, e.err
66 }
OLDNEW
« no previous file with comments | « common/config/filters/caching/doc.go ('k') | common/data/text/templateproto/loader.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698