mirror of
https://github.com/rclone/rclone.git
synced 2024-11-25 09:41:44 +08:00
hash: allow runtime configuration of supported hashes for testing
This commit is contained in:
parent
a259226eb2
commit
251a8e3c39
|
@ -55,6 +55,16 @@ func RegisterHash(name, alias string, width int, newFunc func() hash.Hash) Type
|
|||
return hashType
|
||||
}
|
||||
|
||||
// SupportOnly makes the hash package only support the types passed
|
||||
// in. Used for testing.
|
||||
//
|
||||
// It returns the previously supported types.
|
||||
func SupportOnly(new []Type) (old []Type) {
|
||||
old = supported
|
||||
supported = new
|
||||
return old
|
||||
}
|
||||
|
||||
// ErrUnsupported should be returned by filesystem,
|
||||
// if it is requested to deliver an unsupported hash type.
|
||||
var ErrUnsupported = errors.New("hash type not supported")
|
||||
|
|
Loading…
Reference in New Issue
Block a user