merged 'repofs' into 'snapshot' package

This commit is contained in:
Jarek Kowalski
2017-09-04 20:26:25 -07:00
parent 2b032b1748
commit 371fc15694
10 changed files with 19 additions and 26 deletions

View File

@@ -6,8 +6,8 @@
"strings"
"github.com/kopia/kopia/fs"
"github.com/kopia/kopia/fs/repofs"
"github.com/kopia/kopia/repo"
"github.com/kopia/kopia/snapshot"
kingpin "gopkg.in/alecthomas/kingpin.v2"
)
@@ -46,7 +46,7 @@ func init() {
}
func listDirectory(rep *repo.Repository, prefix string, oid repo.ObjectID, indent string) error {
d := repofs.Directory(rep, oid)
d := snapshot.Directory(rep, oid)
entries, err := d.Readdir()
if err != nil {

View File

@@ -7,7 +7,7 @@
"github.com/kopia/kopia/fs"
"github.com/kopia/kopia/fs/cachefs"
"github.com/kopia/kopia/fs/loggingfs"
"github.com/kopia/kopia/fs/repofs"
"github.com/kopia/kopia/snapshot"
kingpin "gopkg.in/alecthomas/kingpin.v2"
)
@@ -38,13 +38,13 @@ func runMountCommand(context *kingpin.ParseContext) error {
}
if *mountObjectID == "all" {
entry = repofs.AllSources(rep)
entry = snapshot.AllSources(rep)
} else {
oid, err := parseObjectID(*mountObjectID, rep)
if err != nil {
return err
}
entry = repofs.Directory(rep, oid)
entry = snapshot.Directory(rep, oid)
}
if *mountTraceFS {

View File

@@ -9,7 +9,6 @@
"time"
"github.com/kopia/kopia/fs"
"github.com/kopia/kopia/fs/repofs"
"github.com/kopia/kopia/internal/units"
"github.com/kopia/kopia/repo"
"github.com/kopia/kopia/snapshot"
@@ -131,7 +130,7 @@ func findAliveBlocks(ctx *cleanupContext, wi *cleanupWorkItem) error {
}
if wi.isDirectory {
entries, err := repofs.Directory(ctx.repo, wi.oid).Readdir()
entries, err := snapshot.Directory(ctx.repo, wi.oid).Readdir()
if err != nil {
return err

View File

@@ -4,7 +4,6 @@
"fmt"
"log"
"github.com/kopia/kopia/fs/repofs"
"github.com/kopia/kopia/repo"
"github.com/kopia/kopia/snapshot"
kingpin "gopkg.in/alecthomas/kingpin.v2"
@@ -59,7 +58,7 @@ func runMigrateCommand(context *kingpin.ParseContext) error {
}
for _, m := range filterSnapshotsToMigrate(snapshots) {
d := repofs.Directory(sourceRepo, m.RootObjectID)
d := snapshot.Directory(sourceRepo, m.RootObjectID)
newm, err := uploader.Upload(d, &m.Source, nil)
if err != nil {
return fmt.Errorf("error migrating shapshot %v @ %v: %v", m.Source, m.StartTime, err)
@@ -81,7 +80,7 @@ func runMigrateCommand(context *kingpin.ParseContext) error {
if err != nil {
return err
}
d := repofs.Directory(sourceRepo, dirOID)
d := snapshot.Directory(sourceRepo, dirOID)
newm, err := uploader.Upload(d, &snapshot.SourceInfo{Host: "temp"}, nil)
if err != nil {
return fmt.Errorf("error migrating directory %v: %v", dirOID, err)

View File

@@ -5,8 +5,8 @@
"strings"
"github.com/kopia/kopia/fs"
"github.com/kopia/kopia/fs/repofs"
"github.com/kopia/kopia/repo"
"github.com/kopia/kopia/snapshot"
)
// ParseObjectID interprets the given ID string and returns corresponding repo.ObjectID.
@@ -25,7 +25,7 @@ func parseObjectID(id string, r *repo.Repository) (repo.ObjectID, error) {
return oid, nil
}
dir := repofs.Directory(r, oid)
dir := snapshot.Directory(r, oid)
if err != nil {
return repo.NullObjectID, err
}

View File

@@ -1,2 +0,0 @@
// Package repofs implements virtual filesystem on top of Repository.
package repofs

View File

@@ -1,4 +1,4 @@
package repofs
package snapshot
import (
"fmt"
@@ -6,12 +6,11 @@
"github.com/kopia/kopia/fs"
"github.com/kopia/kopia/repo"
"github.com/kopia/kopia/snapshot"
)
type repositoryAllSources struct {
repo *repo.Repository
snapshotManager *snapshot.Manager
snapshotManager *Manager
}
func (s *repositoryAllSources) Parent() fs.Directory {
@@ -54,7 +53,7 @@ func (s *repositoryAllSources) Readdir() (fs.Entries, error) {
// AllSources returns fs.Directory that contains the list of all snapshot sources found in the repository.
func AllSources(r *repo.Repository) fs.Directory {
sm := snapshot.NewManager(r)
sm := NewManager(r)
return &repositoryAllSources{repo: r, snapshotManager: sm}
}

View File

@@ -1,4 +1,4 @@
package repofs
package snapshot
import (
"fmt"

View File

@@ -1,17 +1,16 @@
package repofs
package snapshot
import (
"time"
"github.com/kopia/kopia/fs"
"github.com/kopia/kopia/repo"
"github.com/kopia/kopia/snapshot"
)
type sourceDirectories struct {
parent fs.Directory
repo *repo.Repository
snapshotManager *snapshot.Manager
snapshotManager *Manager
userHost string
}

View File

@@ -1,4 +1,4 @@
package repofs
package snapshot
import (
"fmt"
@@ -7,14 +7,13 @@
"github.com/kopia/kopia/fs"
"github.com/kopia/kopia/internal/dir"
"github.com/kopia/kopia/repo"
"github.com/kopia/kopia/snapshot"
)
type sourceSnapshots struct {
parent fs.Directory
repo *repo.Repository
snapshotManager *snapshot.Manager
src *snapshot.SourceInfo
snapshotManager *Manager
src *SourceInfo
}
func (s *sourceSnapshots) Parent() fs.Directory {