Add debug messages

This commit is contained in:
Alexander Neumann 2017-01-24 09:03:33 +01:00
parent 0d125725bc
commit 31055d88a5
2 changed files with 5 additions and 1 deletions

View File

@ -2,6 +2,7 @@ package restic
import ( import (
"io" "io"
"restic/debug"
) )
type backendReaderAt struct { type backendReaderAt struct {
@ -20,6 +21,7 @@ func ReaderAt(be Backend, h Handle) io.ReaderAt {
// ReadAt reads from the backend handle h at the given position. // ReadAt reads from the backend handle h at the given position.
func ReadAt(be Backend, h Handle, offset int64, p []byte) (n int, err error) { func ReadAt(be Backend, h Handle, offset int64, p []byte) (n int, err error) {
debug.Log("ReadAt(%v) at %v, len %v", h, offset, len(p))
rd, err := be.Load(h, len(p), offset) rd, err := be.Load(h, len(p), offset)
if err != nil { if err != nil {
return 0, err return 0, err
@ -31,5 +33,7 @@ func ReadAt(be Backend, h Handle, offset int64, p []byte) (n int, err error) {
err = e err = e
} }
debug.Log("ReadAt(%v) ReadFull returned %v bytes", h, n)
return n, err return n, err
} }

View File

@ -520,7 +520,7 @@ func (r *Repository) Close() error {
// be large enough to hold the encrypted blob, since it is used as scratch // be large enough to hold the encrypted blob, since it is used as scratch
// space. // space.
func (r *Repository) LoadBlob(t restic.BlobType, id restic.ID, buf []byte) (int, error) { func (r *Repository) LoadBlob(t restic.BlobType, id restic.ID, buf []byte) (int, error) {
debug.Log("load blob %v into buf %p", id.Str(), buf) debug.Log("load blob %v into buf (len %v, cap %v)", id.Str(), len(buf), cap(buf))
size, err := r.idx.LookupSize(id, t) size, err := r.idx.LookupSize(id, t)
if err != nil { if err != nil {
return 0, err return 0, err