| OLD | NEW |
| 1 // Copyright 2015 The LUCI Authors. All rights reserved. | 1 // Copyright 2015 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 filesystem implements a file system backend for the config client. | 5 // Package filesystem implements a file system backend for the config client. |
| 6 // | 6 // |
| 7 // May be useful during local development. | 7 // May be useful during local development. |
| 8 // | 8 // |
| 9 // Layout | 9 // Layout |
| 10 // | 10 // |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 178 scannedConfigs: newScannedConfigs(), | 178 scannedConfigs: newScannedConfigs(), |
| 179 contentRevisionsScanned: stringset.New(1), | 179 contentRevisionsScanned: stringset.New(1), |
| 180 } | 180 } |
| 181 | 181 |
| 182 if ret.islink { | 182 if ret.islink { |
| 183 inf, err := os.Stat(basePath) | 183 inf, err := os.Stat(basePath) |
| 184 if err != nil { | 184 if err != nil { |
| 185 return nil, err | 185 return nil, err |
| 186 } | 186 } |
| 187 if !inf.IsDir() { | 187 if !inf.IsDir() { |
| 188 » » » return nil, (errors.Reason("filesystem.New(%(basePath)q)
: does not link to a directory"). | 188 » » » return nil, errors.Reason("filesystem.New(%q): does not
link to a directory", basePath).Err() |
| 189 » » » » D("basePath", basePath).Err()) | |
| 190 } | 189 } |
| 191 if len(ret.basePath.explode()) < 1 { | 190 if len(ret.basePath.explode()) < 1 { |
| 192 » » » return nil, (errors.Reason("filesystem.New(%(basePath)q)
: not enough tokens in path"). | 191 » » » return nil, errors.Reason("filesystem.New(%q): not enoug
h tokens in path", basePath).Err() |
| 193 » » » » D("basePath", basePath).Err()) | |
| 194 } | 192 } |
| 195 } else if !inf.IsDir() { | 193 } else if !inf.IsDir() { |
| 196 » » return nil, (errors.Reason("filesystem.New(%(basePath)q): not a
directory"). | 194 » » return nil, errors.Reason("filesystem.New(%q): not a directory",
basePath).Err() |
| 197 » » » D("basePath", basePath).Err()) | |
| 198 } | 195 } |
| 199 return ret, nil | 196 return ret, nil |
| 200 } | 197 } |
| 201 | 198 |
| 202 func (fs *filesystemImpl) resolveBasePath() (realPath nativePath, revision strin
g, err error) { | 199 func (fs *filesystemImpl) resolveBasePath() (realPath nativePath, revision strin
g, err error) { |
| 203 if fs.islink { | 200 if fs.islink { |
| 204 realPath, err = fs.basePath.readlink() | 201 realPath, err = fs.basePath.readlink() |
| 205 if err != nil && err.(*os.PathError).Err != os.ErrInvalid { | 202 if err != nil && err.(*os.PathError).Err != os.ErrInvalid { |
| 206 return | 203 return |
| 207 } | 204 } |
| (...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 531 ret := stringset.New(0) | 528 ret := stringset.New(0) |
| 532 err := fs.iterContentRevPath(func(lk lookupKey, cfg *config.Config) { | 529 err := fs.iterContentRevPath(func(lk lookupKey, cfg *config.Config) { |
| 533 if lk.configSet.hasPrefix(pfx) { | 530 if lk.configSet.hasPrefix(pfx) { |
| 534 ret.Add(newConfigSet(lk.configSet.explode()[2:]...).s()) | 531 ret.Add(newConfigSet(lk.configSet.explode()[2:]...).s()) |
| 535 } | 532 } |
| 536 }) | 533 }) |
| 537 retSlc := ret.ToSlice() | 534 retSlc := ret.ToSlice() |
| 538 sort.Strings(retSlc) | 535 sort.Strings(retSlc) |
| 539 return retSlc, err | 536 return retSlc, err |
| 540 } | 537 } |
| OLD | NEW |