Chris Lu
3 years ago
8 changed files with 86 additions and 14 deletions
-
2weed/filer/filer.go
-
14weed/filer/filer_on_meta_event.go
-
26weed/filer/filer_remote_storage.go
-
8weed/filer/filer_remote_storage_test.go
-
27weed/filer/read_remote.go
-
6weed/remote_storage/remote_storage.go
-
2weed/server/filer_server.go
-
15weed/server/filer_server_handlers_read.go
@ -0,0 +1,27 @@ |
|||
package filer |
|||
|
|||
import ( |
|||
"fmt" |
|||
"io" |
|||
) |
|||
|
|||
func (entry *Entry) IsRemoteOnly() bool { |
|||
return len(entry.Chunks) == 0 && entry.Remote != nil && entry.Remote.Size > 0 |
|||
} |
|||
|
|||
func (f *Filer) ReadRemote(w io.Writer, entry *Entry, offset int64, size int64) error { |
|||
client, _, found := f.RemoteStorage.GetRemoteStorageClient(remoteEntry.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):]) |
|||
|
|||
client.ReadFile(bucket, remoteFullPath[1:], offset, size, func(w io.Writer) error { |
|||
|
|||
}) |
|||
return nil |
|||
} |
Write
Preview
Loading…
Cancel
Save
Reference in new issue