forked from TrueCloudLab/restic
Add more comments
This commit is contained in:
parent
5170c4898a
commit
878c1cd936
2 changed files with 4 additions and 0 deletions
|
@ -37,6 +37,7 @@ type SnapshotsDir struct {
|
||||||
knownSnapshots map[string]SnapshotWithId
|
knownSnapshots map[string]SnapshotWithId
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// NewSnapshotsDir returns a new dir object for the snapshots.
|
||||||
func NewSnapshotsDir(repo restic.Repository, ownerIsRoot bool) *SnapshotsDir {
|
func NewSnapshotsDir(repo restic.Repository, ownerIsRoot bool) *SnapshotsDir {
|
||||||
debug.Log("NewSnapshotsDir", "fuse mount initiated")
|
debug.Log("NewSnapshotsDir", "fuse mount initiated")
|
||||||
return &SnapshotsDir{
|
return &SnapshotsDir{
|
||||||
|
|
|
@ -49,6 +49,7 @@ func getBoolVar(name string, defaultValue bool) bool {
|
||||||
return defaultValue
|
return defaultValue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// SetupRepo returns a repo setup in a temp dir.
|
||||||
func SetupRepo() restic.Repository {
|
func SetupRepo() restic.Repository {
|
||||||
tempdir, err := ioutil.TempDir(TestTempDir, "restic-test-")
|
tempdir, err := ioutil.TempDir(TestTempDir, "restic-test-")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -70,6 +71,7 @@ func SetupRepo() restic.Repository {
|
||||||
return repo
|
return repo
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TeardownRepo removes a repository created by SetupRepo.
|
||||||
func TeardownRepo(repo restic.Repository) {
|
func TeardownRepo(repo restic.Repository) {
|
||||||
if !TestCleanupTempDirs {
|
if !TestCleanupTempDirs {
|
||||||
l := repo.Backend().(*local.Local)
|
l := repo.Backend().(*local.Local)
|
||||||
|
@ -93,6 +95,7 @@ func SnapshotDir(t testing.TB, repo restic.Repository, path string, parent *rest
|
||||||
return sn
|
return sn
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// WithRepo runs the function t with a repository that is removed after f returns.
|
||||||
func WithRepo(t testing.TB, f func(restic.Repository)) {
|
func WithRepo(t testing.TB, f func(restic.Repository)) {
|
||||||
repo := SetupRepo()
|
repo := SetupRepo()
|
||||||
f(repo)
|
f(repo)
|
||||||
|
|
Loading…
Reference in a new issue