MCPcopy
hub / github.com/OpenListTeam/OpenList / NewStreamSectionReader

Function NewStreamSectionReader

internal/stream/util.go:185–197  ·  view source on GitHub ↗
(file model.FileStreamer, sectionSize int, up *model.UpdateProgress)

Source from the content-addressed store, hash-verified

183}
184
185func NewStreamSectionReader(file model.FileStreamer, sectionSize int, up *model.UpdateProgress) (StreamSectionReader, error) {
186 if file.GetFile() != nil {
187 return &cachedSectionReader{file.GetFile()}, nil
188 }
189
190 blockSize := min(uint64(sectionSize), uint64(file.GetSize()), conf.MaxBlockLimit)
191 hc, err := hcache.NewHybridCache(blockSize, uint64(file.GetSize()))
192 if err != nil {
193 return nil, err
194 }
195 file.Add(hc)
196 return &hybridSectionReader{file: file, hc: hc}, nil
197}
198
199type cachedSectionReader struct {
200 cache io.ReaderAt

Callers 15

upRemoteMethod · 0.92
upOneDriveMethod · 0.92
upS3Method · 0.92
StreamUploadMethod · 0.92
UploadMethod · 0.92
UploadByMultipartMethod · 0.92
UploadMethod · 0.92
newUploadMethod · 0.92
chunkUploadMethod · 0.92
chunkedUploadMethod · 0.92
hfDirectUploadMethod · 0.92
uploadUnitsMethod · 0.92

Calls 4

minFunction · 0.85
GetFileMethod · 0.65
GetSizeMethod · 0.65
AddMethod · 0.65

Tested by 1

TestStreamSectionReaderFunction · 0.74