mirror of
https://github.com/restic/restic.git
synced 2025-12-11 18:47:50 +00:00
backend: refactor backend Connections and HasAtomicReplace into Properties
This commit is contained in:
@@ -17,15 +17,12 @@ var ErrNoRepository = fmt.Errorf("repository does not exist")
|
||||
// the context package need not be wrapped, as context cancellation is checked
|
||||
// separately by the retrying logic.
|
||||
type Backend interface {
|
||||
// Connections returns the maximum number of concurrent backend operations.
|
||||
Connections() uint
|
||||
// Properties returns information about the backend
|
||||
Properties() Properties
|
||||
|
||||
// Hasher may return a hash function for calculating a content hash for the backend
|
||||
Hasher() hash.Hash
|
||||
|
||||
// HasAtomicReplace returns whether Save() can atomically replace files
|
||||
HasAtomicReplace() bool
|
||||
|
||||
// Remove removes a File described by h.
|
||||
Remove(ctx context.Context, h Handle) error
|
||||
|
||||
@@ -92,6 +89,14 @@ type Backend interface {
|
||||
WarmupWait(ctx context.Context, h []Handle) error
|
||||
}
|
||||
|
||||
type Properties struct {
|
||||
// Connections states the maximum number of concurrent backend operations.
|
||||
Connections uint
|
||||
|
||||
// HasAtomicReplace states whether Save() can atomically replace files
|
||||
HasAtomicReplace bool
|
||||
}
|
||||
|
||||
type Unwrapper interface {
|
||||
// Unwrap returns the underlying backend or nil if there is none.
|
||||
Unwrap() Backend
|
||||
|
||||
Reference in New Issue
Block a user