mirror of
https://github.com/rclone/rclone.git
synced 2025-12-11 22:14:05 +01:00
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:
committed by
Nick Craig-Wood
parent
a2c317b46e
commit
f78cd1e043
@@ -1,6 +1,7 @@
|
||||
package tree
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"io"
|
||||
"os"
|
||||
@@ -117,7 +118,7 @@ short options as they conflict with rclone's short options.
|
||||
|
||||
// Tree lists fsrc to outFile using the Options passed in
|
||||
func Tree(fsrc fs.Fs, outFile io.Writer, opts *tree.Options) error {
|
||||
dirs, err := walk.NewDirTree(fsrc, "", false, opts.DeepLevel)
|
||||
dirs, err := walk.NewDirTree(context.Background(), fsrc, "", false, opts.DeepLevel)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -165,7 +166,7 @@ func (to *FileInfo) Mode() os.FileMode {
|
||||
|
||||
// ModTime is modification time
|
||||
func (to *FileInfo) ModTime() time.Time {
|
||||
return to.entry.ModTime()
|
||||
return to.entry.ModTime(context.Background())
|
||||
}
|
||||
|
||||
// IsDir is abbreviation for Mode().IsDir()
|
||||
|
||||
Reference in New Issue
Block a user