mirror of
https://github.com/restic/restic.git
synced 2026-11-23 13:52:39 +00:00
repository: add BlobBufferPool to BlobSaverAsync
This commit is contained in:
1 parent
3446754c41
commit
4718be1aee
4 files changed
+28
No files matched your search
@@ -500,6 +500,10 @@ func (repo *blobCountingSaver) SaveBlobAsync(ctx context.Context, t restic.BlobT
|
||||
})
|
||||
}
|
||||
|
||||
func (repo *blobCountingSaver) BlobBufferPool() *restic.BlobBufferPool {
|
||||
return repo.saver.BlobBufferPool()
|
||||
}
|
||||
|
||||
func appendToFile(t testing.TB, filename string, data []byte) {
|
||||
f, err := os.OpenFile(filename, os.O_CREATE|os.O_APPEND|os.O_WRONLY, 0644)
|
||||
if err != nil {
|
||||
@@ -2368,6 +2372,10 @@ func (f *failSaveSaver) SaveBlobAsync(ctx context.Context, t restic.BlobType, bu
|
||||
})
|
||||
}
|
||||
|
||||
func (f *failSaveSaver) BlobBufferPool() *restic.BlobBufferPool {
|
||||
return f.saver.BlobBufferPool()
|
||||
}
|
||||
|
||||
func TestArchiverAbortEarlyOnError(t *testing.T) {
|
||||
var tests = []struct {
|
||||
src TestDir
|
||||
|
||||
@@ -19,6 +19,10 @@ type mockSaver struct {
|
||||
mutex sync.Mutex
|
||||
}
|
||||
|
||||
func (m *mockSaver) BlobBufferPool() *restic.BlobBufferPool {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *mockSaver) SaveBlobAsync(_ context.Context, _ restic.BlobType, buf []byte, id restic.ID, storeDuplicate bool, cb func(newID restic.ID, known bool, sizeInRepo int, err error)) {
|
||||
// Fake async operation
|
||||
go func() {
|
||||
|
||||
Reference in new issue
Block a user