"rsync for cloud storage" - Google Drive, S3, Dropbox, Backblaze B2, One Drive, Swift, Hubic, Wasabi, Google Cloud Storage, Azure Blob, Azure Files, Yandex Files
Go azure-blobazure-blob-storageazure-filesbackblaze-b2cloud-storagedropboxencryptionftpfuse-filesystemgogolanggoogle-cloud-storagegoogle-driveonedriveopenstack-swiftrclones3sftpsyncwebdav
Add Name() to Fs interface to return name as passed to NewFs
Nick Craig-Woodfedf81c2b748
diff --git a/drive/drive.go b/drive/drive.goindex ebce8fbc6..680e03be3 100644--- a/drive/drive.go+++ b/drive/drive.go@@ -74,6 +74,7 @@ func init() {// FsDrive represents a remote drive servertype FsDrive struct {+ name string // name of this remotesvc *drive.Service // the connection to the drive serverroot string // the path we are working onclient *http.Client // authorized client@@ -146,6 +147,11 @@ func (m *dirCache) Flush() {// ------------------------------------------------------------+// The name of the remote (as passed into NewFs)+func (f *FsDrive) Name() string {+ return f.name+}+// String converts this FsDrive to a stringfunc (f *FsDrive) String() string {return fmt.Sprintf("Google drive root '%s'", f.root)@@ -332,6 +338,7 @@ func NewFs(name, path string) (fs.Fs, error) {}f := &FsDrive{+ name: name,root: root,dirCache: newDirCache(),pacer: make(chan struct{}, 1),diff --git a/dropbox/dropbox.go b/dropbox/dropbox.goindex 077dd6f29..69268962c 100644--- a/dropbox/dropbox.go+++ b/dropbox/dropbox.go@@ -104,6 +104,7 @@ func configHelper(name string) {// FsDropbox represents a remote dropbox servertype FsDropbox struct {+ name string // name of this remotedb *dropbox.Dropbox // the connection to the dropbox serverroot string // the path we are working onslashRoot string // root with "/" prefix, lowercase@@ -121,6 +122,11 @@ type FsObjectDropbox struct {// ------------------------------------------------------------+// The name of the remote (as passed into NewFs)+func (f *FsDropbox) Name() string {+ return f.name+}+// String converts this FsDropbox to a stringfunc (f *FsDropbox) String() string {return fmt.Sprintf("Dropbox root '%s'", f.root)@@ -148,7 +154,8 @@ func newDropbox(name string) *dropbox.Dropbox {func NewFs(name, root string) (fs.Fs, error) {db := newDropbox(name)f := &FsDropbox{- db: db,+ name: name,+ db: db,}f.setRoot(root)diff --git a/fs/fs.go b/fs/fs.goindex 72aab51cf..d93b76b3b 100644--- a/fs/fs.go+++ b/fs/fs.go@@ -63,6 +63,9 @@ func Register(info *FsInfo) {// A Filesystem, describes the local filesystem and the remote object storetype Fs interface {+ // The name of the remote (as passed into NewFs)+ Name() string+// String returns a description of the FSString() stringdiff --git a/fs/limited.go b/fs/limited.goindex e38ef7e6d..f38c23e14 100644--- a/fs/limited.go+++ b/fs/limited.go@@ -21,6 +21,11 @@ func NewLimited(fs Fs, objects ...Object) Fs {return f}+// The name of the remote (as passed into NewFs)+func (f *Limited) Name() string {+ return f.fs.Name() // return name of underlying remote+}+// String returns a description of the FSfunc (f *Limited) String() string {return fmt.Sprintf("%s limited to %d objects", f.fs.String(), len(f.objects))diff --git a/googlecloudstorage/googlecloudstorage.go b/googlecloudstorage/googlecloudstorage.goindex a8ce8aef8..128011956 100644--- a/googlecloudstorage/googlecloudstorage.go+++ b/googlecloudstorage/googlecloudstorage.go@@ -112,6 +112,7 @@ func init() {// FsStorage represents a remote storage servertype FsStorage struct {+ name string // name of this remotesvc *storage.Service // the connection to the storage serverclient *http.Client // authorized clientbucket string // the bucket we are working on@@ -135,6 +136,11 @@ type FsObjectStorage struct {// ------------------------------------------------------------+// The name of the remote (as passed into NewFs)+func (f *FsStorage) Name() string {+ return f.name+}+// String converts this FsStorage to a stringfunc (f *FsStorage) String() string {if f.root == "" {@@ -171,6 +177,7 @@ func NewFs(name, root string) (fs.Fs, error) {}f := &FsStorage{+ name: name,bucket: bucket,root: directory,projectNumber: fs.ConfigFile.MustValue(name, "project_number"),diff --git a/local/local.go b/local/local.goindex 50cd7e08f..40992382d 100644--- a/local/local.go+++ b/local/local.go@@ -33,6 +33,7 @@ func init() {// FsLocal represents a local filesystem rooted at roottype FsLocal struct {+ name string // the name of the remoteroot string // The root directoryprecisionOk sync.Once // Whether we need to read the precisionprecision time.Duration // precision of local filesystem@@ -54,6 +55,7 @@ type FsObjectLocal struct {func NewFs(name, root string) (fs.Fs, error) {root = filepath.ToSlash(path.Clean(root))f := &FsLocal{+ name: name,root: root,warned: make(map[string]struct{}),}@@ -70,6 +72,11 @@ func NewFs(name, root string) (fs.Fs, error) {return f, nil}+// The name of the remote (as passed into NewFs)+func (f *FsLocal) Name() string {+ return f.name+}+// String converts this FsLocal to a stringfunc (f *FsLocal) String() string {return fmt.Sprintf("Local file system at %s", f.root)diff --git a/s3/s3.go b/s3/s3.goindex 1c8316e72..810b6d900 100644--- a/s3/s3.go+++ b/s3/s3.go@@ -128,6 +128,7 @@ const (// FsS3 represents a remote s3 servertype FsS3 struct {+ name string // the name of the remotec *s3.S3 // the connection to the s3 serverbucket string // the bucket we are working onperm string // permissions for new buckets / objects@@ -151,6 +152,11 @@ type FsObjectS3 struct {// ------------------------------------------------------------+// The name of the remote (as passed into NewFs)+func (f *FsS3) Name() string {+ return f.name+}+// String converts this FsS3 to a stringfunc (f *FsS3) String() string {if f.root == "" {@@ -235,6 +241,7 @@ func NewFs(name, root string) (fs.Fs, error) {return nil, err}f := &FsS3{+ name: name,c: c,bucket: bucket,// FIXME perm: s3.Private, // FIXME need user to specifydiff --git a/swift/swift.go b/swift/swift.goindex b9faeb0e3..db01bf9e0 100644--- a/swift/swift.go+++ b/swift/swift.go@@ -58,6 +58,7 @@ func init() {// FsSwift represents a remote swift servertype FsSwift struct {+ name string // name of this remotec swift.Connection // the connection to the swift servercontainer string // the container we are working onroot string // the path we are working on if any@@ -75,6 +76,11 @@ type FsObjectSwift struct {// ------------------------------------------------------------+// The name of the remote (as passed into NewFs)+func (f *FsSwift) Name() string {+ return f.name+}+// String converts this FsSwift to a stringfunc (f *FsSwift) String() string {if f.root == "" {@@ -141,6 +147,7 @@ func NewFs(name, root string) (fs.Fs, error) {return nil, err}f := &FsSwift{+ name: name,c: *c,container: container,root: directory,