From c999c0fba8d738def6feddead9368c62eaa6802a Mon Sep 17 00:00:00 2001 From: Jarek Kowalski Date: Sat, 20 Oct 2018 11:36:14 -0700 Subject: [PATCH] moved fs/repofs to snapshot/snapshotfs --- cli/command_diff.go | 7 +++---- cli/command_ls.go | 4 ++-- cli/command_mount.go | 6 +++--- cli/command_object_verify.go | 4 ++-- cli/command_repository_migrate.go | 6 +++--- cli/command_snapshot_list.go | 4 ++-- cli/objref.go | 4 ++-- {fs/repofs => snapshot/snapshotfs}/all_sources.go | 8 +++----- {fs/repofs => snapshot/snapshotfs}/repofs.go | 4 ++-- {fs/repofs => snapshot/snapshotfs}/source_directories.go | 5 ++--- {fs/repofs => snapshot/snapshotfs}/source_snapshots.go | 2 +- 11 files changed, 25 insertions(+), 29 deletions(-) rename {fs/repofs => snapshot/snapshotfs}/all_sources.go (98%) rename {fs/repofs => snapshot/snapshotfs}/repofs.go (96%) rename {fs/repofs => snapshot/snapshotfs}/source_directories.go (97%) rename {fs/repofs => snapshot/snapshotfs}/source_snapshots.go (98%) diff --git a/cli/command_diff.go b/cli/command_diff.go index 2bf882694..b6c65731e 100644 --- a/cli/command_diff.go +++ b/cli/command_diff.go @@ -6,10 +6,9 @@ "os" "strings" - "github.com/kopia/kopia/fs/repofs" "github.com/kopia/kopia/internal/diff" - "github.com/kopia/kopia/repo" + "github.com/kopia/kopia/snapshot/snapshotfs" ) var ( @@ -51,8 +50,8 @@ func runDiffCommand(ctx context.Context, rep *repo.Repository) error { if isDir1 { return d.Compare( ctx, - repofs.DirectoryEntry(rep, oid1, nil), - repofs.DirectoryEntry(rep, oid2, nil), + snapshotfs.DirectoryEntry(rep, oid1, nil), + snapshotfs.DirectoryEntry(rep, oid2, nil), ) } diff --git a/cli/command_ls.go b/cli/command_ls.go index be3c0354d..58882735b 100644 --- a/cli/command_ls.go +++ b/cli/command_ls.go @@ -7,9 +7,9 @@ "strings" "github.com/kopia/kopia/fs" - "github.com/kopia/kopia/fs/repofs" "github.com/kopia/kopia/repo" "github.com/kopia/kopia/repo/object" + "github.com/kopia/kopia/snapshot/snapshotfs" ) var ( @@ -43,7 +43,7 @@ func init() { } func listDirectory(ctx context.Context, rep *repo.Repository, prefix string, oid object.ID, indent string) error { - d := repofs.DirectoryEntry(rep, oid, nil) + d := snapshotfs.DirectoryEntry(rep, oid, nil) entries, err := d.Readdir(ctx) if err != nil { diff --git a/cli/command_mount.go b/cli/command_mount.go index 67340356c..8506414c2 100644 --- a/cli/command_mount.go +++ b/cli/command_mount.go @@ -7,8 +7,8 @@ "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/repo" + "github.com/kopia/kopia/snapshot/snapshotfs" ) var ( @@ -23,13 +23,13 @@ func runMountCommand(ctx context.Context, rep *repo.Repository) error { var entry fs.Directory if *mountObjectID == "all" { - entry = repofs.AllSourcesEntry(rep) + entry = snapshotfs.AllSourcesEntry(rep) } else { oid, err := parseObjectID(ctx, rep, *mountObjectID) if err != nil { return err } - entry = repofs.DirectoryEntry(rep, oid, nil) + entry = snapshotfs.DirectoryEntry(rep, oid, nil) } if *mountTraceFS { diff --git a/cli/command_object_verify.go b/cli/command_object_verify.go index 6b85f27d0..f75623d2c 100644 --- a/cli/command_object_verify.go +++ b/cli/command_object_verify.go @@ -10,12 +10,12 @@ "time" "github.com/kopia/kopia/fs" - "github.com/kopia/kopia/fs/repofs" "github.com/kopia/kopia/internal/parallelwork" "github.com/kopia/kopia/repo" "github.com/kopia/kopia/repo/block" "github.com/kopia/kopia/repo/object" "github.com/kopia/kopia/snapshot" + "github.com/kopia/kopia/snapshot/snapshotfs" ) var ( @@ -112,7 +112,7 @@ func (v *verifier) enqueueVerifyObject(ctx context.Context, oid object.ID, path func (v *verifier) doVerifyDirectory(ctx context.Context, oid object.ID, path string) { log.Debugf("verifying directory %q (%v)", path, oid) - d := repofs.DirectoryEntry(v.rep, oid, nil) + d := snapshotfs.DirectoryEntry(v.rep, oid, nil) entries, err := d.Readdir(ctx) if err != nil { v.reportError(path, fmt.Errorf("error reading %v: %v", oid, err)) diff --git a/cli/command_repository_migrate.go b/cli/command_repository_migrate.go index b5aa5c225..a3afd27d7 100644 --- a/cli/command_repository_migrate.go +++ b/cli/command_repository_migrate.go @@ -4,11 +4,11 @@ "context" "fmt" - "github.com/kopia/kopia/fs/repofs" "github.com/kopia/kopia/internal/upload" "github.com/kopia/kopia/repo" "github.com/kopia/kopia/repo/object" "github.com/kopia/kopia/snapshot" + "github.com/kopia/kopia/snapshot/snapshotfs" ) var ( @@ -53,7 +53,7 @@ func runMigrateCommand(ctx context.Context, destRepo *repo.Repository) error { if err != nil { return err } - d := repofs.DirectoryEntry(sourceRepo, dirOID, nil) + d := snapshotfs.DirectoryEntry(sourceRepo, dirOID, nil) newm, err := uploader.Upload(ctx, d, snapshot.SourceInfo{Host: "temp"}, nil) if err != nil { return fmt.Errorf("error migrating directory %v: %v", dirOID, err) @@ -78,7 +78,7 @@ func migrateSingleSource(ctx context.Context, uploader *upload.Uploader, sourceR } for _, m := range filterSnapshotsToMigrate(snapshots) { - d := repofs.DirectoryEntry(sourceRepo, m.RootObjectID(), nil) + d := snapshotfs.DirectoryEntry(sourceRepo, m.RootObjectID(), nil) newm, err := uploader.Upload(ctx, d, m.Source, nil) if err != nil { return fmt.Errorf("error migrating shapshot %v @ %v: %v", m.Source, m.StartTime, err) diff --git a/cli/command_snapshot_list.go b/cli/command_snapshot_list.go index 642406556..236e88e92 100644 --- a/cli/command_snapshot_list.go +++ b/cli/command_snapshot_list.go @@ -8,12 +8,12 @@ "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/repo/object" "github.com/kopia/kopia/snapshot" "github.com/kopia/kopia/snapshot/policy" + "github.com/kopia/kopia/snapshot/snapshotfs" ) var ( @@ -139,7 +139,7 @@ func outputManifestFromSingleSource(ctx context.Context, rep *repo.Repository, m } for _, m := range manifests { - root, err := repofs.SnapshotRoot(rep, m) + root, err := snapshotfs.SnapshotRoot(rep, m) if err != nil { fmt.Printf(" %v %v\n", formatTimestamp(m.StartTime), err) continue diff --git a/cli/objref.go b/cli/objref.go index 61e24755e..45dbdf7fb 100644 --- a/cli/objref.go +++ b/cli/objref.go @@ -6,9 +6,9 @@ "strings" "github.com/kopia/kopia/fs" - "github.com/kopia/kopia/fs/repofs" "github.com/kopia/kopia/repo" "github.com/kopia/kopia/repo/object" + "github.com/kopia/kopia/snapshot/snapshotfs" ) // ParseObjectID interprets the given ID string and returns corresponding object.ID. @@ -23,7 +23,7 @@ func parseObjectID(ctx context.Context, rep *repo.Repository, id string) (object return oid, nil } - dir := repofs.DirectoryEntry(rep, oid, nil) + dir := snapshotfs.DirectoryEntry(rep, oid, nil) return parseNestedObjectID(ctx, dir, parts[1:]) } diff --git a/fs/repofs/all_sources.go b/snapshot/snapshotfs/all_sources.go similarity index 98% rename from fs/repofs/all_sources.go rename to snapshot/snapshotfs/all_sources.go index 4ea387b5c..23853ff55 100644 --- a/fs/repofs/all_sources.go +++ b/snapshot/snapshotfs/all_sources.go @@ -1,15 +1,13 @@ -package repofs +package snapshotfs import ( "context" "fmt" "time" - "github.com/kopia/kopia/snapshot" - - "github.com/kopia/kopia/repo" - "github.com/kopia/kopia/fs" + "github.com/kopia/kopia/repo" + "github.com/kopia/kopia/snapshot" ) type repositoryAllSources struct { diff --git a/fs/repofs/repofs.go b/snapshot/snapshotfs/repofs.go similarity index 96% rename from fs/repofs/repofs.go rename to snapshot/snapshotfs/repofs.go index c172cdf37..f150dbc5e 100644 --- a/fs/repofs/repofs.go +++ b/snapshot/snapshotfs/repofs.go @@ -1,5 +1,5 @@ -// Package repofs implements virtual filesystem on top of snapshots in repo.Repository. -package repofs +// Package snapshotfs implements virtual filesystem on top of snapshots in repo.Repository. +package snapshotfs import ( "context" diff --git a/fs/repofs/source_directories.go b/snapshot/snapshotfs/source_directories.go similarity index 97% rename from fs/repofs/source_directories.go rename to snapshot/snapshotfs/source_directories.go index 464ab259f..5383e9e5c 100644 --- a/fs/repofs/source_directories.go +++ b/snapshot/snapshotfs/source_directories.go @@ -1,13 +1,12 @@ -package repofs +package snapshotfs import ( "context" "time" - "github.com/kopia/kopia/snapshot" - "github.com/kopia/kopia/fs" "github.com/kopia/kopia/repo" + "github.com/kopia/kopia/snapshot" ) type sourceDirectories struct { diff --git a/fs/repofs/source_snapshots.go b/snapshot/snapshotfs/source_snapshots.go similarity index 98% rename from fs/repofs/source_snapshots.go rename to snapshot/snapshotfs/source_snapshots.go index ee8b72abd..f8176d0f8 100644 --- a/fs/repofs/source_snapshots.go +++ b/snapshot/snapshotfs/source_snapshots.go @@ -1,4 +1,4 @@ -package repofs +package snapshotfs import ( "context"