mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2025-10-22 03:57:23 +08:00
remote storage location changed to struct
This commit is contained in:
@@ -2,6 +2,7 @@ package filer
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/chrislusf/seaweedfs/weed/pb/filer_pb"
|
||||
"io"
|
||||
)
|
||||
|
||||
@@ -10,18 +11,23 @@ func (entry *Entry) IsRemoteOnly() bool {
|
||||
}
|
||||
|
||||
func (f *Filer) ReadRemote(w io.Writer, entry *Entry, offset int64, size int64) error {
|
||||
client, _, found := f.RemoteStorage.GetRemoteStorageClient(remoteEntry.Remote.StorageName)
|
||||
client, _, found := f.RemoteStorage.GetRemoteStorageClient(entry.Remote.StorageName)
|
||||
if !found {
|
||||
return fmt.Errorf("remote storage %v not found", entry.Remote.StorageName)
|
||||
}
|
||||
|
||||
mountDir, remoteLoation := f.RemoteStorage.FindMountDirectory(entry.FullPath)
|
||||
_, bucket, path := remoteLoation.NameBucketPath()
|
||||
|
||||
remoteFullPath := path + string(entry.FullPath[len(mountDir):])
|
||||
remoteFullPath := remoteLoation.Path + string(entry.FullPath[len(mountDir):])
|
||||
|
||||
client.ReadFile(bucket, remoteFullPath[1:], offset, size, func(w io.Writer) error {
|
||||
sourceLoc := &filer_pb.RemoteStorageLocation{
|
||||
Name: remoteLoation.Name,
|
||||
Bucket: remoteLoation.Bucket,
|
||||
Path: remoteFullPath,
|
||||
}
|
||||
|
||||
client.ReadFile(sourceLoc, offset, size, func(w io.Writer) error {
|
||||
return nil
|
||||
})
|
||||
return nil
|
||||
}
|
||||
|
Reference in New Issue
Block a user