mirror of
https://github.com/octoleo/restic.git
synced 2024-12-23 03:18:55 +00:00
Move interfaces to package restic/types
This commit is contained in:
parent
80bcae44e2
commit
302619a11a
@ -5,11 +5,11 @@ import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"os"
|
||||
"restic"
|
||||
"restic/backend"
|
||||
"restic/debug"
|
||||
"restic/list"
|
||||
"restic/pack"
|
||||
"restic/types"
|
||||
"restic/worker"
|
||||
)
|
||||
|
||||
@ -41,7 +41,7 @@ func newIndex() *Index {
|
||||
}
|
||||
|
||||
// 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{})
|
||||
defer close(done)
|
||||
|
||||
@ -92,7 +92,7 @@ type indexJSON struct {
|
||||
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())
|
||||
|
||||
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.
|
||||
func Load(repo restic.Repository) (*Index, error) {
|
||||
func Load(repo types.Repository) (*Index, error) {
|
||||
debug.Log("index.Load", "loading indexes")
|
||||
|
||||
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.
|
||||
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{
|
||||
Supersedes: supersedes,
|
||||
Packs: make([]*packJSON, 0, len(packs)),
|
||||
|
@ -1,4 +1,4 @@
|
||||
package restic
|
||||
package types
|
||||
|
||||
import (
|
||||
"restic/backend"
|
Loading…
Reference in New Issue
Block a user