Add context propagation to rclone

- Change rclone/fs interfaces to accept context.Context
- Update interface implementations to use context.Context
- Change top level usage to propagate context to lover level functions

Context propagation is needed for stopping transfers and passing other
request-scoped values.
This commit is contained in:
Aleksandar Jankovic 2019-06-17 10:34:30 +02:00 committed by Nick Craig-Wood
parent a2c317b46e
commit f78cd1e043
156 changed files with 2570 additions and 2380 deletions

View file

@ -1,6 +1,7 @@
package vfs
import (
"context"
"io"
"os"
"testing"
@ -43,9 +44,9 @@ func TestDirHandleReaddir(t *testing.T) {
defer r.Finalise()
vfs := New(r.Fremote, nil)
file1 := r.WriteObject("dir/file1", "file1 contents", t1)
file2 := r.WriteObject("dir/file2", "file2- contents", t2)
file3 := r.WriteObject("dir/subdir/file3", "file3-- contents", t3)
file1 := r.WriteObject(context.Background(), "dir/file1", "file1 contents", t1)
file2 := r.WriteObject(context.Background(), "dir/file2", "file2- contents", t2)
file3 := r.WriteObject(context.Background(), "dir/subdir/file3", "file3-- contents", t3)
fstest.CheckItems(t, r.Fremote, file1, file2, file3)
node, err := vfs.Stat("dir")