"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
fs/cache: add Entries() for finding how many entries in the fscache #4811
Nick Craig-Woodfeaaca498732
diff --git a/fs/cache/cache.go b/fs/cache/cache.goindex dcc94adff..961dd3c7d 100644--- a/fs/cache/cache.go+++ b/fs/cache/cache.go@@ -128,3 +128,8 @@ func Put(fsString string, f fs.Fs) {func Clear() {c.Clear()}++// Entries returns the number of entries in the cache+func Entries() int {+ return c.Entries()+}diff --git a/fs/cache/cache_test.go b/fs/cache/cache_test.goindex ca5128aa6..8f35ebd89 100644--- a/fs/cache/cache_test.go+++ b/fs/cache/cache_test.go@@ -180,3 +180,16 @@ func TestClear(t *testing.T) {assert.Equal(t, 0, c.Entries())}++func TestEntries(t *testing.T) {+ cleanup, create := mockNewFs(t)+ defer cleanup()++ assert.Equal(t, 0, Entries())++ // Create something+ _, err := GetFn(context.Background(), "mock:/", create)+ require.NoError(t, err)++ assert.Equal(t, 1, Entries())+}