MCPcopy Index your code
hub / github.com/rclone/rclone / _readAt

Method _readAt

vfs/read_write.go:257–282  ·  view source on GitHub ↗

_readAt bytes from the file at off if release is set then it releases the mutex just before doing the IO call with lock held

(b []byte, off int64, release bool)

Source from the content-addressed store, hash-verified

255//
256// call with lock held
257func (fh *RWFileHandle) _readAt(b []byte, off int64, release bool) (n int, err error) {
258 defer log.Trace(fh.logPrefix(), "size=%d, off=%d", len(b), off)("n=%d, err=%v", &n, &err)
259 if fh.closed {
260 return n, ECLOSED
261 }
262 if fh.writeOnly() {
263 return n, EBADF
264 }
265 if off >= fh._size() {
266 return n, io.EOF
267 }
268 if err = fh.openPending(); err != nil {
269 return n, err
270 }
271 if release {
272 // Do the writing with fh.mu unlocked
273 fh.mu.Unlock()
274 }
275
276 n, err = fh.item.ReadAt(b, off)
277
278 if release {
279 fh.mu.Lock()
280 }
281 return n, err
282}
283
284// ReadAt bytes from the file at off
285func (fh *RWFileHandle) ReadAt(b []byte, off int64) (n int, err error) {

Callers 2

ReadAtMethod · 0.95
ReadMethod · 0.95

Calls 8

logPrefixMethod · 0.95
writeOnlyMethod · 0.95
_sizeMethod · 0.95
openPendingMethod · 0.95
TraceFunction · 0.92
UnlockMethod · 0.65
ReadAtMethod · 0.65
LockMethod · 0.65

Tested by

no test coverage detected