aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Lu <chris.lu@gmail.com>2021-08-29 19:13:48 -0700
committerChris Lu <chris.lu@gmail.com>2021-08-29 19:13:48 -0700
commiteacaa44dc2cea78a859d5a481de889fcf57f6c20 (patch)
tree8467d5a4bae58062b733698200882864a02c231d
parent6deee4c0b973d1faeb6e80a4c996e9089f619667 (diff)
downloadseaweedfs-eacaa44dc2cea78a859d5a481de889fcf57f6c20.tar.xz
seaweedfs-eacaa44dc2cea78a859d5a481de889fcf57f6c20.zip
refactor
-rw-r--r--weed/remote_storage/hdfs/hdfs_storage_client.go2
-rw-r--r--weed/remote_storage/traverse_bfs.go (renamed from weed/remote_storage/hdfs/traverse_bfs.go)9
2 files changed, 5 insertions, 6 deletions
diff --git a/weed/remote_storage/hdfs/hdfs_storage_client.go b/weed/remote_storage/hdfs/hdfs_storage_client.go
index e4d7dcb44..5b4ce0b29 100644
--- a/weed/remote_storage/hdfs/hdfs_storage_client.go
+++ b/weed/remote_storage/hdfs/hdfs_storage_client.go
@@ -66,7 +66,7 @@ var _ = remote_storage.RemoteStorageClient(&hdfsRemoteStorageClient{})
func (c *hdfsRemoteStorageClient) Traverse(loc *remote_pb.RemoteStorageLocation, visitFn remote_storage.VisitFunc) (err error) {
- return TraverseBfs(func(parentDir util.FullPath, visitFn remote_storage.VisitFunc) error {
+ return remote_storage.TraverseBfs(func(parentDir util.FullPath, visitFn remote_storage.VisitFunc) error {
children, err := c.client.ReadDir(string(parentDir))
if err != nil {
return err
diff --git a/weed/remote_storage/hdfs/traverse_bfs.go b/weed/remote_storage/traverse_bfs.go
index 755771283..4056f8715 100644
--- a/weed/remote_storage/hdfs/traverse_bfs.go
+++ b/weed/remote_storage/traverse_bfs.go
@@ -1,16 +1,15 @@
-package hdfs
+package remote_storage
import (
"github.com/chrislusf/seaweedfs/weed/pb/filer_pb"
- "github.com/chrislusf/seaweedfs/weed/remote_storage"
"github.com/chrislusf/seaweedfs/weed/util"
"sync"
"time"
)
-type ListDirectoryFunc func(parentDir util.FullPath, visitFn remote_storage.VisitFunc) error
+type ListDirectoryFunc func(parentDir util.FullPath, visitFn VisitFunc) error
-func TraverseBfs(listDirFn ListDirectoryFunc, parentPath util.FullPath, visitFn remote_storage.VisitFunc) (err error) {
+func TraverseBfs(listDirFn ListDirectoryFunc, parentPath util.FullPath, visitFn VisitFunc) (err error) {
K := 5
var dirQueueWg sync.WaitGroup
@@ -46,7 +45,7 @@ func TraverseBfs(listDirFn ListDirectoryFunc, parentPath util.FullPath, visitFn
}
-func processOneDirectory(listDirFn ListDirectoryFunc, parentPath util.FullPath, visitFn remote_storage.VisitFunc, dirQueue *util.Queue, dirQueueWg *sync.WaitGroup) (error) {
+func processOneDirectory(listDirFn ListDirectoryFunc, parentPath util.FullPath, visitFn VisitFunc, dirQueue *util.Queue, dirQueueWg *sync.WaitGroup) (error) {
return listDirFn(parentPath, func(dir string, name string, isDirectory bool, remoteEntry *filer_pb.RemoteEntry) error {
if err := visitFn(dir, name, isDirectory, remoteEntry); err != nil {