mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2024-01-19 02:48:24 +00:00
refactoring
This commit is contained in:
parent
c4bea45099
commit
11372dd548
|
@ -8,11 +8,10 @@ import (
|
|||
"io/ioutil"
|
||||
"net/http"
|
||||
"sort"
|
||||
"sync"
|
||||
|
||||
"google.golang.org/grpc"
|
||||
|
||||
"sync"
|
||||
|
||||
"github.com/chrislusf/seaweedfs/weed/glog"
|
||||
"github.com/chrislusf/seaweedfs/weed/util"
|
||||
)
|
||||
|
@ -126,6 +125,13 @@ func readChunkNeedle(fileUrl string, w io.Writer, offset int64) (written int64,
|
|||
return io.Copy(w, resp.Body)
|
||||
}
|
||||
|
||||
func NewChunkedFileReader(chunkManifest *ChunkManifest, master string) *ChunkedFileReader {
|
||||
return &ChunkedFileReader{
|
||||
Manifest: chunkManifest,
|
||||
Master: master,
|
||||
}
|
||||
}
|
||||
|
||||
func (cf *ChunkedFileReader) Seek(offset int64, whence int) (int64, error) {
|
||||
var err error
|
||||
switch whence {
|
||||
|
|
|
@ -187,10 +187,7 @@ func (vs *VolumeServer) tryHandleChunkedFile(n *needle.Needle, fileName string,
|
|||
|
||||
w.Header().Set("X-File-Store", "chunked")
|
||||
|
||||
chunkedFileReader := &operation.ChunkedFileReader{
|
||||
Manifest: chunkManifest,
|
||||
Master: vs.GetMaster(),
|
||||
}
|
||||
chunkedFileReader := operation.NewChunkedFileReader(chunkManifest, vs.GetMaster())
|
||||
defer chunkedFileReader.Close()
|
||||
|
||||
rs := conditionallyResizeImages(chunkedFileReader, ext, r)
|
||||
|
|
Loading…
Reference in a new issue