Reformat progress lines and prune output
Progress lines now use the form: ..., <subject> elapsed: <dur>, <subject> ETA: <time> (est remain <dur>). ui.Time formats same-day times as HH:MM:SS and other-day times as YYYY-MM-DD HH:MM:SS, with no timezone suffix (local time is implied). The local-index-database prune complete line now shows remaining counts for each category: ... 1 incomplete snapshots removed (3 remain), 3783 orphaned files removed (42 remain), ...
This commit is contained in:
@@ -1277,6 +1277,9 @@ func (v *Vaultik) PruneDatabase() (*PruneResult, error) {
|
||||
|
||||
result := &PruneResult{}
|
||||
|
||||
// Snapshot counts before deletion of incompletes.
|
||||
snapshotCountBefore, _ := v.getTableCount("snapshots")
|
||||
|
||||
// First, delete any incomplete snapshots
|
||||
incompleteSnapshots, err := v.Repositories.Snapshots.GetIncompleteSnapshots(v.ctx)
|
||||
if err != nil {
|
||||
@@ -1329,8 +1332,12 @@ func (v *Vaultik) PruneDatabase() (*PruneResult, error) {
|
||||
"orphaned_blobs", result.BlobsDeleted,
|
||||
)
|
||||
|
||||
v.UI.Complete("Pruned local index database: %d incomplete snapshots, %d orphaned files, %d orphaned chunks, %d orphaned blobs removed.",
|
||||
result.SnapshotsDeleted, result.FilesDeleted, result.ChunksDeleted, result.BlobsDeleted)
|
||||
snapshotCountAfter := snapshotCountBefore - result.SnapshotsDeleted
|
||||
v.UI.Complete("Pruned local index database: %d incomplete snapshots removed (%d remain), %d orphaned files removed (%d remain), %d orphaned chunks removed (%d remain), %d orphaned blobs removed (%d remain).",
|
||||
result.SnapshotsDeleted, snapshotCountAfter,
|
||||
result.FilesDeleted, fileCountAfter,
|
||||
result.ChunksDeleted, chunkCountAfter,
|
||||
result.BlobsDeleted, blobCountAfter)
|
||||
|
||||
return result, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user