"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
mountlib: make directory entries be returned in sorted order
Nick Craig-Wood6da6b2556b95
diff --git a/cmd/mountlib/dir.go b/cmd/mountlib/dir.goindex 9ff94e37c..903041232 100644--- a/cmd/mountlib/dir.go+++ b/cmd/mountlib/dir.go@@ -3,6 +3,7 @@ package mountlibimport ("os""path"+ "sort""strings""sync""time"@@ -288,8 +289,8 @@ func (d *Dir) Lookup(name string) (node Node, err error) {return node, nil}-// ReadDirAll reads the contents of the directory-func (d *Dir) ReadDirAll() (items []Node, err error) {+// ReadDirAll reads the contents of the directory sorted+func (d *Dir) ReadDirAll() (items Nodes, err error) {// fs.Debugf(d.path, "Dir.ReadDirAll")d.mu.Lock()defer d.mu.Unlock()@@ -301,6 +302,7 @@ func (d *Dir) ReadDirAll() (items []Node, err error) {for _, item := range d.items {items = append(items, item)}+ sort.Sort(items)// fs.Debugf(d.path, "Dir.ReadDirAll OK with %d entries", len(items))return items, nil}diff --git a/cmd/mountlib/fs.go b/cmd/mountlib/fs.goindex e5c1d6aed..6bf23ec51 100644--- a/cmd/mountlib/fs.go+++ b/cmd/mountlib/fs.go@@ -27,6 +27,14 @@ var (_ Node = (*Dir)(nil))+// Nodes is a slice of Node+type Nodes []Node++// Sort functions+func (ns Nodes) Len() int { return len(ns) }+func (ns Nodes) Swap(i, j int) { ns[i], ns[j] = ns[j], ns[i] }+func (ns Nodes) Less(i, j int) bool { return ns[i].DirEntry().Remote() < ns[j].DirEntry().Remote() }+// Noder represents something which can return a nodetype Noder interface {fmt.Stringer