backend: Move semaphores to a dedicated package
... called backend/sema. I resisted the temptation to call the main type sema.Phore. Also, semaphores are now passed by value to skip a level of indirection when using them.
This commit is contained in:
parent
1dd4b9b60e
commit
910d917b71
11 changed files with 101 additions and 98 deletions
|
@ -9,12 +9,12 @@ import (
|
|||
"path/filepath"
|
||||
"syscall"
|
||||
|
||||
"github.com/restic/restic/internal/errors"
|
||||
"github.com/restic/restic/internal/restic"
|
||||
|
||||
"github.com/restic/restic/internal/backend"
|
||||
"github.com/restic/restic/internal/backend/sema"
|
||||
"github.com/restic/restic/internal/debug"
|
||||
"github.com/restic/restic/internal/errors"
|
||||
"github.com/restic/restic/internal/fs"
|
||||
"github.com/restic/restic/internal/restic"
|
||||
|
||||
"github.com/cenkalti/backoff/v4"
|
||||
)
|
||||
|
@ -22,7 +22,7 @@ import (
|
|||
// Local is a backend in a local directory.
|
||||
type Local struct {
|
||||
Config
|
||||
sem *backend.Semaphore
|
||||
sem sema.Semaphore
|
||||
backend.Layout
|
||||
backend.Modes
|
||||
}
|
||||
|
@ -38,7 +38,7 @@ func open(ctx context.Context, cfg Config) (*Local, error) {
|
|||
return nil, err
|
||||
}
|
||||
|
||||
sem, err := backend.NewSemaphore(cfg.Connections)
|
||||
sem, err := sema.New(cfg.Connections)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue