From f37646bf1968ceade88419cd53d2ce97054067f7 Mon Sep 17 00:00:00 2001 From: Brian Tiger Chow Date: Wed, 14 Jan 2015 06:12:55 -0800 Subject: [PATCH] refactor(fsrepo) add interface to make it easier to understand how to extend the package --- repo/fsrepo/config_component.go | 1 + repo/fsrepo/fsrepo.go | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/repo/fsrepo/config_component.go b/repo/fsrepo/config_component.go index 57781cc4d..4ab77c8c4 100644 --- a/repo/fsrepo/config_component.go +++ b/repo/fsrepo/config_component.go @@ -7,6 +7,7 @@ import ( ) var _ component = &configComponent{} +var _ componentInitializationChecker = configComponentIsInitialized // configComponent abstracts the config component of the FSRepo. // NB: create with makeConfigComponent function. diff --git a/repo/fsrepo/fsrepo.go b/repo/fsrepo/fsrepo.go index caeef670b..c89820410 100644 --- a/repo/fsrepo/fsrepo.go +++ b/repo/fsrepo/fsrepo.go @@ -56,6 +56,7 @@ type component interface { Open() error io.Closer } +type componentInitializationChecker func(path string) bool // At returns a handle to an FSRepo at the provided |path|. func At(repoPath string) *FSRepo { @@ -256,7 +257,7 @@ func IsInitialized(path string) bool { // componentInitCheckers are functions that indicate whether the component // is isInitialized - var componentInitCheckers = []func(path string) bool{ + var componentInitCheckers = []componentInitializationChecker{ configComponentIsInitialized, // TODO add datastore component initialization checker }