diff options
| author | Chris Lu <chris.lu@gmail.com> | 2020-04-29 17:40:08 -0700 |
|---|---|---|
| committer | Chris Lu <chris.lu@gmail.com> | 2020-04-29 17:40:08 -0700 |
| commit | 9e72e9e4b8d58e0f6f99088f0e449d1c9c55e562 (patch) | |
| tree | 4b3b24e0bc17b9597010ce18892a5cb8264476d7 /weed/filer2/stream.go | |
| parent | ed3cf811f576e2dd9fd1c1fb0df967d7fb9e6f1c (diff) | |
| download | seaweedfs-9e72e9e4b8d58e0f6f99088f0e449d1c9c55e562.tar.xz seaweedfs-9e72e9e4b8d58e0f6f99088f0e449d1c9c55e562.zip | |
able to subscribe any topic from any point of time
Diffstat (limited to 'weed/filer2/stream.go')
| -rw-r--r-- | weed/filer2/stream.go | 12 |
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() { |
