mirror of
https://git.sr.ht/~phw/scotty
synced 2025-05-11 02:27:05 +02:00
Initial implementation of unified export/import progress
Both export and import progress get updated over a unified channel. Most importantly this allows updating the import total from latest export results.
This commit is contained in:
parent
1f48abc284
commit
b8e6ccffdb
18 changed files with 369 additions and 194 deletions
|
@ -109,19 +109,18 @@ func (c *TransferCmd[E, I, R]) Transfer(exp backends.ExportProcessor[R], imp bac
|
|||
printTimestamp("From timestamp: %v (%v)", timestamp)
|
||||
|
||||
// Prepare progress bars
|
||||
exportProgress := make(chan models.Progress)
|
||||
importProgress := make(chan models.Progress)
|
||||
progress := progressBar(exportProgress, importProgress)
|
||||
progressChan := make(chan models.TransferProgress)
|
||||
progress := setupProgressBars(progressChan)
|
||||
|
||||
// Export from source
|
||||
exportChan := make(chan R, 1000)
|
||||
go exp.Process(timestamp, exportChan, exportProgress)
|
||||
go exp.Process(timestamp, exportChan, progressChan)
|
||||
|
||||
// Import into target
|
||||
resultChan := make(chan models.ImportResult)
|
||||
go imp.Process(exportChan, resultChan, importProgress)
|
||||
go imp.Process(exportChan, resultChan, progressChan)
|
||||
result := <-resultChan
|
||||
progress.Wait()
|
||||
progress.wait()
|
||||
|
||||
// Update timestamp
|
||||
err = c.updateTimestamp(&result, timestamp)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue