mirror of
https://github.com/restic/restic.git
synced 2025-11-14 17:32:48 +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:
@@ -4,6 +4,7 @@ import (
|
||||
"bufio"
|
||||
"context"
|
||||
"fmt"
|
||||
"hash"
|
||||
"io"
|
||||
"os"
|
||||
"os/exec"
|
||||
@@ -240,6 +241,11 @@ func (r *SFTP) Location() string {
|
||||
return r.p
|
||||
}
|
||||
|
||||
// Hasher may return a hash function for calculating a content hash for the backend
|
||||
func (r *SFTP) Hasher() hash.Hash {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Join joins the given paths and cleans them afterwards. This always uses
|
||||
// forward slashes, which is required by sftp.
|
||||
func Join(parts ...string) string {
|
||||
|
||||
Reference in New Issue
Block a user