mirror of
https://github.com/restic/restic.git
synced 2025-10-10 04:31:24 +00:00
Add plumbing to calculate backend specific file hash for upload
This enables the backends to request the calculation of a backend-specific hash. For the currently supported backends this will always be MD5. The hash calculation happens as early as possible, for pack files this is during assembly of the pack file. That way the hash would even capture corruptions of the temporary pack file on disk.
This commit is contained in:
@@ -3,6 +3,7 @@ package swift
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"hash"
|
||||
"io"
|
||||
"net/http"
|
||||
"path"
|
||||
@@ -115,6 +116,11 @@ func (be *beSwift) Location() string {
|
||||
return be.container
|
||||
}
|
||||
|
||||
// Hasher may return a hash function for calculating a content hash for the backend
|
||||
func (be *beSwift) Hasher() hash.Hash {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Load runs fn with a reader that yields the contents of the file at h at the
|
||||
// given offset.
|
||||
func (be *beSwift) Load(ctx context.Context, h restic.Handle, length int, offset int64, fn func(rd io.Reader) error) error {
|
||||
|
Reference in New Issue
Block a user