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"
|
"io/ioutil"
|
||||||
"net/http"
|
"net/http"
|
||||||
"sort"
|
"sort"
|
||||||
|
"sync"
|
||||||
|
|
||||||
"google.golang.org/grpc"
|
"google.golang.org/grpc"
|
||||||
|
|
||||||
"sync"
|
|
||||||
|
|
||||||
"github.com/chrislusf/seaweedfs/weed/glog"
|
"github.com/chrislusf/seaweedfs/weed/glog"
|
||||||
"github.com/chrislusf/seaweedfs/weed/util"
|
"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)
|
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) {
|
func (cf *ChunkedFileReader) Seek(offset int64, whence int) (int64, error) {
|
||||||
var err error
|
var err error
|
||||||
switch whence {
|
switch whence {
|
||||||
|
|
|
@ -187,10 +187,7 @@ func (vs *VolumeServer) tryHandleChunkedFile(n *needle.Needle, fileName string,
|
||||||
|
|
||||||
w.Header().Set("X-File-Store", "chunked")
|
w.Header().Set("X-File-Store", "chunked")
|
||||||
|
|
||||||
chunkedFileReader := &operation.ChunkedFileReader{
|
chunkedFileReader := operation.NewChunkedFileReader(chunkManifest, vs.GetMaster())
|
||||||
Manifest: chunkManifest,
|
|
||||||
Master: vs.GetMaster(),
|
|
||||||
}
|
|
||||||
defer chunkedFileReader.Close()
|
defer chunkedFileReader.Close()
|
||||||
|
|
||||||
rs := conditionallyResizeImages(chunkedFileReader, ext, r)
|
rs := conditionallyResizeImages(chunkedFileReader, ext, r)
|
||||||
|
|
Loading…
Reference in a new issue