Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
79 changes: 76 additions & 3 deletions duplicacy/duplicacy_main.go
Original file line number Diff line number Diff line change
Expand Up @@ -985,7 +985,44 @@ func checkSnapshots(context *cli.Context) {
persist := context.Bool("persist")

backupManager.SetupSnapshotCache(preference.Name)
backupManager.SnapshotManager.CheckSnapshots(id, revisions, tag, showStatistics, showTabular, checkFiles, checkChunks, searchFossils, resurrect, rewrite, threads, persist)

snapshotChunksIDsCacheEnabled := duplicacy.GetPasswordFromPreference(
*preference, "snapshot_chunks_ids_cache_enabled",
)
if strings.ToLower(snapshotChunksIDsCacheEnabled) == "true" {
storage.SetIsSnapshotChunksIDsCacheEnabled(true)
} else {
storage.SetIsSnapshotChunksIDsCacheEnabled(false)
}

snapshotChunksIDsCacheRootDir := duplicacy.GetPasswordFromPreference(
*preference, "snapshot_chunks_ids_cache_root_dir",
)
if snapshotChunksIDsCacheRootDir == "" {
storage.SetSnapshotChunksIDsCacheRootDir(backupManager.GetCachePath())
} else {
storage.SetSnapshotChunksIDsCacheRootDir(snapshotChunksIDsCacheRootDir)
}

checkReadsChunkFileListFromCacheOnly := duplicacy.GetPasswordFromPreference(
*preference, "check_reads_chunk_filelist_from_cache_only",
) == "true"

backupManager.SnapshotManager.CheckSnapshots(
id,
revisions,
tag,
showStatistics,
showTabular,
checkFiles,
checkChunks,
searchFossils,
resurrect,
rewrite,
threads,
persist,
checkReadsChunkFileListFromCacheOnly,
)

runScript(context, preference.Name, "post")
}
Expand Down Expand Up @@ -1194,8 +1231,44 @@ func pruneSnapshots(context *cli.Context) {
duplicacy.SavePassword(*preference, "password", password)

backupManager.SetupSnapshotCache(preference.Name)
backupManager.SnapshotManager.PruneSnapshots(selfID, snapshotID, revisions, tags, retentions,
exhaustive, exclusive, ignoredIDs, dryRun, deleteOnly, collectOnly, threads)

snapshotChunksIDsCacheEnabled := duplicacy.GetPasswordFromPreference(
*preference, "snapshot_chunks_ids_cache_enabled",
)
if strings.ToLower(snapshotChunksIDsCacheEnabled) == "true" {
storage.SetIsSnapshotChunksIDsCacheEnabled(true)
} else {
storage.SetIsSnapshotChunksIDsCacheEnabled(false)
}

snapshotChunksIDsCacheRootDir := duplicacy.GetPasswordFromPreference(
*preference, "snapshot_chunks_ids_cache_root_dir",
)
if snapshotChunksIDsCacheRootDir == "" {
storage.SetSnapshotChunksIDsCacheRootDir(backupManager.GetCachePath())
} else {
storage.SetSnapshotChunksIDsCacheRootDir(snapshotChunksIDsCacheRootDir)
}

pruneReadsChunkFileListFromCacheOnly := duplicacy.GetPasswordFromPreference(
*preference, "prune_reads_chunk_filelist_from_cache_only",
) == "true"

backupManager.SnapshotManager.PruneSnapshots(
selfID,
snapshotID,
revisions,
tags,
retentions,
exhaustive,
exclusive,
ignoredIDs,
dryRun,
deleteOnly,
collectOnly,
threads,
pruneReadsChunkFileListFromCacheOnly,
)

runScript(context, preference.Name, "post")
}
Expand Down
8 changes: 6 additions & 2 deletions src/duplicacy_backupmanager.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ type BackupManager struct {
cachePath string
}

func (manager *BackupManager) GetCachePath() string {
return manager.cachePath
}

func (manager *BackupManager) SetDryRun(dryRun bool) {
manager.config.dryRun = dryRun
}
Expand Down Expand Up @@ -682,7 +686,7 @@ func (manager *BackupManager) Restore(top string, revision int, inPlace bool, qu
localSnapshot.ListLocalFiles(top, manager.nobackupFile, manager.filtersFile, manager.excludeByAttribute, localListingChannel, nil, nil)
} ()

remoteSnapshot := manager.SnapshotManager.DownloadSnapshot(manager.snapshotID, revision)
remoteSnapshot := manager.SnapshotManager.DownloadSnapshot(manager.snapshotID, revision, true)
manager.SnapshotManager.DownloadSnapshotSequences(remoteSnapshot)
go func() {
// List remote files
Expand Down Expand Up @@ -1634,7 +1638,7 @@ func (manager *BackupManager) CopySnapshots(otherManager *BackupManager, snapsho
continue
}

snapshot := manager.SnapshotManager.DownloadSnapshot(id, revision)
snapshot := manager.SnapshotManager.DownloadSnapshot(id, revision, true)
snapshots = append(snapshots, snapshot)
}

Expand Down
Loading