replace some usages of restic.Repository with more specific interface
This should eventually make it easier to test the code.
This commit is contained in:
parent
3424088274
commit
bfb56b78e1
19 changed files with 38 additions and 33 deletions
|
@ -16,11 +16,11 @@ import (
|
|||
type Dumper struct {
|
||||
cache *bloblru.Cache
|
||||
format string
|
||||
repo restic.Repository
|
||||
repo restic.BlobLoader
|
||||
w io.Writer
|
||||
}
|
||||
|
||||
func New(format string, repo restic.Repository, w io.Writer) *Dumper {
|
||||
func New(format string, repo restic.BlobLoader, w io.Writer) *Dumper {
|
||||
return &Dumper{
|
||||
cache: bloblru.New(64 << 20),
|
||||
format: format,
|
||||
|
@ -47,7 +47,7 @@ func (d *Dumper) DumpTree(ctx context.Context, tree *restic.Tree, rootPath strin
|
|||
}
|
||||
}
|
||||
|
||||
func sendTrees(ctx context.Context, repo restic.Repository, tree *restic.Tree, rootPath string, ch chan *restic.Node) {
|
||||
func sendTrees(ctx context.Context, repo restic.BlobLoader, tree *restic.Tree, rootPath string, ch chan *restic.Node) {
|
||||
defer close(ch)
|
||||
|
||||
for _, root := range tree.Nodes {
|
||||
|
@ -58,7 +58,7 @@ func sendTrees(ctx context.Context, repo restic.Repository, tree *restic.Tree, r
|
|||
}
|
||||
}
|
||||
|
||||
func sendNodes(ctx context.Context, repo restic.Repository, root *restic.Node, ch chan *restic.Node) error {
|
||||
func sendNodes(ctx context.Context, repo restic.BlobLoader, root *restic.Node, ch chan *restic.Node) error {
|
||||
select {
|
||||
case ch <- root:
|
||||
case <-ctx.Done():
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue