diff --git a/weed/filesys/reader_at.go b/weed/filer2/reader_at.go similarity index 92% rename from weed/filesys/reader_at.go rename to weed/filer2/reader_at.go index f819a3fa6..b9913d2ca 100644 --- a/weed/filesys/reader_at.go +++ b/weed/filer2/reader_at.go @@ -1,4 +1,4 @@ -package filesys +package filer2 import ( "bytes" @@ -7,7 +7,6 @@ import ( "io" "sync" - "github.com/chrislusf/seaweedfs/weed/filer2" "github.com/chrislusf/seaweedfs/weed/glog" "github.com/chrislusf/seaweedfs/weed/pb/filer_pb" "github.com/chrislusf/seaweedfs/weed/pb/pb_cache" @@ -17,7 +16,7 @@ import ( type ChunkReadAt struct { masterClient *wdclient.MasterClient - chunkViews []*filer2.ChunkView + chunkViews []*ChunkView buffer []byte bufferOffset int64 lookupFileId func(fileId string) (targetUrl string, err error) @@ -28,13 +27,13 @@ type ChunkReadAt struct { // var _ = io.ReaderAt(&ChunkReadAt{}) -func NewChunkReaderAtFromClient(filerClient filer_pb.FilerClient, chunkViews []*filer2.ChunkView, chunkCache *pb_cache.ChunkCache) *ChunkReadAt { +func NewChunkReaderAtFromClient(filerClient filer_pb.FilerClient, chunkViews []*ChunkView, chunkCache *pb_cache.ChunkCache) *ChunkReadAt { return &ChunkReadAt{ chunkViews: chunkViews, lookupFileId: func(fileId string) (targetUrl string, err error) { err = filerClient.WithFilerClient(func(client filer_pb.SeaweedFilerClient) error { - vid := filer2.VolumeId(fileId) + vid := VolumeId(fileId) resp, err := client.LookupVolume(context.Background(), &filer_pb.LookupVolumeRequest{ VolumeIds: []string{vid}, }) @@ -102,7 +101,7 @@ func (c *ChunkReadAt) doReadAt(p []byte, offset int64) (n int, err error) { } -func (c *ChunkReadAt) fetchChunkData(chunkView *filer2.ChunkView) (data []byte, err error) { +func (c *ChunkReadAt) fetchChunkData(chunkView *ChunkView) (data []byte, err error) { // fmt.Printf("fetching %s [%d,%d)\n", chunkView.FileId, chunkView.LogicOffset, chunkView.LogicOffset+int64(chunkView.Size)) diff --git a/weed/filesys/filehandle.go b/weed/filesys/filehandle.go index 4897d3a08..83a93c062 100644 --- a/weed/filesys/filehandle.go +++ b/weed/filesys/filehandle.go @@ -92,7 +92,7 @@ func (fh *FileHandle) readFromChunks(buff []byte, offset int64) (int64, error) { if fh.f.reader == nil { chunkViews := filer2.ViewFromVisibleIntervals(fh.f.entryViewCache, 0, math.MaxInt32) - fh.f.reader = NewChunkReaderAtFromClient(fh.f.wfs, chunkViews, fh.f.wfs.chunkCache) + fh.f.reader = filer2.NewChunkReaderAtFromClient(fh.f.wfs, chunkViews, fh.f.wfs.chunkCache) } totalRead, err := fh.f.reader.ReadAt(buff, offset) diff --git a/weed/server/webdav_server.go b/weed/server/webdav_server.go index 0c3a049ff..f4f3b44db 100644 --- a/weed/server/webdav_server.go +++ b/weed/server/webdav_server.go @@ -13,7 +13,6 @@ import ( "golang.org/x/net/webdav" "google.golang.org/grpc" - "github.com/chrislusf/seaweedfs/weed/filesys" "github.com/chrislusf/seaweedfs/weed/operation" "github.com/chrislusf/seaweedfs/weed/pb" "github.com/chrislusf/seaweedfs/weed/pb/filer_pb" @@ -480,7 +479,7 @@ func (f *WebDavFile) Read(p []byte) (readSize int, err error) { } if f.reader == nil { chunkViews := filer2.ViewFromVisibleIntervals(f.entryViewCache, 0, math.MaxInt32) - f.reader = filesys.NewChunkReaderAtFromClient(f.fs, chunkViews, f.fs.chunkCache) + f.reader = filer2.NewChunkReaderAtFromClient(f.fs, chunkViews, f.fs.chunkCache) } readSize, err = f.reader.ReadAt(p, f.off)