etcd: Store the scheme as a constant
This commit is contained in:
@@ -47,6 +47,9 @@ func init() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
// Scheme is the unique name for this filesystem type.
|
||||||
|
Scheme = "etcdfs"
|
||||||
|
|
||||||
// EtcdTimeout is the timeout to wait before erroring.
|
// EtcdTimeout is the timeout to wait before erroring.
|
||||||
EtcdTimeout = 5 * time.Second // FIXME: chosen arbitrarily
|
EtcdTimeout = 5 * time.Second // FIXME: chosen arbitrarily
|
||||||
// DefaultDataPrefix is the default path for data storage in etcd.
|
// DefaultDataPrefix is the default path for data storage in etcd.
|
||||||
@@ -331,7 +334,7 @@ func (obj *Fs) find(absPath string) (*File, error) { // TODO: function naming?
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Name returns the name of this filesystem.
|
// Name returns the name of this filesystem.
|
||||||
func (obj *Fs) Name() string { return "etcdfs" }
|
func (obj *Fs) Name() string { return Scheme }
|
||||||
|
|
||||||
// URI returns a URI representing this particular filesystem.
|
// URI returns a URI representing this particular filesystem.
|
||||||
func (obj *Fs) URI() string {
|
func (obj *Fs) URI() string {
|
||||||
|
|||||||
@@ -191,7 +191,7 @@ func (obj *World) Fs(uri string) (engine.Fs, error) {
|
|||||||
return obj.StandaloneFs, nil
|
return obj.StandaloneFs, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
if u.Scheme != "etcdfs" {
|
if u.Scheme != etcdfs.Scheme {
|
||||||
return nil, fmt.Errorf("unknown scheme: `%s`", u.Scheme)
|
return nil, fmt.Errorf("unknown scheme: `%s`", u.Scheme)
|
||||||
}
|
}
|
||||||
if u.Path == "" {
|
if u.Path == "" {
|
||||||
|
|||||||
Reference in New Issue
Block a user