refactor(fsrepo) add interface to make it easier to understand how to extend the package

This commit is contained in:
Brian Tiger Chow 2015-01-14 06:12:55 -08:00
parent c364b4c34c
commit f37646bf19
2 changed files with 3 additions and 1 deletions

View File

@ -7,6 +7,7 @@ import (
)
var _ component = &configComponent{}
var _ componentInitializationChecker = configComponentIsInitialized
// configComponent abstracts the config component of the FSRepo.
// NB: create with makeConfigComponent function.

View File

@ -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
}