MCPcopy
hub / github.com/rclone/rclone / queueOffset

Method queueOffset

backend/cache/handle.go:167–198  ·  view source on GitHub ↗

queueOffset will send an offset to the workers if it's different from the last one

(offset int64)

Source from the content-addressed store, hash-verified

165
166// queueOffset will send an offset to the workers if it's different from the last one
167func (r *Handle) queueOffset(offset int64) {
168 if offset != r.preloadOffset {
169 // clean past in-memory chunks
170 if r.UseMemory {
171 go r.memory.CleanChunksByNeed(offset)
172 }
173 r.confirmExternalReading()
174 r.preloadOffset = offset
175
176 // clear the past seen chunks
177 // they will remain in our persistent storage but will be removed from transient
178 // so they need to be picked up by a worker
179 for k := range r.seenOffsets {
180 if k < offset {
181 r.seenOffsets[k] = false
182 }
183 }
184
185 for i := range r.workers {
186 o := r.preloadOffset + int64(r.cacheFs().opt.ChunkSize)*int64(i)
187 if o < 0 || o >= r.cachedObject.Size() {
188 continue
189 }
190 if v, ok := r.seenOffsets[o]; ok && v {
191 continue
192 }
193
194 r.seenOffsets[o] = true
195 r.preloadQueue <- o
196 }
197 }
198}
199
200// getChunk is called by the FS to retrieve a specific chunk of known start and size from where it can find it
201// it can be from transient or persistent cache

Callers 2

getChunkMethod · 0.95
SeekMethod · 0.95

Calls 4

cacheFsMethod · 0.95
SizeMethod · 0.65
CleanChunksByNeedMethod · 0.45

Tested by

no test coverage detected