aboutsummaryrefslogtreecommitdiff
path: root/weed/filer2/stream.go
diff options
context:
space:
mode:
Diffstat (limited to 'weed/filer2/stream.go')
-rw-r--r--weed/filer2/stream.go12
1 files changed, 11 insertions, 1 deletions
diff --git a/weed/filer2/stream.go b/weed/filer2/stream.go
index 4e785fade..4c8213b07 100644
--- a/weed/filer2/stream.go
+++ b/weed/filer2/stream.go
@@ -81,7 +81,7 @@ type ChunkStreamReader struct {
bufferOffset int64
bufferPos int
chunkIndex int
- lookupFileId func(fileId string) (targetUrl string, err error)
+ lookupFileId LookupFileIdFunctionType
}
var _ = io.ReadSeeker(&ChunkStreamReader{})
@@ -98,6 +98,16 @@ func NewChunkStreamReaderFromFiler(masterClient *wdclient.MasterClient, chunks [
}
}
+func NewChunkStreamReader(filerClient filer_pb.FilerClient, chunks []*filer_pb.FileChunk) *ChunkStreamReader {
+
+ chunkViews := ViewFromChunks(chunks, 0, math.MaxInt32)
+
+ return &ChunkStreamReader{
+ chunkViews: chunkViews,
+ lookupFileId: LookupFn(filerClient),
+ }
+}
+
func (c *ChunkStreamReader) Read(p []byte) (n int, err error) {
for n < len(p) {
if c.isBufferEmpty() {