forked from TrueCloudLab/rclone
backend/cache: Remove Unused Functions
This removes the unused functions run.writeRemoteRandomBytes() run.writeObjectRandomBytes() run.listPath() Directory.parentRemote() and Persistent.dumpRoot().
This commit is contained in:
parent
4e1a511f88
commit
3dbcf0af2d
3 changed files with 0 additions and 72 deletions
38
backend/cache/cache_internal_test.go
vendored
38
backend/cache/cache_internal_test.go
vendored
|
@ -17,7 +17,6 @@ import (
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"runtime"
|
"runtime"
|
||||||
"runtime/debug"
|
"runtime/debug"
|
||||||
"strconv"
|
|
||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
@ -1139,23 +1138,6 @@ func (r *run) randomReader(t *testing.T, size int64) io.ReadCloser {
|
||||||
return f
|
return f
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *run) writeRemoteRandomBytes(t *testing.T, f fs.Fs, p string, size int64) string {
|
|
||||||
remote := path.Join(p, strconv.Itoa(rand.Int())+".bin")
|
|
||||||
// create some rand test data
|
|
||||||
testData := randStringBytes(int(size))
|
|
||||||
|
|
||||||
r.writeRemoteBytes(t, f, remote, testData)
|
|
||||||
return remote
|
|
||||||
}
|
|
||||||
|
|
||||||
func (r *run) writeObjectRandomBytes(t *testing.T, f fs.Fs, p string, size int64) fs.Object {
|
|
||||||
remote := path.Join(p, strconv.Itoa(rand.Int())+".bin")
|
|
||||||
// create some rand test data
|
|
||||||
testData := randStringBytes(int(size))
|
|
||||||
|
|
||||||
return r.writeObjectBytes(t, f, remote, testData)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (r *run) writeRemoteString(t *testing.T, f fs.Fs, remote, content string) {
|
func (r *run) writeRemoteString(t *testing.T, f fs.Fs, remote, content string) {
|
||||||
r.writeRemoteBytes(t, f, remote, []byte(content))
|
r.writeRemoteBytes(t, f, remote, []byte(content))
|
||||||
}
|
}
|
||||||
|
@ -1344,26 +1326,6 @@ func (r *run) list(t *testing.T, f fs.Fs, remote string) ([]interface{}, error)
|
||||||
return l, err
|
return l, err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *run) listPath(t *testing.T, f fs.Fs, remote string) []string {
|
|
||||||
var err error
|
|
||||||
var l []string
|
|
||||||
if r.useMount {
|
|
||||||
var list []os.FileInfo
|
|
||||||
list, err = ioutil.ReadDir(path.Join(r.mntDir, remote))
|
|
||||||
for _, ll := range list {
|
|
||||||
l = append(l, ll.Name())
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
var list fs.DirEntries
|
|
||||||
list, err = f.List(context.Background(), remote)
|
|
||||||
for _, ll := range list {
|
|
||||||
l = append(l, ll.Remote())
|
|
||||||
}
|
|
||||||
}
|
|
||||||
require.NoError(t, err)
|
|
||||||
return l
|
|
||||||
}
|
|
||||||
|
|
||||||
func (r *run) copyFile(t *testing.T, f fs.Fs, src, dst string) error {
|
func (r *run) copyFile(t *testing.T, f fs.Fs, src, dst string) error {
|
||||||
in, err := os.Open(src)
|
in, err := os.Open(src)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
9
backend/cache/directory.go
vendored
9
backend/cache/directory.go
vendored
|
@ -101,15 +101,6 @@ func (d *Directory) abs() string {
|
||||||
return cleanPath(path.Join(d.Dir, d.Name))
|
return cleanPath(path.Join(d.Dir, d.Name))
|
||||||
}
|
}
|
||||||
|
|
||||||
// parentRemote returns the absolute path parent remote
|
|
||||||
func (d *Directory) parentRemote() string {
|
|
||||||
absPath := d.abs()
|
|
||||||
if absPath == "" {
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
return cleanPath(path.Dir(absPath))
|
|
||||||
}
|
|
||||||
|
|
||||||
// ModTime returns the cached ModTime
|
// ModTime returns the cached ModTime
|
||||||
func (d *Directory) ModTime(ctx context.Context) time.Time {
|
func (d *Directory) ModTime(ctx context.Context) time.Time {
|
||||||
return time.Unix(0, d.CacheModTime)
|
return time.Unix(0, d.CacheModTime)
|
||||||
|
|
25
backend/cache/storage_persistent.go
vendored
25
backend/cache/storage_persistent.go
vendored
|
@ -767,31 +767,6 @@ func (b *Persistent) iterateBuckets(buk *bolt.Bucket, bucketFn func(name string)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (b *Persistent) dumpRoot() string {
|
|
||||||
var itBuckets func(buk *bolt.Bucket) map[string]interface{}
|
|
||||||
|
|
||||||
itBuckets = func(buk *bolt.Bucket) map[string]interface{} {
|
|
||||||
m := make(map[string]interface{})
|
|
||||||
c := buk.Cursor()
|
|
||||||
for k, v := c.First(); k != nil; k, v = c.Next() {
|
|
||||||
if v == nil {
|
|
||||||
buk2 := buk.Bucket(k)
|
|
||||||
m[string(k)] = itBuckets(buk2)
|
|
||||||
} else {
|
|
||||||
m[string(k)] = "-"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return m
|
|
||||||
}
|
|
||||||
var mm map[string]interface{}
|
|
||||||
_ = b.db.View(func(tx *bolt.Tx) error {
|
|
||||||
mm = itBuckets(tx.Bucket([]byte(RootBucket)))
|
|
||||||
return nil
|
|
||||||
})
|
|
||||||
raw, _ := json.MarshalIndent(mm, "", " ")
|
|
||||||
return string(raw)
|
|
||||||
}
|
|
||||||
|
|
||||||
// addPendingUpload adds a new file to the pending queue of uploads
|
// addPendingUpload adds a new file to the pending queue of uploads
|
||||||
func (b *Persistent) addPendingUpload(destPath string, started bool) error {
|
func (b *Persistent) addPendingUpload(destPath string, started bool) error {
|
||||||
return b.db.Update(func(tx *bolt.Tx) error {
|
return b.db.Update(func(tx *bolt.Tx) error {
|
||||||
|
|
Loading…
Add table
Reference in a new issue