Return real size from SaveBlob
This commit is contained in:
parent
fdc53a9d32
commit
99634c0936
13 changed files with 50 additions and 40 deletions
|
@ -10,7 +10,7 @@ import (
|
|||
|
||||
// Saver allows saving a blob.
|
||||
type Saver interface {
|
||||
SaveBlob(ctx context.Context, t restic.BlobType, data []byte, id restic.ID, storeDuplicate bool) (restic.ID, bool, error)
|
||||
SaveBlob(ctx context.Context, t restic.BlobType, data []byte, id restic.ID, storeDuplicate bool) (restic.ID, bool, int, error)
|
||||
Index() restic.MasterIndex
|
||||
}
|
||||
|
||||
|
@ -100,10 +100,11 @@ type saveBlobJob struct {
|
|||
type saveBlobResponse struct {
|
||||
id restic.ID
|
||||
known bool
|
||||
size int
|
||||
}
|
||||
|
||||
func (s *BlobSaver) saveBlob(ctx context.Context, t restic.BlobType, buf []byte) (saveBlobResponse, error) {
|
||||
id, known, err := s.repo.SaveBlob(ctx, t, buf, restic.ID{}, false)
|
||||
id, known, size, err := s.repo.SaveBlob(ctx, t, buf, restic.ID{}, false)
|
||||
|
||||
if err != nil {
|
||||
return saveBlobResponse{}, err
|
||||
|
@ -112,6 +113,7 @@ func (s *BlobSaver) saveBlob(ctx context.Context, t restic.BlobType, buf []byte)
|
|||
return saveBlobResponse{
|
||||
id: id,
|
||||
known: known,
|
||||
size: size,
|
||||
}, nil
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue