refactor(fsrepo) add interface to make it easier to understand how to extend the package
Brian Tiger Chow committed
Jan 14, 2015 at 06:12 UTC
f37646bf1968ceade88419cd53d2ce97054067f7
2 files changed
+3
-1
repo/fsrepo/config_component.go
+1
@@ -7,6 +7,7 @@ import (
7
)
8
9
var _ component = &configComponent{}
10
+var _ componentInitializationChecker = configComponentIsInitialized
11
12
// configComponent abstracts the config component of the FSRepo.
13
// NB: create with makeConfigComponent function.
repo/fsrepo/fsrepo.go
+2
-1
@@ -56,6 +56,7 @@ type component interface {
56
Open() error
57
io.Closer
58
}
59
+type componentInitializationChecker func(path string) bool
60
61
// At returns a handle to an FSRepo at the provided |path|.
62
func At(repoPath string) *FSRepo {
@@ -256,7 +257,7 @@ func IsInitialized(path string) bool {
257
258
// componentInitCheckers are functions that indicate whether the component
259
// is isInitialized
259
- var componentInitCheckers = []func(path string) bool{
260
+ var componentInitCheckers = []componentInitializationChecker{
261
configComponentIsInitialized,
262
// TODO add datastore component initialization checker
263
}