mirror of
https://github.com/rclone/rclone.git
synced 2024-11-22 08:23:47 +01:00
all: make private functions / variables / constant which shouldn't be public
This commit is contained in:
parent
442578ca25
commit
c389616657
@ -38,8 +38,8 @@ const (
|
|||||||
rcloneClientId = "202264815644.apps.googleusercontent.com"
|
rcloneClientId = "202264815644.apps.googleusercontent.com"
|
||||||
rcloneClientSecret = "X4Z3ca8xfWDb1Voo-F9a7ZxJ"
|
rcloneClientSecret = "X4Z3ca8xfWDb1Voo-F9a7ZxJ"
|
||||||
driveFolderType = "application/vnd.google-apps.folder"
|
driveFolderType = "application/vnd.google-apps.folder"
|
||||||
RFC3339In = time.RFC3339
|
timeFormatIn = time.RFC3339
|
||||||
RFC3339Out = "2006-01-02T15:04:05.000000000Z07:00"
|
timeFormatOut = "2006-01-02T15:04:05.000000000Z07:00"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Globals
|
// Globals
|
||||||
@ -249,7 +249,7 @@ func NewFs(name, path string) (fs.Fs, error) {
|
|||||||
// No root so return old f
|
// No root so return old f
|
||||||
return f, nil
|
return f, nil
|
||||||
}
|
}
|
||||||
obj, err := newF.newFsObjectWithInfo(remote, nil)
|
obj, err := newF.newFsObjectWithInfoErr(remote, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
// File doesn't exist so return old f
|
// File doesn't exist so return old f
|
||||||
return f, nil
|
return f, nil
|
||||||
@ -262,7 +262,7 @@ func NewFs(name, path string) (fs.Fs, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Return an FsObject from a path
|
// Return an FsObject from a path
|
||||||
func (f *FsDrive) newFsObjectWithInfo(remote string, info *drive.File) (fs.Object, error) {
|
func (f *FsDrive) newFsObjectWithInfoErr(remote string, info *drive.File) (fs.Object, error) {
|
||||||
fs := &FsObjectDrive{
|
fs := &FsObjectDrive{
|
||||||
drive: f,
|
drive: f,
|
||||||
remote: remote,
|
remote: remote,
|
||||||
@ -282,8 +282,8 @@ func (f *FsDrive) newFsObjectWithInfo(remote string, info *drive.File) (fs.Objec
|
|||||||
// Return an FsObject from a path
|
// Return an FsObject from a path
|
||||||
//
|
//
|
||||||
// May return nil if an error occurred
|
// May return nil if an error occurred
|
||||||
func (f *FsDrive) NewFsObjectWithInfo(remote string, info *drive.File) fs.Object {
|
func (f *FsDrive) newFsObjectWithInfo(remote string, info *drive.File) fs.Object {
|
||||||
fs, _ := f.newFsObjectWithInfo(remote, info)
|
fs, _ := f.newFsObjectWithInfoErr(remote, info)
|
||||||
// Errors have already been logged
|
// Errors have already been logged
|
||||||
return fs
|
return fs
|
||||||
}
|
}
|
||||||
@ -292,7 +292,7 @@ func (f *FsDrive) NewFsObjectWithInfo(remote string, info *drive.File) fs.Object
|
|||||||
//
|
//
|
||||||
// May return nil if an error occurred
|
// May return nil if an error occurred
|
||||||
func (f *FsDrive) NewFsObject(remote string) fs.Object {
|
func (f *FsDrive) NewFsObject(remote string) fs.Object {
|
||||||
return f.NewFsObjectWithInfo(remote, nil)
|
return f.newFsObjectWithInfo(remote, nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Path should be directory path either "" or "path/"
|
// Path should be directory path either "" or "path/"
|
||||||
@ -316,7 +316,7 @@ func (f *FsDrive) listDirRecursive(dirId string, path string, out fs.ObjectsChan
|
|||||||
} else {
|
} else {
|
||||||
// If item has no MD5 sum it isn't stored on drive, so ignore it
|
// If item has no MD5 sum it isn't stored on drive, so ignore it
|
||||||
if item.Md5Checksum != "" {
|
if item.Md5Checksum != "" {
|
||||||
if fs := f.NewFsObjectWithInfo(path+item.Title, item); fs != nil {
|
if fs := f.newFsObjectWithInfo(path+item.Title, item); fs != nil {
|
||||||
out <- fs
|
out <- fs
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -366,7 +366,7 @@ func (f *FsDrive) listDirFull(dirId string, path string, out fs.ObjectsChan) err
|
|||||||
// fmt.Printf("file %s %s %s\n", path, item.Title, item.Id)
|
// fmt.Printf("file %s %s %s\n", path, item.Title, item.Id)
|
||||||
// If item has no MD5 sum it isn't stored on drive, so ignore it
|
// If item has no MD5 sum it isn't stored on drive, so ignore it
|
||||||
if item.Md5Checksum != "" {
|
if item.Md5Checksum != "" {
|
||||||
if fs := f.NewFsObjectWithInfo(path, item); fs != nil {
|
if fs := f.newFsObjectWithInfo(path, item); fs != nil {
|
||||||
out <- fs
|
out <- fs
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -589,7 +589,7 @@ func (f *FsDrive) ListDir() fs.DirChan {
|
|||||||
Bytes: -1,
|
Bytes: -1,
|
||||||
Count: -1,
|
Count: -1,
|
||||||
}
|
}
|
||||||
dir.When, _ = time.Parse(RFC3339In, item.ModifiedDate)
|
dir.When, _ = time.Parse(timeFormatIn, item.ModifiedDate)
|
||||||
out <- dir
|
out <- dir
|
||||||
return false
|
return false
|
||||||
})
|
})
|
||||||
@ -650,7 +650,7 @@ func (f *FsDrive) Put(in io.Reader, remote string, modTime time.Time, size int64
|
|||||||
if mimeType == "" {
|
if mimeType == "" {
|
||||||
mimeType = "application/octet-stream"
|
mimeType = "application/octet-stream"
|
||||||
}
|
}
|
||||||
modifiedDate := modTime.Format(RFC3339Out)
|
modifiedDate := modTime.Format(timeFormatOut)
|
||||||
|
|
||||||
// Define the metadata for the file we are going to create.
|
// Define the metadata for the file we are going to create.
|
||||||
info := &drive.File{
|
info := &drive.File{
|
||||||
@ -808,7 +808,7 @@ func (o *FsObjectDrive) ModTime() time.Time {
|
|||||||
fs.Log(o, "Failed to read metadata: %s", err)
|
fs.Log(o, "Failed to read metadata: %s", err)
|
||||||
return time.Now()
|
return time.Now()
|
||||||
}
|
}
|
||||||
modTime, err := time.Parse(RFC3339In, o.modifiedDate)
|
modTime, err := time.Parse(timeFormatIn, o.modifiedDate)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fs.Log(o, "Failed to read mtime from object: %s", err)
|
fs.Log(o, "Failed to read mtime from object: %s", err)
|
||||||
return time.Now()
|
return time.Now()
|
||||||
@ -826,7 +826,7 @@ func (o *FsObjectDrive) SetModTime(modTime time.Time) {
|
|||||||
}
|
}
|
||||||
// New metadata
|
// New metadata
|
||||||
info := &drive.File{
|
info := &drive.File{
|
||||||
ModifiedDate: modTime.Format(RFC3339Out),
|
ModifiedDate: modTime.Format(timeFormatOut),
|
||||||
}
|
}
|
||||||
// Set modified date
|
// Set modified date
|
||||||
_, err = o.drive.svc.Files.Update(o.id, info).SetModifiedDate(true).Do()
|
_, err = o.drive.svc.Files.Update(o.id, info).SetModifiedDate(true).Do()
|
||||||
@ -867,7 +867,7 @@ func (o *FsObjectDrive) Open() (in io.ReadCloser, err error) {
|
|||||||
func (o *FsObjectDrive) Update(in io.Reader, modTime time.Time, size int64) error {
|
func (o *FsObjectDrive) Update(in io.Reader, modTime time.Time, size int64) error {
|
||||||
info := &drive.File{
|
info := &drive.File{
|
||||||
Id: o.id,
|
Id: o.id,
|
||||||
ModifiedDate: modTime.Format(RFC3339Out),
|
ModifiedDate: modTime.Format(timeFormatOut),
|
||||||
}
|
}
|
||||||
|
|
||||||
// Make the API request to upload metadata and file data.
|
// Make the API request to upload metadata and file data.
|
||||||
|
@ -45,8 +45,8 @@ const (
|
|||||||
md5sumField = "md5sum"
|
md5sumField = "md5sum"
|
||||||
mtimeField = "mtime"
|
mtimeField = "mtime"
|
||||||
maxCommitRetries = 5
|
maxCommitRetries = 5
|
||||||
RFC3339In = time.RFC3339
|
timeFormatIn = time.RFC3339
|
||||||
RFC3339Out = "2006-01-02T15:04:05.000000000Z07:00"
|
timeFormatOut = "2006-01-02T15:04:05.000000000Z07:00"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Register with Fs
|
// Register with Fs
|
||||||
@ -54,7 +54,7 @@ func init() {
|
|||||||
fs.Register(&fs.FsInfo{
|
fs.Register(&fs.FsInfo{
|
||||||
Name: "dropbox",
|
Name: "dropbox",
|
||||||
NewFs: NewFs,
|
NewFs: NewFs,
|
||||||
Config: Config,
|
Config: configHelper,
|
||||||
Options: []fs.Option{{
|
Options: []fs.Option{{
|
||||||
Name: "app_key",
|
Name: "app_key",
|
||||||
Help: "Dropbox App Key - leave blank to use rclone's.",
|
Help: "Dropbox App Key - leave blank to use rclone's.",
|
||||||
@ -66,7 +66,7 @@ func init() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Configuration helper - called after the user has put in the defaults
|
// Configuration helper - called after the user has put in the defaults
|
||||||
func Config(name string) {
|
func configHelper(name string) {
|
||||||
// See if already have a token
|
// See if already have a token
|
||||||
token := fs.ConfigFile.MustValue(name, "token")
|
token := fs.ConfigFile.MustValue(name, "token")
|
||||||
if token != "" {
|
if token != "" {
|
||||||
@ -214,7 +214,9 @@ func (f *FsDropbox) openDataStore() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Return an FsObject from a path
|
// Return an FsObject from a path
|
||||||
func (f *FsDropbox) newFsObjectWithInfo(remote string, info *dropbox.Entry) (fs.Object, error) {
|
//
|
||||||
|
// May return nil if an error occurred
|
||||||
|
func (f *FsDropbox) newFsObjectWithInfo(remote string, info *dropbox.Entry) fs.Object {
|
||||||
o := &FsObjectDropbox{
|
o := &FsObjectDropbox{
|
||||||
dropbox: f,
|
dropbox: f,
|
||||||
remote: remote,
|
remote: remote,
|
||||||
@ -225,26 +227,17 @@ func (f *FsDropbox) newFsObjectWithInfo(remote string, info *dropbox.Entry) (fs.
|
|||||||
err := o.readEntryAndSetMetadata()
|
err := o.readEntryAndSetMetadata()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
// logged already fs.Debug("Failed to read info: %s", err)
|
// logged already fs.Debug("Failed to read info: %s", err)
|
||||||
return nil, err
|
return nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return o, nil
|
return o
|
||||||
}
|
|
||||||
|
|
||||||
// Return an FsObject from a path
|
|
||||||
//
|
|
||||||
// May return nil if an error occurred
|
|
||||||
func (f *FsDropbox) NewFsObjectWithInfo(remote string, info *dropbox.Entry) fs.Object {
|
|
||||||
fs, _ := f.newFsObjectWithInfo(remote, info)
|
|
||||||
// Errors have already been logged
|
|
||||||
return fs
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Return an FsObject from a path
|
// Return an FsObject from a path
|
||||||
//
|
//
|
||||||
// May return nil if an error occurred
|
// May return nil if an error occurred
|
||||||
func (f *FsDropbox) NewFsObject(remote string) fs.Object {
|
func (f *FsDropbox) NewFsObject(remote string) fs.Object {
|
||||||
return f.NewFsObjectWithInfo(remote, nil)
|
return f.newFsObjectWithInfo(remote, nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Strips the root off entry and returns it
|
// Strips the root off entry and returns it
|
||||||
@ -290,7 +283,7 @@ func (f *FsDropbox) list(out fs.ObjectsChan) {
|
|||||||
// ignore directories
|
// ignore directories
|
||||||
} else {
|
} else {
|
||||||
path := f.stripRoot(entry)
|
path := f.stripRoot(entry)
|
||||||
out <- f.NewFsObjectWithInfo(path, entry)
|
out <- f.newFsObjectWithInfo(path, entry)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -625,7 +618,7 @@ func (o *FsObjectDropbox) readMetaData() (err error) {
|
|||||||
if !ok {
|
if !ok {
|
||||||
fs.Debug(o, "mtime not a string")
|
fs.Debug(o, "mtime not a string")
|
||||||
} else {
|
} else {
|
||||||
modTime, err := time.Parse(RFC3339In, mtime)
|
modTime, err := time.Parse(timeFormatIn, mtime)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -671,7 +664,7 @@ func (o *FsObjectDropbox) setModTimeAndMd5sum(modTime time.Time, md5sum string)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if !modTime.IsZero() {
|
if !modTime.IsZero() {
|
||||||
mtime := modTime.Format(RFC3339Out)
|
mtime := modTime.Format(timeFormatOut)
|
||||||
err := record.Set(mtimeField, mtime)
|
err := record.Set(mtimeField, mtime)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("Couldn't set mtime record: %s", err)
|
return fmt.Errorf("Couldn't set mtime record: %s", err)
|
||||||
|
@ -34,8 +34,8 @@ import (
|
|||||||
const (
|
const (
|
||||||
rcloneClientId = "202264815644.apps.googleusercontent.com"
|
rcloneClientId = "202264815644.apps.googleusercontent.com"
|
||||||
rcloneClientSecret = "X4Z3ca8xfWDb1Voo-F9a7ZxJ"
|
rcloneClientSecret = "X4Z3ca8xfWDb1Voo-F9a7ZxJ"
|
||||||
RFC3339In = time.RFC3339
|
timeFormatIn = time.RFC3339
|
||||||
RFC3339Out = "2006-01-02T15:04:05.000000000Z07:00"
|
timeFormatOut = "2006-01-02T15:04:05.000000000Z07:00"
|
||||||
metaMtime = "mtime" // key to store mtime under in metadata
|
metaMtime = "mtime" // key to store mtime under in metadata
|
||||||
listChunks = 256 // chunk size to read directory listings
|
listChunks = 256 // chunk size to read directory listings
|
||||||
)
|
)
|
||||||
@ -215,7 +215,7 @@ func NewFs(name, root string) (fs.Fs, error) {
|
|||||||
// Return an FsObject from a path
|
// Return an FsObject from a path
|
||||||
//
|
//
|
||||||
// May return nil if an error occurred
|
// May return nil if an error occurred
|
||||||
func (f *FsStorage) NewFsObjectWithInfo(remote string, info *storage.Object) fs.Object {
|
func (f *FsStorage) newFsObjectWithInfo(remote string, info *storage.Object) fs.Object {
|
||||||
o := &FsObjectStorage{
|
o := &FsObjectStorage{
|
||||||
storage: f,
|
storage: f,
|
||||||
remote: remote,
|
remote: remote,
|
||||||
@ -236,7 +236,7 @@ func (f *FsStorage) NewFsObjectWithInfo(remote string, info *storage.Object) fs.
|
|||||||
//
|
//
|
||||||
// May return nil if an error occurred
|
// May return nil if an error occurred
|
||||||
func (f *FsStorage) NewFsObject(remote string) fs.Object {
|
func (f *FsStorage) NewFsObject(remote string) fs.Object {
|
||||||
return f.NewFsObjectWithInfo(remote, nil)
|
return f.newFsObjectWithInfo(remote, nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
// list the objects into the function supplied
|
// list the objects into the function supplied
|
||||||
@ -293,7 +293,7 @@ func (f *FsStorage) List() fs.ObjectsChan {
|
|||||||
go func() {
|
go func() {
|
||||||
defer close(out)
|
defer close(out)
|
||||||
f.list(false, func(remote string, object *storage.Object) {
|
f.list(false, func(remote string, object *storage.Object) {
|
||||||
if fs := f.NewFsObjectWithInfo(remote, object); fs != nil {
|
if fs := f.newFsObjectWithInfo(remote, object); fs != nil {
|
||||||
out <- fs
|
out <- fs
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@ -441,7 +441,7 @@ func (o *FsObjectStorage) setMetaData(info *storage.Object) {
|
|||||||
// read mtime out of metadata if available
|
// read mtime out of metadata if available
|
||||||
mtimeString, ok := info.Metadata[metaMtime]
|
mtimeString, ok := info.Metadata[metaMtime]
|
||||||
if ok {
|
if ok {
|
||||||
modTime, err := time.Parse(RFC3339In, mtimeString)
|
modTime, err := time.Parse(timeFormatIn, mtimeString)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
o.modTime = modTime
|
o.modTime = modTime
|
||||||
return
|
return
|
||||||
@ -451,7 +451,7 @@ func (o *FsObjectStorage) setMetaData(info *storage.Object) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Fallback to the Updated time
|
// Fallback to the Updated time
|
||||||
modTime, err := time.Parse(RFC3339In, info.Updated)
|
modTime, err := time.Parse(timeFormatIn, info.Updated)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fs.Log(o, "Bad time decode: %v", err)
|
fs.Log(o, "Bad time decode: %v", err)
|
||||||
} else {
|
} else {
|
||||||
@ -491,7 +491,7 @@ func (o *FsObjectStorage) ModTime() time.Time {
|
|||||||
// Returns metadata for an object
|
// Returns metadata for an object
|
||||||
func metadataFromModTime(modTime time.Time) map[string]string {
|
func metadataFromModTime(modTime time.Time) map[string]string {
|
||||||
metadata := make(map[string]string, 1)
|
metadata := make(map[string]string, 1)
|
||||||
metadata[metaMtime] = modTime.Format(RFC3339Out)
|
metadata[metaMtime] = modTime.Format(timeFormatOut)
|
||||||
return metadata
|
return metadata
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -559,7 +559,7 @@ func (o *FsObjectStorage) Update(in io.Reader, modTime time.Time, size int64) er
|
|||||||
Name: o.storage.root + o.remote,
|
Name: o.storage.root + o.remote,
|
||||||
ContentType: contentType,
|
ContentType: contentType,
|
||||||
Size: uint64(size),
|
Size: uint64(size),
|
||||||
Updated: modTime.Format(RFC3339Out), // Doesn't get set
|
Updated: modTime.Format(timeFormatOut), // Doesn't get set
|
||||||
Metadata: metadataFromModTime(modTime),
|
Metadata: metadataFromModTime(modTime),
|
||||||
}
|
}
|
||||||
newObject, err := o.storage.svc.Objects.Insert(o.storage.bucket, &object).Media(in).Name(object.Name).PredefinedAcl(o.storage.objectAcl).Do()
|
newObject, err := o.storage.svc.Objects.Insert(o.storage.bucket, &object).Media(in).Name(object.Name).PredefinedAcl(o.storage.objectAcl).Do()
|
||||||
|
@ -68,7 +68,7 @@ func (f *FsLocal) String() string {
|
|||||||
// Return an FsObject from a path
|
// Return an FsObject from a path
|
||||||
//
|
//
|
||||||
// May return nil if an error occurred
|
// May return nil if an error occurred
|
||||||
func (f *FsLocal) NewFsObjectWithInfo(remote string, info os.FileInfo) fs.Object {
|
func (f *FsLocal) newFsObjectWithInfo(remote string, info os.FileInfo) fs.Object {
|
||||||
path := filepath.Join(f.root, remote)
|
path := filepath.Join(f.root, remote)
|
||||||
o := &FsObjectLocal{local: f, remote: remote, path: path}
|
o := &FsObjectLocal{local: f, remote: remote, path: path}
|
||||||
if info != nil {
|
if info != nil {
|
||||||
@ -87,7 +87,7 @@ func (f *FsLocal) NewFsObjectWithInfo(remote string, info os.FileInfo) fs.Object
|
|||||||
//
|
//
|
||||||
// May return nil if an error occurred
|
// May return nil if an error occurred
|
||||||
func (f *FsLocal) NewFsObject(remote string) fs.Object {
|
func (f *FsLocal) NewFsObject(remote string) fs.Object {
|
||||||
return f.NewFsObjectWithInfo(remote, nil)
|
return f.newFsObjectWithInfo(remote, nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
// List the path returning a channel of FsObjects
|
// List the path returning a channel of FsObjects
|
||||||
@ -111,7 +111,7 @@ func (f *FsLocal) List() fs.ObjectsChan {
|
|||||||
return nil
|
return nil
|
||||||
// remote = ""
|
// remote = ""
|
||||||
}
|
}
|
||||||
if fs := f.NewFsObjectWithInfo(remote, fi); fs != nil {
|
if fs := f.newFsObjectWithInfo(remote, fi); fs != nil {
|
||||||
if fs.Storable() {
|
if fs.Storable() {
|
||||||
out <- fs
|
out <- fs
|
||||||
}
|
}
|
||||||
|
6
s3/s3.go
6
s3/s3.go
@ -227,7 +227,7 @@ func NewFs(name, root string) (fs.Fs, error) {
|
|||||||
// Return an FsObject from a path
|
// Return an FsObject from a path
|
||||||
//
|
//
|
||||||
// May return nil if an error occurred
|
// May return nil if an error occurred
|
||||||
func (f *FsS3) NewFsObjectWithInfo(remote string, info *s3.Key) fs.Object {
|
func (f *FsS3) newFsObjectWithInfo(remote string, info *s3.Key) fs.Object {
|
||||||
o := &FsObjectS3{
|
o := &FsObjectS3{
|
||||||
s3: f,
|
s3: f,
|
||||||
remote: remote,
|
remote: remote,
|
||||||
@ -256,7 +256,7 @@ func (f *FsS3) NewFsObjectWithInfo(remote string, info *s3.Key) fs.Object {
|
|||||||
//
|
//
|
||||||
// May return nil if an error occurred
|
// May return nil if an error occurred
|
||||||
func (f *FsS3) NewFsObject(remote string) fs.Object {
|
func (f *FsS3) NewFsObject(remote string) fs.Object {
|
||||||
return f.NewFsObjectWithInfo(remote, nil)
|
return f.newFsObjectWithInfo(remote, nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
// list the objects into the function supplied
|
// list the objects into the function supplied
|
||||||
@ -312,7 +312,7 @@ func (f *FsS3) List() fs.ObjectsChan {
|
|||||||
go func() {
|
go func() {
|
||||||
defer close(out)
|
defer close(out)
|
||||||
f.list(false, func(remote string, object *s3.Key) {
|
f.list(false, func(remote string, object *s3.Key) {
|
||||||
if fs := f.NewFsObjectWithInfo(remote, object); fs != nil {
|
if fs := f.newFsObjectWithInfo(remote, object); fs != nil {
|
||||||
out <- fs
|
out <- fs
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
@ -157,7 +157,7 @@ func NewFs(name, root string) (fs.Fs, error) {
|
|||||||
// Return an FsObject from a path
|
// Return an FsObject from a path
|
||||||
//
|
//
|
||||||
// May return nil if an error occurred
|
// May return nil if an error occurred
|
||||||
func (f *FsSwift) NewFsObjectWithInfo(remote string, info *swift.Object) fs.Object {
|
func (f *FsSwift) newFsObjectWithInfo(remote string, info *swift.Object) fs.Object {
|
||||||
fs := &FsObjectSwift{
|
fs := &FsObjectSwift{
|
||||||
swift: f,
|
swift: f,
|
||||||
remote: remote,
|
remote: remote,
|
||||||
@ -179,7 +179,7 @@ func (f *FsSwift) NewFsObjectWithInfo(remote string, info *swift.Object) fs.Obje
|
|||||||
//
|
//
|
||||||
// May return nil if an error occurred
|
// May return nil if an error occurred
|
||||||
func (f *FsSwift) NewFsObject(remote string) fs.Object {
|
func (f *FsSwift) NewFsObject(remote string) fs.Object {
|
||||||
return f.NewFsObjectWithInfo(remote, nil)
|
return f.newFsObjectWithInfo(remote, nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
// list the objects into the function supplied
|
// list the objects into the function supplied
|
||||||
@ -236,7 +236,7 @@ func (f *FsSwift) List() fs.ObjectsChan {
|
|||||||
go func() {
|
go func() {
|
||||||
defer close(out)
|
defer close(out)
|
||||||
f.list(false, func(remote string, object *swift.Object) {
|
f.list(false, func(remote string, object *swift.Object) {
|
||||||
if fs := f.NewFsObjectWithInfo(remote, object); fs != nil {
|
if fs := f.newFsObjectWithInfo(remote, object); fs != nil {
|
||||||
out <- fs
|
out <- fs
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
Loading…
Reference in New Issue
Block a user