mirror of
https://github.com/octoleo/restic.git
synced 2024-11-17 02:25:12 +00:00
Move interfaces to package restic/types
This commit is contained in:
parent
80bcae44e2
commit
302619a11a
@ -5,11 +5,11 @@ import (
|
|||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
"restic"
|
|
||||||
"restic/backend"
|
"restic/backend"
|
||||||
"restic/debug"
|
"restic/debug"
|
||||||
"restic/list"
|
"restic/list"
|
||||||
"restic/pack"
|
"restic/pack"
|
||||||
|
"restic/types"
|
||||||
"restic/worker"
|
"restic/worker"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -41,7 +41,7 @@ func newIndex() *Index {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// New creates a new index for repo from scratch.
|
// New creates a new index for repo from scratch.
|
||||||
func New(repo restic.Repository) (*Index, error) {
|
func New(repo types.Repository) (*Index, error) {
|
||||||
done := make(chan struct{})
|
done := make(chan struct{})
|
||||||
defer close(done)
|
defer close(done)
|
||||||
|
|
||||||
@ -92,7 +92,7 @@ type indexJSON struct {
|
|||||||
Packs []*packJSON `json:"packs"`
|
Packs []*packJSON `json:"packs"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func loadIndexJSON(repo restic.Repository, id backend.ID) (*indexJSON, error) {
|
func loadIndexJSON(repo types.Repository, id backend.ID) (*indexJSON, error) {
|
||||||
debug.Log("index.loadIndexJSON", "process index %v\n", id.Str())
|
debug.Log("index.loadIndexJSON", "process index %v\n", id.Str())
|
||||||
|
|
||||||
var idx indexJSON
|
var idx indexJSON
|
||||||
@ -105,7 +105,7 @@ func loadIndexJSON(repo restic.Repository, id backend.ID) (*indexJSON, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Load creates an index by loading all index files from the repo.
|
// Load creates an index by loading all index files from the repo.
|
||||||
func Load(repo restic.Repository) (*Index, error) {
|
func Load(repo types.Repository) (*Index, error) {
|
||||||
debug.Log("index.Load", "loading indexes")
|
debug.Log("index.Load", "loading indexes")
|
||||||
|
|
||||||
done := make(chan struct{})
|
done := make(chan struct{})
|
||||||
@ -268,7 +268,7 @@ func (idx *Index) FindBlob(h pack.Handle) ([]Location, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Save writes a new index containing the given packs.
|
// Save writes a new index containing the given packs.
|
||||||
func Save(repo restic.Repository, packs map[backend.ID][]pack.Blob, supersedes backend.IDs) (backend.ID, error) {
|
func Save(repo types.Repository, packs map[backend.ID][]pack.Blob, supersedes backend.IDs) (backend.ID, error) {
|
||||||
idx := &indexJSON{
|
idx := &indexJSON{
|
||||||
Supersedes: supersedes,
|
Supersedes: supersedes,
|
||||||
Packs: make([]*packJSON, 0, len(packs)),
|
Packs: make([]*packJSON, 0, len(packs)),
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
package restic
|
package types
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"restic/backend"
|
"restic/backend"
|
Loading…
Reference in New Issue
Block a user