From d7f3acb2c056534f29950f3586d804ec274349b2 Mon Sep 17 00:00:00 2001 From: Chris Lu Date: Sat, 11 Apr 2020 12:45:24 -0700 Subject: [PATCH] refactor --- weed/filer2/reader_at.go | 6 +++--- weed/filesys/wfs.go | 6 +++--- weed/server/webdav_server.go | 6 +++--- weed/util/{pb_cache => chunk_cache}/chunk_cache.go | 2 +- 4 files changed, 10 insertions(+), 10 deletions(-) rename weed/util/{pb_cache => chunk_cache}/chunk_cache.go (97%) diff --git a/weed/filer2/reader_at.go b/weed/filer2/reader_at.go index 448aa3465..2782cc204 100644 --- a/weed/filer2/reader_at.go +++ b/weed/filer2/reader_at.go @@ -10,7 +10,7 @@ import ( "github.com/chrislusf/seaweedfs/weed/glog" "github.com/chrislusf/seaweedfs/weed/pb/filer_pb" "github.com/chrislusf/seaweedfs/weed/util" - "github.com/chrislusf/seaweedfs/weed/util/pb_cache" + "github.com/chrislusf/seaweedfs/weed/util/chunk_cache" "github.com/chrislusf/seaweedfs/weed/wdclient" ) @@ -22,12 +22,12 @@ type ChunkReadAt struct { lookupFileId func(fileId string) (targetUrl string, err error) readerLock sync.Mutex - chunkCache *pb_cache.ChunkCache + chunkCache *chunk_cache.ChunkCache } // var _ = io.ReaderAt(&ChunkReadAt{}) -func NewChunkReaderAtFromClient(filerClient filer_pb.FilerClient, chunkViews []*ChunkView, chunkCache *pb_cache.ChunkCache) *ChunkReadAt { +func NewChunkReaderAtFromClient(filerClient filer_pb.FilerClient, chunkViews []*ChunkView, chunkCache *chunk_cache.ChunkCache) *ChunkReadAt { return &ChunkReadAt{ chunkViews: chunkViews, diff --git a/weed/filesys/wfs.go b/weed/filesys/wfs.go index 5e994d14e..49db18b6e 100644 --- a/weed/filesys/wfs.go +++ b/weed/filesys/wfs.go @@ -16,7 +16,7 @@ import ( "github.com/chrislusf/seaweedfs/weed/pb" "github.com/chrislusf/seaweedfs/weed/pb/filer_pb" "github.com/chrislusf/seaweedfs/weed/util" - "github.com/chrislusf/seaweedfs/weed/util/pb_cache" + "github.com/chrislusf/seaweedfs/weed/util/chunk_cache" "github.com/seaweedfs/fuse" "github.com/seaweedfs/fuse/fs" ) @@ -64,7 +64,7 @@ type WFS struct { root fs.Node fsNodeCache *FsCache - chunkCache *pb_cache.ChunkCache + chunkCache *chunk_cache.ChunkCache } type statsCache struct { filer_pb.StatisticsResponse @@ -81,7 +81,7 @@ func NewSeaweedFileSystem(option *Option) *WFS { return make([]byte, option.ChunkSizeLimit) }, }, - chunkCache: pb_cache.NewChunkCache(option.ChunkCacheCountLimit), + chunkCache: chunk_cache.NewChunkCache(option.ChunkCacheCountLimit), } wfs.root = &Dir{name: wfs.option.FilerMountRootPath, wfs: wfs} diff --git a/weed/server/webdav_server.go b/weed/server/webdav_server.go index 5a9861fe7..082755291 100644 --- a/weed/server/webdav_server.go +++ b/weed/server/webdav_server.go @@ -17,7 +17,7 @@ import ( "github.com/chrislusf/seaweedfs/weed/pb" "github.com/chrislusf/seaweedfs/weed/pb/filer_pb" "github.com/chrislusf/seaweedfs/weed/util" - "github.com/chrislusf/seaweedfs/weed/util/pb_cache" + "github.com/chrislusf/seaweedfs/weed/util/chunk_cache" "github.com/chrislusf/seaweedfs/weed/filer2" "github.com/chrislusf/seaweedfs/weed/glog" @@ -67,7 +67,7 @@ type WebDavFileSystem struct { secret security.SigningKey filer *filer2.Filer grpcDialOption grpc.DialOption - chunkCache *pb_cache.ChunkCache + chunkCache *chunk_cache.ChunkCache } type FileInfo struct { @@ -98,7 +98,7 @@ type WebDavFile struct { func NewWebDavFileSystem(option *WebDavOption) (webdav.FileSystem, error) { return &WebDavFileSystem{ option: option, - chunkCache: pb_cache.NewChunkCache(1000), + chunkCache: chunk_cache.NewChunkCache(1000), }, nil } diff --git a/weed/util/pb_cache/chunk_cache.go b/weed/util/chunk_cache/chunk_cache.go similarity index 97% rename from weed/util/pb_cache/chunk_cache.go rename to weed/util/chunk_cache/chunk_cache.go index d729bd8c1..e2676d9cc 100644 --- a/weed/util/pb_cache/chunk_cache.go +++ b/weed/util/chunk_cache/chunk_cache.go @@ -1,4 +1,4 @@ -package pb_cache +package chunk_cache import ( "time"