Documentation ¶
Index ¶
- Constants
- func GetRangeReadCloserFromLink(size int64, link *model.Link) (model.RangeReadCloserIF, error)
- func RequestRangedHttp(ctx context.Context, link *model.Link, offset, length int64) (*http.Response, error)
- type FileStream
- func (f *FileStream) CacheFullInTempFile() (model.File, error)
- func (f *FileStream) Close() error
- func (f *FileStream) GetExist() model.Obj
- func (f *FileStream) GetMimetype() string
- func (f *FileStream) GetSize() int64
- func (f *FileStream) IsForceStreamUpload() bool
- func (f *FileStream) NeedStore() bool
- func (f *FileStream) RangeRead(httpRange http_range.Range) (io.Reader, error)
- func (f *FileStream) SetExist(obj model.Obj)
- func (f *FileStream) SetTmpFile(r *os.File)
- type SeekableStream
Constants ¶
View Source
const InMemoryBufMaxSize = 10 // Megabytes
View Source
const InMemoryBufMaxSizeBytes = InMemoryBufMaxSize * 1024 * 1024
Variables ¶
This section is empty.
Functions ¶
Types ¶
type FileStream ¶
type FileStream struct { Ctx context.Context model.Obj io.Reader Mimetype string WebPutAsTask bool ForceStreamUpload bool Exist model.Obj //the file existed in the destination, we can reuse some info since we wil overwrite it utils.Closers // contains filtered or unexported fields }
func (*FileStream) CacheFullInTempFile ¶
func (f *FileStream) CacheFullInTempFile() (model.File, error)
CacheFullInTempFile save all data into tmpFile. Not recommended since it wears disk, and can't start upload until the file is written. It's not thread-safe!
func (*FileStream) Close ¶
func (f *FileStream) Close() error
func (*FileStream) GetExist ¶
func (f *FileStream) GetExist() model.Obj
func (*FileStream) GetMimetype ¶
func (f *FileStream) GetMimetype() string
func (*FileStream) GetSize ¶
func (f *FileStream) GetSize() int64
func (*FileStream) IsForceStreamUpload ¶
func (f *FileStream) IsForceStreamUpload() bool
func (*FileStream) NeedStore ¶
func (f *FileStream) NeedStore() bool
func (*FileStream) RangeRead ¶
func (f *FileStream) RangeRead(httpRange http_range.Range) (io.Reader, error)
RangeRead have to cache all data first since only Reader is provided. also support a peeking RangeRead at very start, but won't buffer more than 10MB data in memory
func (*FileStream) SetExist ¶
func (f *FileStream) SetExist(obj model.Obj)
func (*FileStream) SetTmpFile ¶
func (f *FileStream) SetTmpFile(r *os.File)
type SeekableStream ¶
type SeekableStream struct { FileStream Link *model.Link // contains filtered or unexported fields }
for most internal stream, which is either RangeReadCloser or MFile
func NewSeekableStream ¶
func NewSeekableStream(fs FileStream, link *model.Link) (*SeekableStream, error)
func (*SeekableStream) CacheFullInTempFile ¶
func (ss *SeekableStream) CacheFullInTempFile() (model.File, error)
func (*SeekableStream) RangeRead ¶
func (ss *SeekableStream) RangeRead(httpRange http_range.Range) (io.Reader, error)
RangeRead is not thread-safe, pls use it in single thread only.
Click to show internal directories.
Click to hide internal directories.