etcd: Store the scheme as a constant

This commit is contained in:
James Shubin
2024-02-22 12:43:30 -05:00
parent f60c25aacf
commit ad900fc8f1
2 changed files with 5 additions and 2 deletions

View File

@@ -47,6 +47,9 @@ func init() {
}
const (
// Scheme is the unique name for this filesystem type.
Scheme = "etcdfs"
// EtcdTimeout is the timeout to wait before erroring.
EtcdTimeout = 5 * time.Second // FIXME: chosen arbitrarily
// 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.
func (obj *Fs) Name() string { return "etcdfs" }
func (obj *Fs) Name() string { return Scheme }
// URI returns a URI representing this particular filesystem.
func (obj *Fs) URI() string {

View File

@@ -191,7 +191,7 @@ func (obj *World) Fs(uri string) (engine.Fs, error) {
return obj.StandaloneFs, nil
}
if u.Scheme != "etcdfs" {
if u.Scheme != etcdfs.Scheme {
return nil, fmt.Errorf("unknown scheme: `%s`", u.Scheme)
}
if u.Path == "" {