MCPcopy
hub / github.com/restic/restic / ReadAt

Function ReadAt

internal/backend/readerat.go:29–43  ·  view source on GitHub ↗

ReadAt reads from the backend handle h at the given position.

(ctx context.Context, be Backend, h Handle, offset int64, p []byte)

Source from the content-addressed store, hash-verified

27
28// ReadAt reads from the backend handle h at the given position.
29func ReadAt(ctx context.Context, be Backend, h Handle, offset int64, p []byte) (n int, err error) {
30 debug.Log("ReadAt(%v) at %v, len %v", h, offset, len(p))
31
32 err = be.Load(ctx, h, len(p), offset, func(rd io.Reader) (ierr error) {
33 n, ierr = io.ReadFull(rd, p)
34
35 return ierr
36 })
37 if err != nil {
38 return 0, errors.Wrapf(err, "ReadFull(%v)", h)
39 }
40
41 debug.Log("ReadAt(%v) ReadFull returned %v bytes", h, n)
42 return n, nil
43}

Callers 2

loadBlobMethod · 0.92
ReadAtMethod · 0.85

Calls 3

LogFunction · 0.92
LoadMethod · 0.65
ReadFullMethod · 0.65

Tested by

no test coverage detected